-
Notifications
You must be signed in to change notification settings - Fork 24
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
psp-8630 | Updated Leases and added renewals #4180
Conversation
✅ No secrets were detected in the code. |
} | ||
|
||
/// <summary> | ||
/// Update the specified tenants on the passed lease. |
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.
Hmm, what is this endpoint doing in this controller? this seems specific to tenants.
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.
Thought I might need an update for the renewals, so left a stub. Its gone now
_logger.LogInformation("Getting renewals on lease {leaseId}", leaseId); | ||
_user.ThrowIfNotAuthorized(Permissions.LeaseView); | ||
var pimsUser = _userRepository.GetByKeycloakUserId(_user.GetUserKey()); | ||
pimsUser.ThrowInvalidAccessToLeaseFile(_leaseRepository.GetNoTracking(leaseId).RegionCode); |
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.
what does this do for a non-existent lease id?
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.
If the lease ID matches nothing it will return an empty collection
var agreementStart = lease.OrigStartDate.Value; | ||
var agreementEnd = lease.OrigExpiryDate.Value; | ||
currentEndDate = agreementEnd; | ||
if (DateTime.Compare(agreementEnd, agreementStart) <= 0) |
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.
FYI C# supports comparing DateTimes with the regular < <= > >= operators.
|
||
if (DateTime.Compare(currentEndDate, startDate) >= 0) | ||
{ | ||
throw new BusinessRuleViolationException("The commencement date of your renewal should be later than the previous expiry date (agreement or renewal)"); |
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.
I feel like this satisfies the ac in abstract, but not on a 1-1 basis. Make sure there is a not on the story for Praveen so he doesn't fail this.
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.
Also, should the user be able to allow colliding renewal dates when the renewal is not exercised? currently I can.
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.
I had a conversation with julian about this. A non-exercised renewal is functionally a draft, so no validation happens for those
namespace Pims.Dal.Repositories | ||
{ | ||
/// <summary> | ||
/// ILeaseRenewalRepository interface, provides functions to interact with lease tenants within the datasource. |
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.
nit: lease tenants.
<SectionField label="Expiry date"> | ||
<SectionField | ||
label="Expiry" | ||
required={statusTypeCode === ApiGen_CodeTypes_LeaseStatusTypes.ACTIVE} |
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.
I think this field is never required - this rule only applies to the commencement date on the agreement.
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.
This was part of the conversation with Julian. Active leases must have a commencement and expiry dates
async (leaseId: number) => await getLeaseRenewals(leaseId), | ||
[getLeaseRenewals], | ||
), | ||
requestName: 'getApiLeaseChecklist', |
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.
needs updated name, and the error needs updating as well.
} | ||
else | ||
{ | ||
throw new BusinessRuleViolationException("Active leases must have commencement and expiry dates"); |
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.
is this true? I think they just need commencement dates.
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.
Yeah, confirmed by julian. Check above reply
I think commencement date and expiry date for the agreement or supposed to have tooltips (based on confluence). |
{lease.fileStatusTypeCode.id === ApiGen_CodeTypes_LeaseStatusTypes.TERMINATED && ( | ||
<> | ||
<SectionField label="Termination" labelWidth="3"> | ||
{lease.terminationDate} |
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.
I think this should probably be pretty formatted.
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.
I thought I had it that way. Might have been part of the merge
</SectionField> | ||
<Row> | ||
<Col> | ||
<SectionField label="Commencement" labelWidth="6"> |
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.
I guess I'm assuming that both view and edit should have the tooltips for the commencement, expiry, and termination?
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.
It was unclear to me. I can add them later once the BAs see the section live
<Row> | ||
<Col xs="7"> | ||
<SectionField | ||
label="Commencement" |
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.
tooltips missing for commencement, expiry on read/edit.
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.
Pretty odd. I remember adding them. Anyhow, they are there now.
It looks like the formik yup schema was not updated for the new business rules. So, for example, commencement/expiry date are listed as required for exercised renewals visually, but I can still save an exercised renewal without providing any dates. |
|
||
private void ValidateRenewalDates(PimsLease lease, ICollection<PimsLeaseRenewal> renewals) | ||
{ | ||
if (lease.LeaseStatusTypeCode != PimsLeaseStatusTypes.ACTIVE) |
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.
Is this accurate? it seems like dates are optional when a lease is not active, but should the user be allowed to enter overlapping dates when not active?
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.
Thats correct. Check reply above.
This modal message doesn't match jira: is there a mismatch in confluence or something? |
@@ -78,13 +78,13 @@ export const LeaseDetailSubForm: React.FunctionComponent<ILeaseDetailsSubFormPro | |||
}; | |||
|
|||
return ( | |||
<Section> | |||
<SectionField label="Ministry project" labelWidth="2"> | |||
<Section header="Original Aggreement"> |
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.
Aggreement -> Agreement
Also, the message in the story mentions deleting the terminated date when the lease status is set to non-terminated, but I think right now only the termination reason is cleared. |
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.
Needs some changes before merge.
You should get a server error. The AC specifies that the validation happens on save |
TBH, took most of the text as a suggestion given there where ambiguities between the JIRA ticket, confluence and mokcup + a conversation with julian. At this point I rather fine tune this once the BAs use the application. |
✅ No secrets were detected in the code. |
… into features/psp-8630
✅ No secrets were detected in the code. |
Hmm, I don't agree on this one, I can't think of any cases where we mark a field as required but allow the form to be submitted without that required field. |
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.
Also, the yup schema needs to be updated to enforce the max character limit on the new text fields.
It's debatable. Is this a PR blocker? |
no, just the comment about the max text lengths. |
✅ No secrets were detected in the code. |
1 similar comment
✅ No secrets were detected in the code. |
Note: Backend tets will be added after verifying with one of our BAs in a live environment