fixed: pause time calculation from work instead of presence time
All checks were successful
Tests / Run Go Tests (push) Successful in 1m44s

This commit is contained in:
2026-02-24 20:05:08 +01:00
parent b4bf550863
commit f21ce9a3c3
4 changed files with 404 additions and 7 deletions

View File

@@ -45,3 +45,218 @@ var testBookings10hrs = []models.Booking{{
Timestamp: time.Date(2025, 01, 01, 18, 0, 0, 0, time.UTC),
BookingType: testBookingType,
}}
var testBookings6hrsBreak30min = []models.Booking{
{
CardUID: "aaaa-aaaa",
CheckInOut: 1,
Timestamp: time.Date(2025, 01, 01, 8, 0, 0, 0, time.UTC),
BookingType: testBookingType,
},
{
CardUID: "aaaa-aaaa",
CheckInOut: 2,
Timestamp: time.Date(2025, 01, 01, 9, 0, 0, 0, time.UTC),
BookingType: testBookingType,
},
{
CardUID: "aaaa-aaaa",
CheckInOut: 1,
Timestamp: time.Date(2025, 01, 01, 9, 30, 0, 0, time.UTC),
BookingType: testBookingType,
},
{
CardUID: "aaaa-aaaa",
CheckInOut: 2,
Timestamp: time.Date(2025, 01, 01, 14, 30, 0, 0, time.UTC),
BookingType: testBookingType,
}}
var testBookings610hrsBreak30min = []models.Booking{
{
CardUID: "aaaa-aaaa",
CheckInOut: 1,
Timestamp: time.Date(2025, 01, 01, 8, 0, 0, 0, time.UTC),
BookingType: testBookingType,
},
{
CardUID: "aaaa-aaaa",
CheckInOut: 2,
Timestamp: time.Date(2025, 01, 01, 9, 0, 0, 0, time.UTC),
BookingType: testBookingType,
},
{
CardUID: "aaaa-aaaa",
CheckInOut: 1,
Timestamp: time.Date(2025, 01, 01, 9, 30, 0, 0, time.UTC),
BookingType: testBookingType,
},
{
CardUID: "aaaa-aaaa",
CheckInOut: 2,
Timestamp: time.Date(2025, 01, 01, 14, 40, 0, 0, time.UTC),
BookingType: testBookingType,
}}
var testBookings9hrsBreak30min = []models.Booking{
{
CardUID: "aaaa-aaaa",
CheckInOut: 1,
Timestamp: time.Date(2025, 01, 01, 8, 0, 0, 0, time.UTC),
BookingType: testBookingType,
},
{
CardUID: "aaaa-aaaa",
CheckInOut: 2,
Timestamp: time.Date(2025, 01, 01, 9, 0, 0, 0, time.UTC),
BookingType: testBookingType,
},
{
CardUID: "aaaa-aaaa",
CheckInOut: 1,
Timestamp: time.Date(2025, 01, 01, 9, 30, 0, 0, time.UTC),
BookingType: testBookingType,
},
{
CardUID: "aaaa-aaaa",
CheckInOut: 2,
Timestamp: time.Date(2025, 01, 01, 17, 30, 0, 0, time.UTC),
BookingType: testBookingType,
}}
var testBookings930hrs = []models.Booking{
{
CardUID: "aaaa-aaaa",
CheckInOut: 1,
Timestamp: time.Date(2025, 01, 01, 8, 0, 0, 0, time.UTC),
BookingType: testBookingType,
},
{
CardUID: "aaaa-aaaa",
CheckInOut: 2,
Timestamp: time.Date(2025, 01, 01, 17, 30, 0, 0, time.UTC),
BookingType: testBookingType,
}}
var testBookings910hrsBreak30min = []models.Booking{
{
CardUID: "aaaa-aaaa",
CheckInOut: 1,
Timestamp: time.Date(2025, 01, 01, 8, 0, 0, 0, time.UTC),
BookingType: testBookingType,
},
{
CardUID: "aaaa-aaaa",
CheckInOut: 2,
Timestamp: time.Date(2025, 01, 01, 9, 0, 0, 0, time.UTC),
BookingType: testBookingType,
},
{
CardUID: "aaaa-aaaa",
CheckInOut: 1,
Timestamp: time.Date(2025, 01, 01, 9, 30, 0, 0, time.UTC),
BookingType: testBookingType,
},
{
CardUID: "aaaa-aaaa",
CheckInOut: 2,
Timestamp: time.Date(2025, 01, 01, 17, 40, 0, 0, time.UTC),
BookingType: testBookingType,
},
}
var testBookings910hrsBreak35min = []models.Booking{
{
CardUID: "aaaa-aaaa",
CheckInOut: 1,
Timestamp: time.Date(2025, 01, 01, 8, 0, 0, 0, time.UTC),
BookingType: testBookingType,
},
{
CardUID: "aaaa-aaaa",
CheckInOut: 2,
Timestamp: time.Date(2025, 01, 01, 9, 0, 0, 0, time.UTC),
BookingType: testBookingType,
},
{
CardUID: "aaaa-aaaa",
CheckInOut: 1,
Timestamp: time.Date(2025, 01, 01, 9, 35, 0, 0, time.UTC),
BookingType: testBookingType,
},
{
CardUID: "aaaa-aaaa",
CheckInOut: 2,
Timestamp: time.Date(2025, 01, 01, 17, 45, 0, 0, time.UTC),
BookingType: testBookingType,
},
}
var testBookings945hrs = []models.Booking{
{
CardUID: "aaaa-aaaa",
CheckInOut: 1,
Timestamp: time.Date(2025, 01, 01, 8, 0, 0, 0, time.UTC),
BookingType: testBookingType,
},
{
CardUID: "aaaa-aaaa",
CheckInOut: 2,
Timestamp: time.Date(2025, 01, 01, 17, 45, 0, 0, time.UTC),
BookingType: testBookingType,
},
}
var testBookings10hrsBreak45min = []models.Booking{
{
CardUID: "aaaa-aaaa",
CheckInOut: 1,
Timestamp: time.Date(2025, 01, 01, 8, 0, 0, 0, time.UTC),
BookingType: testBookingType,
},
{
CardUID: "aaaa-aaaa",
CheckInOut: 2,
Timestamp: time.Date(2025, 01, 01, 9, 0, 0, 0, time.UTC),
BookingType: testBookingType,
},
{
CardUID: "aaaa-aaaa",
CheckInOut: 1,
Timestamp: time.Date(2025, 01, 01, 9, 45, 0, 0, time.UTC),
BookingType: testBookingType,
},
{
CardUID: "aaaa-aaaa",
CheckInOut: 2,
Timestamp: time.Date(2025, 01, 01, 18, 00, 0, 0, time.UTC),
BookingType: testBookingType,
},
}
var testBookings1030hrsBreak45min = []models.Booking{
{
CardUID: "aaaa-aaaa",
CheckInOut: 1,
Timestamp: time.Date(2025, 01, 01, 8, 0, 0, 0, time.UTC),
BookingType: testBookingType,
},
{
CardUID: "aaaa-aaaa",
CheckInOut: 2,
Timestamp: time.Date(2025, 01, 01, 9, 0, 0, 0, time.UTC),
BookingType: testBookingType,
},
{
CardUID: "aaaa-aaaa",
CheckInOut: 1,
Timestamp: time.Date(2025, 01, 01, 9, 45, 0, 0, time.UTC),
BookingType: testBookingType,
},
{
CardUID: "aaaa-aaaa",
CheckInOut: 2,
Timestamp: time.Date(2025, 01, 01, 18, 30, 0, 0, time.UTC),
BookingType: testBookingType,
},
}