3 Commits

Author SHA1 Message Date
tom
a9268988e1 Merge pull request 'dev/main' (#19) from dev/main into main
Some checks failed
arbeitszeitmessung/pipeline/head There was a failure building this commit
Reviewed-on: #19
2025-06-20 22:17:20 +02:00
6688128d30 fixed pause times for 9h 2025-05-20 15:08:39 +02:00
d955cb02b8 fixed error when only one booking was inserted 2025-05-20 14:47:24 +02:00
3 changed files with 5 additions and 5 deletions

View File

@@ -26,7 +26,7 @@ func (d *WorkDay) GetWorkDays(card_uid string, tsFrom, tsTo time.Time) []WorkDay
qStr, err := DB.Prepare(`
WITH all_days AS (
SELECT generate_series($2, $3, INTERVAL '1 day')::DATE AS work_date
SELECT generate_series($2::DATE, $3::DATE - INTERVAL '1 day', INTERVAL '1 day')::DATE AS work_date
),
ordered_bookings AS (
SELECT
@@ -141,7 +141,7 @@ func (d *WorkDay) GetWorkDays(card_uid string, tsFrom, tsTo time.Time) []WorkDay
func (d *WorkDay) calcPauseTime() {
if d.workTime > 6*time.Hour && d.pauseTime < 45*time.Minute {
if d.workTime < 9*time.Hour && d.pauseTime < 30*time.Minute {
if d.workTime <= (9*time.Hour) && d.pauseTime < 30*time.Minute {
diff := 30*time.Minute - d.pauseTime
d.workTime -= diff
d.pauseTime += diff
@@ -155,7 +155,7 @@ func (d *WorkDay) calcPauseTime() {
// Gets the duration someone worked that day
func (d *WorkDay) getWorkTime() {
if len(d.Bookings) <= 1 && d.Bookings[0].CounterId == 0 {
if len(d.Bookings) < 1 {
return
}
var workTime, pauseTime time.Duration

View File

@@ -66,7 +66,7 @@ templ dayComponent(workDay models.WorkDay) {
if (workDay.Absence != models.Absence{}) {
<p>{ workDay.Absence.GetStringType() }</p>
}
if len(workDay.Bookings) <= 1 && (workDay.Absence == models.Absence{}) {
if len(workDay.Bookings) < 1 && (workDay.Absence == models.Absence{}) {
<p class="text group-[.edit]:hidden">Keine Buchung gefunden. Bitte Arbeitsstunden oder Grund der Abwesenheit eingeben!</p>
@absenceComponent(workDay)
@newBookingComponent(workDay)

View File

@@ -264,7 +264,7 @@ func dayComponent(workDay models.WorkDay) templ.Component {
return templ_7745c5c3_Err
}
}
if len(workDay.Bookings) <= 1 && (workDay.Absence == models.Absence{}) {
if len(workDay.Bookings) < 1 && (workDay.Absence == models.Absence{}) {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 22, "<p class=\"text group-[.edit]:hidden\">Keine Buchung gefunden. Bitte Arbeitsstunden oder Grund der Abwesenheit eingeben!</p>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err