working compound days + working public holidays
Some checks failed
Tests / Run Go Tests (push) Failing after 44s

This commit is contained in:
2025-12-24 01:38:16 +01:00
parent 3439fff841
commit 855cd6f34f
20 changed files with 1180 additions and 616 deletions

View File

@@ -45,7 +45,8 @@ func convertDaysToTypst(days []models.IWorkDay, u models.User) ([]typstDay, erro
func convertDayToTypstDayParts(day models.IWorkDay, user models.User) []typstDayPart {
var typstDayParts []typstDayPart
if day.IsWorkDay() {
switch day.Type() {
case models.DayTypeWorkday:
workDay, _ := day.(*models.WorkDay)
for i := 0; i < len(workDay.Bookings); i += 2 {
var typstDayPart typstDayPart
@@ -64,13 +65,12 @@ func convertDayToTypstDayParts(day models.IWorkDay, user models.User) []typstDay
IsWorkDay: true,
})
}
if workdayAbsence := workDay.GetWorktimeAbsence(); (workdayAbsence != models.Absence{}) {
typstDayParts = append(typstDayParts, typstDayPart{IsWorkDay: false, WorkType: workdayAbsence.AbwesenheitTyp.Name})
case models.DayTypeCompound:
for _, c := range day.(*models.CompoundDay).DayParts {
typstDayParts = append(typstDayParts, convertDayToTypstDayParts(c, user)...)
}
} else {
absentDay, _ := day.(*models.Absence)
typstDayParts = append(typstDayParts, typstDayPart{IsWorkDay: false, WorkType: absentDay.AbwesenheitTyp.Name})
default:
typstDayParts = append(typstDayParts, typstDayPart{IsWorkDay: false, WorkType: day.ToString()})
}
return typstDayParts
}
@@ -91,7 +91,7 @@ func PDFCreateController(w http.ResponseWriter, r *http.Request) {
employes, err := models.GetUserByPersonalNrMulti(personalNumbers)
if err != nil {
slog.Warn("Error getting employes!", slog.Any("Error", err))
return
// return
}
n := 0
@@ -102,6 +102,9 @@ func PDFCreateController(w http.ResponseWriter, r *http.Request) {
}
}
employes = employes[:n]
if helper.GetEnv("GO_ENV", "production") == "debug" {
employes = append(employes, user)
}
reportData := createReports(employes, startDate)