adding more logging + working on displaying if a workday was submitted
Some checks failed
Tests / Run Go Tests (push) Failing after 1m55s

This commit is contained in:
2025-10-14 01:05:02 +02:00
parent 5001f24d9b
commit 0d7696cbc6
15 changed files with 146 additions and 62 deletions

View File

@@ -6,6 +6,7 @@ import (
"database/sql"
"fmt"
"log"
"log/slog"
"net/url"
"strconv"
"time"
@@ -87,6 +88,27 @@ func (b *Booking) Verify() bool {
return true
}
func (b *Booking) IsSubmittedAndChecked() bool {
qStr, err := DB.Prepare(`SELECT bestaetigt from wochen_report WHERE $1 = ANY(anwesenheiten);`)
if err != nil {
slog.Warn("Error when preparing SQL Statement", "error", err)
return false
}
defer qStr.Close()
var isSubmittedAndChecked bool = false
err = qStr.QueryRow(b.CounterId).Scan(&isSubmittedAndChecked)
if err == sql.ErrNoRows {
// No rows found ==> not even submitted
return false
}
if err != nil {
slog.Warn("Unexpected error when executing SQL Statement", "error", err)
}
return isSubmittedAndChecked
}
func (b *Booking) Insert() error {
if !checkLastBooking(*b) {
return SameBookingError{}