-
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-8094, PSP-8095 Warn user that property is part of an existing acquisition/research file #3931
Conversation
asanchezr
commented
Apr 5, 2024
✅ No secrets were detected in the code. |
1 similar comment
✅ No secrets were detected in the code. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev #3931 +/- ##
==========================================
- Coverage 75.01% 73.51% -1.50%
==========================================
Files 1440 956 -484
Lines 39608 22197 -17411
Branches 8152 6966 -1186
==========================================
- Hits 29713 16319 -13394
+ Misses 9598 5878 -3720
+ Partials 297 0 -297
Flags with carried forward coverage won't be shown. Click here to find out more.
|
|
||
export interface IResearchContainerProps { | ||
researchFileId: number; | ||
onClose: () => void; | ||
View: React.FunctionComponent<React.PropsWithChildren<IResearchViewProps>>; |
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 refactored the ResearchContainer
to have the view injected via dependency injection (like other file containers in the code base). This makes testing easier and improves code maintainability.
if (exists(initialForm) && exists(formikRef.current) && needsUserConfirmation) { | ||
if (initialForm.properties.length > 0) { | ||
const formProperty = initialForm.properties[0]; | ||
if (formProperty.apiId && (await confirmBeforeAdd(formProperty.apiId))) { |
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 have to admit I'm a bit surprised by this implementation. Is there any reason why this was written instead of the standard, api-driven user override pattern we've been using up until now? Perhaps I'm just missing something that precludes the use of that workflow.
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, I think the
formProperty.apiId
may be incorrect. Since this is an "Add" workflow, the form should not have an apiId yet - that would only be available in update workflows. I think this is why in my testing I was able to save two new research files back-to-back with the same property.
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.
let's chat over Teams. Easier than typing here but my interpretation (and we asked this) is that they want the check done "before" saving the file (so we can not do an api-driven user override)
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, I think the formProperty.apiId may be incorrect. Since this is an "Add" workflow, the form should not have an apiId yet - that would only be available in update workflows. I think this is why in my testing I was able to save two new research files back-to-back with the same property.
The formProperty.apiId will indeed be populated if you create a file from an existing property on the map (which has apiId set) and that also belongs to another ACQ file. I can show you the flow in the way I tested - maybe I missed something
if (exists(initialValues) && exists(formikRef.current) && needsUserConfirmation) { | ||
if (initialValues.properties.length > 0) { | ||
const formProperty = initialValues.properties[0]; | ||
if (formProperty.apiId && (await confirmBeforeAdd(formProperty.apiId))) { |
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.
same issue here.
Oh, I thought we agreed to do this on save, and that was why we went with "User Override Required" as the header. This is unfortunate, as I think this may have just been an issue with the requirements, and now the implementation is significantly more complex. |
I recall that we devs pushed for doing on Save and BAs went to business and said "no we want on add property before save" that is why I believe it was pointed at 5. To accommodate the fact that we would be going away from stablished pattern |
467e496
to
1200507
Compare
✅ No secrets were detected in the code. |
regardless of this, when adding a new research file that has the same property as a pre-existing research file, no warning displays either on property add or on save. |