From d381bef2eda3f2e0cfc23c272fd7fb673f5d416e Mon Sep 17 00:00:00 2001 From: Rex Lorenzo Date: Tue, 16 Dec 2025 12:19:02 -0800 Subject: [PATCH 1/2] fix(clinical-scheduler): VPR-40 Use local time for audit timestamps - Change DateTime.UtcNow to DateTime.Now for schedule audit and modification timestamps to match existing database conventions - Fix undefined variable bug in lint-staged-dotnet.js (effectiveProjectName was never defined, should be projectName) - Remove redundant --no-build flag from test-dotnet.js (flag is ignored when testing a pre-compiled DLL directly) - Update README.md to clarify lint:staged and precommit command purposes --- README.md | 4 ++-- scripts/lint-staged-dotnet.js | 8 ++++---- scripts/test-dotnet.js | 2 +- .../ClinicalScheduler/Services/ScheduleAuditService.cs | 2 +- .../ClinicalScheduler/Services/ScheduleEditService.cs | 8 ++++---- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 72c0ec43..dcd3c066 100644 --- a/README.md +++ b/README.md @@ -194,8 +194,8 @@ The project includes VS Code launch configurations for debugging both frontend a ### Code Quality - `npm run lint` - Check code style for specified files or directories -- `npm run lint:staged` - Run pre-commit checks manually -- `npm run lint:precommit` - Run lint-staged (used by pre-commit hooks) +- `npm run lint:staged` - Lint only git-staged files +- `npm run precommit` - Run full pre-commit checks manually (lint, test, build verify) ## Troubleshooting diff --git a/scripts/lint-staged-dotnet.js b/scripts/lint-staged-dotnet.js index 881b4acf..c0c7a5f5 100644 --- a/scripts/lint-staged-dotnet.js +++ b/scripts/lint-staged-dotnet.js @@ -143,9 +143,9 @@ const runBuild = (projectPath) => { logger.info(`Force flag enabled, skipping cache for ${projectPath}/ project`) } else { try { - if (!needsBuild(projectPath, effectiveProjectName)) { + if (!needsBuild(projectPath, projectName)) { // Get cached analyzer output instead of skipping analysis - const cachedOutput = getCachedBuildOutput(effectiveProjectName) + const cachedOutput = getCachedBuildOutput(projectName) logger.success(`Build not needed for ${projectPath}/ project (using cached results)`) // Check for analyzer warnings in cached output @@ -171,7 +171,7 @@ const runBuild = (projectPath) => { // Store successful build in cache try { - markAsBuilt(projectPath, effectiveProjectName, result) + markAsBuilt(projectPath, projectName, result) } catch (error) { logger.warning(`Failed to cache build result: ${error.message}`) } @@ -188,7 +188,7 @@ const runBuild = (projectPath) => { // Store build output even for failed builds so analyzers can process it try { - markAsBuilt(projectPath, effectiveProjectName, output) + markAsBuilt(projectPath, projectName, output) } catch (error) { logger.warning(`Failed to cache build output: ${error.message}`) } diff --git a/scripts/test-dotnet.js b/scripts/test-dotnet.js index 107ea308..20f503da 100644 --- a/scripts/test-dotnet.js +++ b/scripts/test-dotnet.js @@ -87,7 +87,7 @@ function ensureBuild() { function runTests() { logger.info("Running tests...") try { - execFileSync("dotnet", ["test", precommitDll, "--no-build", "--verbosity=normal", "--nologo"], { + execFileSync("dotnet", ["test", precommitDll, "--verbosity=normal", "--nologo"], { encoding: "utf8", timeout: 300_000, // 5 minute timeout for tests stdio: "inherit", diff --git a/web/Areas/ClinicalScheduler/Services/ScheduleAuditService.cs b/web/Areas/ClinicalScheduler/Services/ScheduleAuditService.cs index 6655d91a..e0f5ec01 100644 --- a/web/Areas/ClinicalScheduler/Services/ScheduleAuditService.cs +++ b/web/Areas/ClinicalScheduler/Services/ScheduleAuditService.cs @@ -167,7 +167,7 @@ private async Task CreateAuditEntryAsync( WeekId = weekId, Action = action, Area = ScheduleAuditAreas.Clinicians, - TimeStamp = DateTime.UtcNow, + TimeStamp = DateTime.Now, ModifiedBy = modifiedByMothraId }; diff --git a/web/Areas/ClinicalScheduler/Services/ScheduleEditService.cs b/web/Areas/ClinicalScheduler/Services/ScheduleEditService.cs index e756c187..e3927c3f 100644 --- a/web/Areas/ClinicalScheduler/Services/ScheduleEditService.cs +++ b/web/Areas/ClinicalScheduler/Services/ScheduleEditService.cs @@ -168,7 +168,7 @@ public async Task> AddInstructorAsync( WeekId = weekId, Evaluator = isPrimaryEvaluator, ModifiedBy = currentUser.MothraId, - ModifiedDate = DateTime.UtcNow + ModifiedDate = DateTime.Now }; _context.InstructorSchedules.Add(schedule); @@ -410,13 +410,13 @@ await _auditService.LogInstructorRemovedAsync( schedule.Evaluator = true; schedule.ModifiedBy = currentUser.MothraId; - schedule.ModifiedDate = DateTime.UtcNow; + schedule.ModifiedDate = DateTime.Now; } else { schedule.Evaluator = false; schedule.ModifiedBy = currentUser.MothraId; - schedule.ModifiedDate = DateTime.UtcNow; + schedule.ModifiedDate = DateTime.Now; } await _context.SaveChangesAsync(cancellationToken); @@ -587,7 +587,7 @@ private async Task> ClearPrimaryEvaluatorAsync(int rota cancellationToken.ThrowIfCancellationRequested(); schedule.Evaluator = false; schedule.ModifiedBy = modifiedByMothraId; - schedule.ModifiedDate = DateTime.UtcNow; + schedule.ModifiedDate = DateTime.Now; } if (existingPrimary.Any()) From 7e688b4d45af13d958e9944dd896fd9152682f87 Mon Sep 17 00:00:00 2001 From: Rex Lorenzo Date: Fri, 2 Jan 2026 16:43:31 -0800 Subject: [PATCH 2/2] fix(test): Use dynamic year in EmailNotificationTest --- test/ClinicalScheduler/EmailNotificationTest.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/ClinicalScheduler/EmailNotificationTest.cs b/test/ClinicalScheduler/EmailNotificationTest.cs index 3fec6370..8e67b746 100644 --- a/test/ClinicalScheduler/EmailNotificationTest.cs +++ b/test/ClinicalScheduler/EmailNotificationTest.cs @@ -695,7 +695,7 @@ public async Task AddInstructorAsync_AsPrimaryEvaluator_DoesNotSendReplacementEm var rotationId = 50; // Use unique rotation ID to avoid conflict var weekIds = new[] { 50 }; // Use unique week ID to avoid conflict var weekNum = 15; - var testYear = 2025; + var testYear = DateTime.Now.Year; // Add test data await AddTestPersonAsync(oldPrimaryMothraId, "Alice", "Johnson");