-
Notifications
You must be signed in to change notification settings - Fork 14
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
#2033 - Validating FT and PT offering minimum length #2041
#2033 - Validating FT and PT offering minimum length #2041
Conversation
@@ -23,20 +20,32 @@ class HasValidOfferingPeriodForFundedDaysConstraint | |||
implements ValidatorConstraintInterface | |||
{ | |||
validate(studyBreaks: StudyBreak[], args: ValidationArguments): boolean { | |||
const offeringMinDaysAllowedValue = this.getOfferingMinAllowedDays(args); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice implementation to pass the args from the form with respect to the offering intensity, but can this be shared done as a constant without passing them from the form?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work @dheepak-aot, just a doubt I have to better understand the implementation.
...es/education-program-offering/custom-validators/has-valid-offering-period-for-funded-days.ts
Show resolved
Hide resolved
sources/packages/forms/src/form-definitions/educationprogramoffering.json
Outdated
Show resolved
Hide resolved
...kages/backend/apps/api/src/utilities/class-validation/custom-validators/period-min-length.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Added some minor comments
private getMinAllowedDays(args: ValidationArguments): number { | ||
const [, minDaysAllowed] = args.constraints; | ||
const minDaysAllowedValue = | ||
minDaysAllowed instanceof Function |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are just minor things comment by Ann to be changed but the looks good to me. Well done.
Yes @ann-aot the intention was to show one happy path of bulk offering upload testing. |
.../api/src/services/education-program-offering/education-program-offering-validation.models.ts
Outdated
Show resolved
Hide resolved
...kages/backend/apps/api/src/utilities/class-validation/custom-validators/period-min-length.ts
Outdated
Show resolved
Hide resolved
sources/packages/forms/src/form-definitions/educationprogramoffering.json
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work, only minor comments 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me Dheepak 👍. Thank You for providing a walkthrough of your PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks for the explanation @dheepak-aot
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍 Thanks for doing the changes @dheepak-aot
Kudos, SonarCloud Quality Gate passed!
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for doing even the minor changes, look good 👍
Update the minimum offering length validation as per offering intensity
@PeriodMinLength
decorator to accept either a function or a value forminDaysAllowed
.When the same decorator is used for offering validation, the function
studyPeriodMinLength
is assigned to minAllowedDays which calculates minAllowedDays based on offering intensity.@HasValidOfferingPeriodForFundedDays
decorator to have an additional argument to get the minimum allowed days for offering and not use a direct value from constant. The third argument is a function which provides the minimum allowed days based on the offering intensity.educationprogramoffering
form to have client side hidden variables to get minimum and maximum days for study period length and display the banner messaged using the variables.Full Time
Part Time
Bulk offering upload testing