Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SCJ-244: Limit trial length to 40 days #215

Merged
merged 2 commits into from
Jul 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions app/Controllers/ScBookingController.cs
Original file line number Diff line number Diff line change
@@ -143,6 +143,14 @@ public async Task<IActionResult> BookingType(ScBookingTypeViewModel model)
);
}

if (model.EstimatedTrialLength > 40)
{
ModelState.AddModelError(
"EstimatedTrialLength",
"Estimated trial length must be between 1 and 40 days."
);
}

if (model.IsHomeRegistry == null)
{
ModelState.AddModelError(
4 changes: 2 additions & 2 deletions app/Services/DataWriterService.cs
Original file line number Diff line number Diff line change
@@ -75,11 +75,11 @@ SessionUserInfo userInfo
if (
!bookingInfo.EstimatedTrialLength.HasValue
|| bookingInfo.EstimatedTrialLength.Value < 1
|| bookingInfo.EstimatedTrialLength.Value > 99
|| bookingInfo.EstimatedTrialLength.Value > 40
)
{
throw new InvalidOperationException(
"HearingLength must be greater than zero and less than 100"
"HearingLength must be greater than zero and less than 41"
);
}

2 changes: 1 addition & 1 deletion app/Views/ScBooking/BookingType.cshtml
Original file line number Diff line number Diff line change
@@ -76,7 +76,7 @@

<div>
<input class="mr-2 form-control d-inline-block EstimatedTrialLength" type="number" min="1"
asp-for="EstimatedTrialLength" />
max="40" asp-for="EstimatedTrialLength" />
<span>days</span>

<div class="mt-2">