Skip to content

Updating code to use MinConsecutiveWeeks instead of MinWeeks - legacy…#166

Open
bsedwards wants to merge 2 commits intomainfrom
VPR-80-updating-minweek-logic
Open

Updating code to use MinConsecutiveWeeks instead of MinWeeks - legacy…#166
bsedwards wants to merge 2 commits intomainfrom
VPR-80-updating-minweek-logic

Conversation

@bsedwards
Copy link
Copy Markdown
Collaborator

@bsedwards bsedwards commented May 1, 2026

… clinical scheduler code does not show or update MinWeeks

Summary by CodeRabbit

  • Refactor
    • Renamed service configuration property from WeekSize to MinConsecutiveWeeks in clinical scheduler APIs and models.
    • Updated rotation and service response DTOs to expose MinConsecutiveWeeks instead of WeekSize.
    • Revised evaluation policy service method signature to use serviceMinConsecutiveWeeks parameter instead of serviceWeekSize.
    • Updated database mappings and internal services for consistency.

… clinical scheduler code does not show or update MinWeeks
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 1, 2026

Warning

Rate limit exceeded

@bsedwards has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 14 minutes and 26 seconds before requesting another review.

To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 970a0d1f-d991-4e41-95d0-30d987f2019c

📥 Commits

Reviewing files that changed from the base of the PR and between 98ac91b and c6ee6e8.

📒 Files selected for processing (1)
  • test/ClinicalScheduler/RotationsControllerTest.cs
📝 Walkthrough

Walkthrough

Parameter and property WeekSize renamed to MinConsecutiveWeeks across Service model, DTOs, database mapping, service interfaces, controller usage, and corresponding test suite. Changes maintain consistency across layers without altering business logic.

Changes

Cohort / File(s) Summary
Service Model & DTO
web/Models/ClinicalScheduler/Service.cs, web/Areas/ClinicalScheduler/Models/DTOs/Responses/ServiceDto.cs
Property WeekSize replaced with MinConsecutiveWeeks in both model and DTO classes.
Database Mapping
web/Classes/SQLContext/ClinicalSchedulerContext.cs
EF Core property mapping updated from WeekSize column to MinConsecutiveWeeks column in Service entity configuration.
Service Contract & Implementation
web/Areas/ClinicalScheduler/Services/IEvaluationPolicyService.cs, web/Areas/ClinicalScheduler/Services/EvaluationPolicyService.cs
Method parameter serviceWeekSize renamed to serviceMinConsecutiveWeeks in interface and implementation; validation and rule logic updated accordingly.
DTO Mapping Logic
web/Areas/ClinicalScheduler/Extensions/ServiceMappingExtensions.cs
Service.WeekSize mapping replaced with Service.MinConsecutiveWeeks when populating ServiceDto.
Controller
web/Areas/ClinicalScheduler/Controllers/RotationsController.cs
Updated call to RequiresPrimaryEvaluator to pass serviceMinConsecutiveWeeks parameter; rotation response payload exposes renamed property.
Test Suite
test/ClinicalScheduler/EvaluationPolicyServiceTest.cs, test/ClinicalScheduler/RotationMappingExtensionsTests.cs, test/ClinicalScheduler/ServiceMappingExtensionsTests.cs
Test methods, parameter names, assertions, and test data updated to reference MinConsecutiveWeeks instead of WeekSize.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Title check ⚠️ Warning The title mentions 'MinWeeks' but the changeset uses 'MinConsecutiveWeeks' throughout—there's a naming mismatch that could confuse reviewers. Update the title to 'Updating code to use MinConsecutiveWeeks instead of WeekSize' to accurately reflect the actual property name change in the diff.
Docstring Coverage ⚠️ Warning Docstring coverage is 22.73% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch VPR-80-updating-minweek-logic

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
Review rate limit: 0/1 reviews remaining, refill in 14 minutes and 26 seconds.

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented May 1, 2026

Codecov Report

❌ Patch coverage is 87.50000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 43.40%. Comparing base (7d7bee6) to head (c6ee6e8).

Files with missing lines Patch % Lines
...inicalScheduler/Controllers/RotationsController.cs 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #166      +/-   ##
==========================================
+ Coverage   43.34%   43.40%   +0.05%     
==========================================
  Files         863      863              
  Lines       50476    50476              
  Branches     4724     4724              
==========================================
+ Hits        21879    21909      +30     
+ Misses      28074    28044      -30     
  Partials      523      523              
Flag Coverage Δ
backend 43.48% <87.50%> (+0.06%) ⬆️
frontend 41.69% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
test/ClinicalScheduler/RotationMappingExtensionsTests.cs (1)

25-43: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

MinConsecutiveWeeks is arranged but never asserted in this test.

Add an assertion for the nested mapped value so this rename is actually protected by this test.

Proposed test fix
             Assert.NotNull(dto.Service);
             Assert.Equal(rotation.Service.ServiceId, dto.Service.ServiceId);
             Assert.Equal(rotation.Service.ServiceName, dto.Service.ServiceName);
+            Assert.Equal(rotation.Service.MinConsecutiveWeeks, dto.Service.MinConsecutiveWeeks);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@test/ClinicalScheduler/RotationMappingExtensionsTests.cs` around lines 25 -
43, The test in RotationMappingExtensionsTests constructs a rotation with
MinConsecutiveWeeks set but never asserts it; update the assertion block after
dto = rotation.ToDto() to assert the nested mapped value by adding an assertion
comparing rotation.MinConsecutiveWeeks to dto.MinConsecutiveWeeks so the mapping
is verified (locate the rotation variable and the dto result in the test and add
Assert.Equal(rotation.MinConsecutiveWeeks, dto.MinConsecutiveWeeks)).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@test/ClinicalScheduler/RotationMappingExtensionsTests.cs`:
- Around line 25-43: The test in RotationMappingExtensionsTests constructs a
rotation with MinConsecutiveWeeks set but never asserts it; update the assertion
block after dto = rotation.ToDto() to assert the nested mapped value by adding
an assertion comparing rotation.MinConsecutiveWeeks to dto.MinConsecutiveWeeks
so the mapping is verified (locate the rotation variable and the dto result in
the test and add Assert.Equal(rotation.MinConsecutiveWeeks,
dto.MinConsecutiveWeeks)).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: be1e4873-ad92-40c2-9047-9706720fcd1a

📥 Commits

Reviewing files that changed from the base of the PR and between 7d7bee6 and 98ac91b.

📒 Files selected for processing (10)
  • test/ClinicalScheduler/EvaluationPolicyServiceTest.cs
  • test/ClinicalScheduler/RotationMappingExtensionsTests.cs
  • test/ClinicalScheduler/ServiceMappingExtensionsTests.cs
  • web/Areas/ClinicalScheduler/Controllers/RotationsController.cs
  • web/Areas/ClinicalScheduler/Extensions/ServiceMappingExtensions.cs
  • web/Areas/ClinicalScheduler/Models/DTOs/Responses/ServiceDto.cs
  • web/Areas/ClinicalScheduler/Services/EvaluationPolicyService.cs
  • web/Areas/ClinicalScheduler/Services/IEvaluationPolicyService.cs
  • web/Classes/SQLContext/ClinicalSchedulerContext.cs
  • web/Models/ClinicalScheduler/Service.cs

@bsedwards bsedwards requested review from rlorenzo May 1, 2026 19:36
@codecov-commenter
Copy link
Copy Markdown

Bundle Report

Bundle size has no change ✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants