fixed sonarqube issues
All checks were successful
Tests / Run Go Tests (push) Successful in 1m34s

This commit is contained in:
2025-10-29 00:17:07 +01:00
parent cf5238f024
commit ac59d2642f
2 changed files with 7 additions and 5 deletions

View File

@@ -14,12 +14,14 @@ import (
"github.com/Dadido3/go-typst"
)
const DE_DATE string = "02.01.2006"
func convertDaysToTypst(days []models.IWorkDay, u models.User) ([]typstDay, error) {
var typstDays []typstDay
for _, day := range days {
var thisTypstDay typstDay
work, pause, overtime := day.GetAllWorkTimesVirtual(u)
thisTypstDay.Date = day.Date().Format("02.01.2006")
thisTypstDay.Date = day.Date().Format(DE_DATE)
thisTypstDay.Worktime = helper.FormatDurationFill(work, true)
thisTypstDay.Pausetime = helper.FormatDurationFill(pause, true)
thisTypstDay.Overtime = helper.FormatDurationFill(overtime, true)
@@ -140,7 +142,7 @@ func createEmployeReport(employee models.User, startDate, endDate time.Time) (by
metadata := typstMetadata{
EmployeeName: fmt.Sprintf("%s %s", employee.Vorname, employee.Name),
TimeRange: fmt.Sprintf("%s - %s", startDate.Format("02.01.2006"), endDate.Format("02.01.2006")),
TimeRange: fmt.Sprintf("%s - %s", startDate.Format(DE_DATE), endDate.Format(DE_DATE)),
Overtime: helper.FormatDurationFill(worktimeBalance, true),
WorkTime: helper.FormatDurationFill(actualHours, true),
OvertimeTotal: "",
@@ -179,7 +181,7 @@ func PDFHandler(w http.ResponseWriter, r *http.Request) {
}
metadata := typstMetadata{
EmployeeName: fmt.Sprintf("%s %s", user.Vorname, user.Name),
TimeRange: fmt.Sprintf("%s - %s", startDate.Format("02.01.2006"), endDate.Format("02.01.2006")),
TimeRange: fmt.Sprintf("%s - %s", startDate.Format(DE_DATE), endDate.Format(DE_DATE)),
Overtime: helper.FormatDurationFill(aggregatedOvertime, true),
WorkTime: helper.FormatDurationFill(aggregatedWorkTime, true),
OvertimeTotal: "",

View File

@@ -20,9 +20,9 @@ func (e *NoValueError) Error() string {
return fmt.Sprintf("No value found for key %s", e.Key)
}
func New(_urlParams url.Values) ParamsParser {
func New(params url.Values) ParamsParser {
return ParamsParser{
urlParams: _urlParams,
urlParams: params,
}
}