From b0deb62c82e547448c50c8ba837f0fdb4dae19fe Mon Sep 17 00:00:00 2001 From: Chris Chen Date: Tue, 23 Jun 2026 20:20:12 -0700 Subject: [PATCH] update sunday --- API/ROLAC.API/Controllers/MealAttendanceController.cs | 2 +- API/ROLAC.API/Hubs/AttendanceHub.cs | 6 +++--- API/ROLAC.API/Services/IMealAttendanceService.cs | 2 +- API/ROLAC.API/Services/MealAttendanceService.cs | 9 ++++++++- APP/package.json | 4 ++-- 5 files changed, 15 insertions(+), 8 deletions(-) diff --git a/API/ROLAC.API/Controllers/MealAttendanceController.cs b/API/ROLAC.API/Controllers/MealAttendanceController.cs index a89f689..4282885 100644 --- a/API/ROLAC.API/Controllers/MealAttendanceController.cs +++ b/API/ROLAC.API/Controllers/MealAttendanceController.cs @@ -16,7 +16,7 @@ public class MealAttendanceController : ControllerBase [HttpGet("today")] [AllowAnonymous] public async Task GetToday() - => Ok(await _svc.GetOrCreateAsync(_svc.Today)); + => Ok(await _svc.GetOrCreateAsync(_svc.ServiceDay)); /// Daily counts within a date range, for the back-office dashboard chart. [HttpGet] diff --git a/API/ROLAC.API/Hubs/AttendanceHub.cs b/API/ROLAC.API/Hubs/AttendanceHub.cs index 25f5f77..8714939 100644 --- a/API/ROLAC.API/Hubs/AttendanceHub.cs +++ b/API/ROLAC.API/Hubs/AttendanceHub.cs @@ -18,7 +18,7 @@ public class AttendanceHub : Hub // Push the current counts to a client the moment it connects. public override async Task OnConnectedAsync() { - var counts = await _svc.GetOrCreateAsync(_svc.Today); + var counts = await _svc.GetOrCreateAsync(_svc.ServiceDay); await Clients.Caller.SendAsync("ReceiveCounts", counts); await base.OnConnectedAsync(); } @@ -26,14 +26,14 @@ public class AttendanceHub : Hub // Apply a batched delta for one age group, then broadcast the new totals to everyone. public async Task Increment(string category, int delta) { - var counts = await _svc.IncrementAsync(_svc.Today, category, delta); + var counts = await _svc.IncrementAsync(_svc.ServiceDay, category, delta); await Clients.All.SendAsync("ReceiveCounts", counts); } // Overwrite one age group with an absolute value, then broadcast the new totals to everyone. public async Task SetCount(string category, int value) { - var counts = await _svc.SetAsync(_svc.Today, category, value); + var counts = await _svc.SetAsync(_svc.ServiceDay, category, value); await Clients.All.SendAsync("ReceiveCounts", counts); } } diff --git a/API/ROLAC.API/Services/IMealAttendanceService.cs b/API/ROLAC.API/Services/IMealAttendanceService.cs index b0284e8..05c122f 100644 --- a/API/ROLAC.API/Services/IMealAttendanceService.cs +++ b/API/ROLAC.API/Services/IMealAttendanceService.cs @@ -5,7 +5,7 @@ namespace ROLAC.API.Services; public interface IMealAttendanceService { /// Today's date in the server's local time zone (the church's "current Sunday"). - DateOnly Today { get; } + DateOnly ServiceDay { get; } /// Returns the counts for , creating a zeroed row if none exists. Task GetOrCreateAsync(DateOnly date); diff --git a/API/ROLAC.API/Services/MealAttendanceService.cs b/API/ROLAC.API/Services/MealAttendanceService.cs index 343210d..3f82717 100644 --- a/API/ROLAC.API/Services/MealAttendanceService.cs +++ b/API/ROLAC.API/Services/MealAttendanceService.cs @@ -12,7 +12,14 @@ public class MealAttendanceService : IMealAttendanceService public MealAttendanceService(AppDbContext db) => _db = db; // Server local time is assumed to match the church's local day. - public DateOnly Today => DateOnly.FromDateTime(DateTime.Now); + public DateOnly ServiceDay + { + get + { + var today = DateOnly.FromDateTime(DateTime.Now); + return today.AddDays(-(int)today.DayOfWeek); + } + } public async Task GetOrCreateAsync(DateOnly date) { diff --git a/APP/package.json b/APP/package.json index 37f955a..4c6e017 100644 --- a/APP/package.json +++ b/APP/package.json @@ -1,5 +1,5 @@ { - "name": "RBJ.Identity.App", + "name": "ROLAC.App", "version": "0.0.0", "scripts": { "ng": "ng", @@ -92,4 +92,4 @@ "tailwindcss": "^4.3.0", "typescript": "~5.8.2" } -} +} \ No newline at end of file