added overtime to time and team page + ui improvements + mobile support for team page closed #12

This commit is contained in:
2025-09-04 00:11:33 +02:00
parent 45440b6457
commit 1ae30c11cb
19 changed files with 2138 additions and 387 deletions

View File

@@ -81,7 +81,7 @@ func (d *WorkDay) GetWorkDays(card_uid string, tsFrom, tsTo time.Time) []WorkDay
LEFT JOIN ordered_bookings b ON d.work_date = b.work_date
LEFT JOIN abwesenheiten a ON d.work_date = a.work_date
GROUP BY d.work_date, a.abwesenheit_typ
ORDER BY d.work_date;`)
ORDER BY d.work_date ASC;`)
if err != nil {
log.Println("Error preparing SQL statement", err)
@@ -126,10 +126,12 @@ func (d *WorkDay) GetWorkDays(card_uid string, tsFrom, tsTo time.Time) []WorkDay
} else {
workDay.calcPauseTime()
}
if emptyDays || len(workDay.Bookings) > 0 || (workDay.Absence != Absence{}) {
if emptyDays && workDay.Day.Weekday() >= 1 && workDay.Day.Weekday() <= 5 {
workDays = append(workDays, workDay)
} else {
log.Println("no booking on day", workDay.Day.Format("02.01.2006"))
} else if len(workDay.Bookings) > 0 || (workDay.Absence != Absence{}) {
workDays = append(workDays, workDay)
// } else {
// log.Println("no booking on day", workDay.Day.Format("02.01.2006"))
}
}
if err = rows.Err(); err != nil {
@@ -202,8 +204,8 @@ func (d *WorkDay) GetWorkDayProgress(user User) uint8 {
func (d *WorkDay) CalcOvertime(user User) time.Duration {
var overtime time.Duration
// weekday is WE
overtime = d.workTime - time.Duration(user.ArbeitszeitPerTag*float32(time.Hour)).Round(time.Minute)
// weekday is WE
if (d.Day.Weekday() == 6 || d.Day.Weekday() == 0) && len(d.Bookings) == 0 {
overtime = 0
}