-
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
Added check status logic when updating acq and related entities | psp-7006 #3602
Conversation
✅ No secrets were detected in the code. |
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## dev #3602 +/- ##
==========================================
- Coverage 69.68% 69.51% -0.18%
==========================================
Files 1372 1375 +3
Lines 34020 34362 +342
Branches 6366 6486 +120
==========================================
+ Hits 23707 23886 +179
- Misses 10059 10216 +157
- Partials 254 260 +6
Flags with carried forward coverage won't be shown. Click here to find out more.
|
✅ No secrets were detected in the code. |
✅ No secrets were detected in the code. |
@FuriousLlama I checked this out, but I don't see this anywhere: Edit Button Is Hidden GIVEN |
Hmm, the story does not go into how to control the behaviour of making an agreement editable/non-editable when it is swapped from draft to final in a file that is already in the final status. I do think it is a bit jarring to disable the fields the instant the status change happens (before the agreement is saved). Could that be changed to only make non-editable when the agreement status is final AND there is no id (indicating an unsaved agreement)? |
@@ -240,6 +244,12 @@ public PimsAcquisitionFile Update(PimsAcquisitionFile acquisitionFile, IEnumerab | |||
ValidateVersion(acquisitionFile.Internal_Id, acquisitionFile.ConcurrencyControlNumber); | |||
ValidateDrafts(acquisitionFile.Internal_Id); | |||
|
|||
AcqusitionStatusTypes? currentAcquisitionStatus = GetCurrentAcquisitionStatus(acquisitionFile.Internal_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.
nit: acqusition -> acquisition
namespace Pims.Api.Constants | ||
{ | ||
[JsonConverter(typeof(JsonStringEnumMemberConverter))] | ||
public enum AcqusitionStatusTypes |
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: acqusition
var toBeUpdated = currentAgreements.Where(ca => agreements.Any(na => ca.AgreementId == na.AgreementId && !ca.IsEqual(na))); | ||
var toBeDeleted = currentAgreements.Where(ca => !agreements.Any(na => ca.AgreementId == na.AgreementId)); | ||
|
||
foreach (var agreement in toBeUpdated) |
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 there a reason that agreements being edited and agreements being deleted are being split out into their own loops? Seems like the business logic that is being executed is identical, sort of adds an implication that updates should not be handles the same as deletes.
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.
Although true, doing the loop on each would be the same as doing the loop on an aggregated collection.
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 looks like you added an explicit check/throw for stakeholders and checklists even though those errors will not get thrown in current state. I'm fine with that as it provides a consistent pattern for update logic, but doesn't that mean you should add a check for updateProperties as well?
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.
From what I gather on the confluence page the properties are allowed to be updated at all times (all statues)
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.
right, but the same applies to stakeholders and checklists, why have explicit logic for those and not for properties?
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.
Ah, I understand what you are saying now. Initially I had it like that, but it felt like adding those checks was adding unnecessary complexity. If you feel strongly about it I can add them back.
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'm neutral about it.
var currentAcquisitionFile = _acqFileRepository.GetById(currentCompensation.AcquisitionFileId); | ||
var currentAcquisitionStatus = Enum.Parse<AcqusitionStatusTypes>(currentAcquisitionFile.AcquisitionFileStatusTypeCode); | ||
|
||
if (!_statusSolver.CanEditOrDeleteCompensation(currentAcquisitionStatus, currentCompensation.IsDraft) && !_user.HasPermission(Permissions.SystemAdmin)) |
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 actually don't see a requirement for an admin to be able to override this in the story, can you point that out to me?
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's from a different story. I figured those where additive instead of replaced.
@@ -90,6 +100,15 @@ public bool DeleteCompensation(long compensationId) | |||
_logger.LogInformation("Deleting compensation with id ...", compensationId); | |||
_user.ThrowIfNotAuthorized(Permissions.CompensationRequisitionDelete, Permissions.AcquisitionFileEdit); | |||
|
|||
var currentCompensation = _compensationRequisitionRepository.GetById(compensationId); | |||
|
|||
var currentAcqusitionStatus = GetCurrentAcqusitionStatus(currentCompensation.AcquisitionFileId); |
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: getcurrent acqusition
@@ -11,5 +11,28 @@ public partial class PimsAgreement : StandardIdentityBaseAppEntity<long>, IBaseA | |||
[NotMapped] | |||
public override long Internal_Id { get => this.AgreementId; set => this.AgreementId = value; } | |||
#endregion | |||
|
|||
public bool IsEqual(PimsAgreement other) |
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.
In my experience isEqual methods generally handle being passed a null other value.
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.
That's a good point, however, this one is not a Comparable but rather a helper method. I can make it more standard too but I am not sure we gain much from it.
using Pims.Dal; | ||
using Pims.Dal.Configuration.Generators; | ||
using Pims.Dal.Entities; |
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 seems odd, looks like you are adding imports but then not using them anywhere?
return ( | ||
<StyledSummarySection> | ||
<StyledEditWrapper className="mr-3 my-1"> | ||
{keycloak.hasClaim(Claims.ACQUISITION_EDIT) && acquisitionFile !== undefined ? ( |
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.
are we ok removing that undefined acquisitionFile check?
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.
the status solver does take into account the acq file being null/undefined
compensation={compensation} | ||
compensationContactPerson={payeePerson} | ||
compensationContactOrganization={payeeOrganization} | ||
acqFileProject={acquisitionFile?.project} |
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.
huh, I wonder why these were split out like 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.
note sure, but now is more cohesive
@@ -83,101 +78,4 @@ describe('StakeHolderContainer component', () => { | |||
const { asFragment } = setup({}); | |||
expect(asFragment()).toMatchSnapshot(); | |||
}); | |||
|
|||
it('groups multiple interest holder properties by acquisition file id', async () => { |
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 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.
All the tests for the grouping logic was movied into its own test file that only deals with that.
model.identifier = 'PID: 025-196-375'; | ||
const { getByText } = setup({ | ||
props: { | ||
groupedInterestProperties: [], | ||
groupedNonInterestProperties: [model], | ||
//groupedInterestProperties: [], |
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 this is a wip, please fix. if not, can you remove these 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.
ups. forgot to cleanup this tests
onEdit={onEdit} | ||
/> | ||
); | ||
}; | ||
|
||
const getGroupedInterestProperties = ( |
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 related to this PR? If not, I'd really prefer we separate these kind of changes into their own 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.
Thats fair. I rather keep it as is now and in the future create new PRs
@@ -0,0 +1,84 @@ | |||
import { Api_AcquisitionFile } from '@/models/api/AcquisitionFile'; |
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 looks a bit like unrelated tech-debt. I prefer this, but feel like this should have been done in a separate PR at least.
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.
True, I refactored to leverage similar props being passed. It also contains the grouping logic instead of being part of the view
I'm seeing a lot of line coverage warnings for these changes. Can you confirm that this PR conforms to our minimum test coverage requirements:
|
The backend logic has very thorough tests. I can add some to the front end too for the solver, but otherwise, it should have the same amount of tests. |
✅ No secrets were detected in the code. |
✅ No secrets were detected in the code. |
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.
Approved, but you are going to get a test reject from not displaying the warning tooltip in place of the edit icon.
Tooltip is there :) |
✅ No secrets were detected in the code. |
✅ No secrets were detected in the code. |
✅ No secrets were detected in the code. |
* Added check status logic when updating acq and related entities | psp-7006 (#3602) * Added status checking to details, take, compensation and other acq file pages * Updated backend and updated tests * Fixed lint * Refactored solver to be simpler * Added tests * Pr comments * Added the sys-admin to edit acquisition fields * CI: Bump version to v4.0.0-67.24 --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
* Added check status logic when updating acq and related entities | psp-7006 (#3602) * Added status checking to details, take, compensation and other acq file pages * Updated backend and updated tests * Fixed lint * Refactored solver to be simpler * Added tests * Pr comments * Added the sys-admin to edit acquisition fields * CI: Bump version to v4.0.0-67.24 * Updated placeholder display (#3620) * CI: Bump version to v4.0.0-67.25 * dialog correction. (#3629) Co-authored-by: Smith <Devin.Smith@quartech.com> * CI: Bump version to v4.0.0-67.26 * Keycloak Refactor (#3624) * Refactored keycloak sync to use the keycloak repository used by the API. ALso removed tools.Core and removed redundant models * pr fixes * CI: Bump version to v4.0.0-67.27 * System error modal | psp-7304 (#3628) * Updated Generic modal to use a variant * Improved System error modal * Lit fixes * Info fixes * CI: Bump version to v4.0.0-67.28 * psp-7346 correct bracket usage, ensure logic limited to file close only. (#3622) * psp-7346 correct bracket usage, ensure logic limited to file close only. * comment from code review. * test correction. --------- Co-authored-by: Smith <Devin.Smith@quartech.com> * CI: Bump version to v4.0.0-67.29 * requested source marked as nullable for validation. (#3630) Co-authored-by: Smith <Devin.Smith@quartech.com> * CI: Bump version to v4.0.0-67.30 * allow showing the edit screen for management activity while the popout is open. (#3632) Co-authored-by: Smith <Devin.Smith@quartech.com> * CI: Bump version to v4.0.0-67.31 * Pims api to Frontend ts generator and generated files (#3618) * Refactored concept models. Created a new library and cleaned dependencies between projects. Cleaned names of reused concepts and standarized concept namespace. Cleaned extension and help files * Fixed lints * Initial generator work * Cleaned up files and improved translation * Updated namespaces and path for the api models * Updated generator and cleaned up code * Added make command to generate ts api files and lint them. * First generation of the pims api. * Cleaned up generator and handled generic types. Improved header docks. * Fixed solution * Updated models for keycloak sync and fixed lint warnings * Fixed registering mappers * CI: Bump version to v4.0.0-67.32 * Bump DEV version - IS68 (#3636) * CI: Bump version to v4.0.0-68.1 * Manual merges and re-generated snaps * moved disposition models to the new api-models project * re-generated api models * Changed disposition property to property model type --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: devinleighsmith <41091511+devinleighsmith@users.noreply.github.com> Co-authored-by: Smith <Devin.Smith@quartech.com> Co-authored-by: Alejandro Sanchez <emailforasr@gmail.com>
* Added check status logic when updating acq and related entities | psp-7006 (#3602) * Added status checking to details, take, compensation and other acq file pages * Updated backend and updated tests * Fixed lint * Refactored solver to be simpler * Added tests * Pr comments * Added the sys-admin to edit acquisition fields * CI: Bump version to v4.0.0-67.24 * Updated placeholder display (#3620) * CI: Bump version to v4.0.0-67.25 * Added the disposition entry into the menu list --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
No description provided.