dev/main #19

Merged
tom_trgr merged 24 commits from dev/main into main 2025-06-20 22:17:21 +02:00
2 changed files with 3 additions and 1 deletions
Showing only changes of commit b377a19829 - Show all commits

View File

@@ -5,6 +5,7 @@ import (
"arbeitszeitmessung/models" "arbeitszeitmessung/models"
"encoding/json" "encoding/json"
"fmt" "fmt"
"log"
"net/http" "net/http"
) )
@@ -31,6 +32,7 @@ func autoLogout(w http.ResponseWriter) {
fmt.Printf("Error logging out user %v\n", err) fmt.Printf("Error logging out user %v\n", err)
} else { } else {
logged_out_users = append(logged_out_users, user) logged_out_users = append(logged_out_users, user)
log.Printf("Automaticaly logged out user %s, %s ", user.Name, user.Vorname)
} }
} }

View File

@@ -68,7 +68,7 @@ func (u *User) GetAll() ([]User, error) {
// Returns true if there is a booking 1 for today -> meaning the user is at work // Returns true if there is a booking 1 for today -> meaning the user is at work
// Returns false if there is no booking today or the user is already booked out of the system // Returns false if there is no booking today or the user is already booked out of the system
func (u *User) CheckAnwesenheit() bool { func (u *User) CheckAnwesenheit() bool {
qStr, err := DB.Prepare((`SELECT check_in_out FROM anwesenheit WHERE card_uid = $1 AND "timestamp" >= now()::date + interval '1h' ORDER BY "timestamp" DESC LIMIT 1;`)) qStr, err := DB.Prepare((`SELECT check_in_out FROM anwesenheit WHERE card_uid = $1 AND "timestamp"::date = now()::date ORDER BY "timestamp" DESC LIMIT 1;`))
if err != nil { if err != nil {
fmt.Printf("Error preparing query statement %v\n", err) fmt.Printf("Error preparing query statement %v\n", err)
return false return false