fixed error when only one booking was inserted
This commit is contained in:
@@ -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
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user