2 Commits

Author SHA1 Message Date
9918c43527 fixed autoLogout 2025-04-24 17:48:03 +02:00
b7171d77c7 updated styles 2025-04-10 09:22:28 +02:00
3 changed files with 709 additions and 4 deletions

View File

@@ -5,6 +5,7 @@ import (
"arbeitszeitmessung/models"
"encoding/json"
"fmt"
"log"
"net/http"
)
@@ -29,8 +30,9 @@ func autoLogout(w http.ResponseWriter) {
err = user.Logout()
if err != nil {
fmt.Printf("Error logging out user %v\n", err)
}else {
logged_out_users = append(logged_out_users, user)
} else {
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 false if there is no booking today or the user is already booked out of the system
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 {
fmt.Printf("Error preparing query statement %v\n", err)
return false

File diff suppressed because one or more lines are too long