fixed #70 + made db script ignore double bookings
Some checks failed
Tests / Run Go Tests (push) Failing after 2m0s

This commit is contained in:
2026-01-17 22:25:25 +01:00
parent 1daf4db167
commit cfd77ae28d
6 changed files with 105 additions and 32 deletions

View File

@@ -160,19 +160,13 @@ func updateBooking(w http.ResponseWriter, r *http.Request) {
newBooking := (*models.Booking).New(nil, user.CardUID, 0, int16(check_in_out), 1)
newBooking.Timestamp = timestamp
err = newBooking.InsertWithTimestamp()
if err != nil {
log.Printf("Error inserting booking %v -> %v\n", newBooking, err)
if newBooking.Verify() {
err = newBooking.InsertWithTimestamp()
if err != nil {
log.Printf("Error inserting booking %v -> %v\n", newBooking, err)
}
}
case "change":
// absenceType, err := strconv.Atoi(r.FormValue("absence"))
// if err != nil {
// log.Println("Error parsing absence type.", err)
// absenceType = 0
// }
// if absenceType != 0 {
// createAbsence(absenceType, user, loc, r)
// }
for index, possibleBooking := range r.PostForm {
if len(index) > 7 && index[:7] == "booking" {
booking_id, err := strconv.Atoi(index[8:])