feat(scheduling,admin,today): week-range queries, file size limits, mobile nav UX
- Expand exceptional application query to Monday of start week - Add 20MB file size limit with visual feedback in ImageUpload - Reorder admin nav links, add burger badge, slide transition + backdrop - Fetch week-range working/available hours, add closing time indicator - Skip lunch protection for days <= 5h via shouldApplyLunchProtection - Extract formatDateISO to shared utils
This commit is contained in:
@@ -141,11 +141,19 @@ func GetWorkingHours(w http.ResponseWriter, r *http.Request) {
|
||||
defRows.Close()
|
||||
|
||||
// Load exceptional applications for Mondays in range
|
||||
// Expand start to the Monday of its week so single-day queries still find the correct application
|
||||
startWeekday := int(start.Weekday())
|
||||
daysSinceMonday := startWeekday - 1
|
||||
if daysSinceMonday < 0 {
|
||||
daysSinceMonday = 6 // Sunday
|
||||
}
|
||||
queryStart := start.AddDate(0, 0, -daysSinceMonday)
|
||||
|
||||
appRows, _ := db.DB.Query(r.Context(), `
|
||||
SELECT group_id, week_start
|
||||
FROM exceptional_group_applications
|
||||
WHERE week_start BETWEEN $1 AND $2
|
||||
`, start, end)
|
||||
`, queryStart, end)
|
||||
type appEntry struct {
|
||||
GroupID int
|
||||
WeekStart time.Time
|
||||
@@ -321,11 +329,19 @@ func GetAvailableHours(w http.ResponseWriter, r *http.Request) {
|
||||
defRows.Close()
|
||||
|
||||
// Load exceptional applications for Mondays in range
|
||||
// Expand start to the Monday of its week so single-day queries still find the correct application
|
||||
startWeekday := int(start.Weekday())
|
||||
daysSinceMonday := startWeekday - 1
|
||||
if daysSinceMonday < 0 {
|
||||
daysSinceMonday = 6 // Sunday
|
||||
}
|
||||
queryStart := start.AddDate(0, 0, -daysSinceMonday)
|
||||
|
||||
appRows, _ := db.DB.Query(r.Context(), `
|
||||
SELECT group_id, week_start
|
||||
FROM exceptional_group_applications
|
||||
WHERE week_start BETWEEN $1 AND $2
|
||||
`, start, end)
|
||||
`, queryStart, end)
|
||||
type appEntry struct {
|
||||
GroupID int
|
||||
WeekStart time.Time
|
||||
|
||||
Reference in New Issue
Block a user