-
Notifications
You must be signed in to change notification settings - Fork 1
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
#953 - Part 2 Generate review assignments action not auto assign final decision #955
#953 - Part 2 Generate review assignments action not auto assign final decision #955
Conversation
… be assigned prior to work started
…nts' into #953-generateReviewAssignments-action-not-auto-assign-final-decision
… as unlocked on unassignment - so the newly asignee is not locked anymore
Beep boop! This pull request does not have an associated issue :(. |
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, great to see a PR that is mainly removals :)
See my inline comment about the "is_locked" situation.
plugins/action_update_review_assignments_status/src/updateReviewAssignmentsStatus.ts
Outdated
Show resolved
Hide resolved
…ment ReviewAssignments. The isLocked only is set on updateReviewStatus now
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.
See comments. Looking good though :)
// 1. If existing | ||
// - keep same status, isSelfAssignable | ||
// - just update isLocked = true (if already assigned to another) | ||
// - keep same isLocked if assigned |
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.
// - keep same isLocked if assigned
Shouldn't existing review_assignments get isLocked = false
always? (assuming this action runs on submission of applications and reviews). Otherwise, when do the "locked" assignments get "unlocked"?
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.
Fixed. But basically I added one specific case for when one ReviewAssignment was added while in the state of last submitted Review has locked others (LOQ submitted). So for that reason I have also changed updateReviewStatus
which will set ReviewAssignment to be locked in this case (and then checked here). Please have a look on these 2 files:
- plugins/action_generate_review_assignment_records/src/generateReviewAssignments.ts
- plugins/action_update_review_status/src/updateReviewsStatuses.ts
@@ -461,7 +460,7 @@ See [Grant Permissions](#grant-permissions) above regarding acting on user-only | |||
|
|||
### Generate Review Assignments | |||
|
|||
Generates records in the `review_assignment` table -- i.e. which users (reviewers) are allowed to do a review for the current stage/level (and for which Sections). The records are set with `status` "Available" or "Assigned" and flags for `isSelfAssignable` and `isLocked` to help define when is allowed self-assignment. | |||
Generates records in the `review_assignment` table -- i.e. which users (reviewers) are allowed to do a review for the current stage/level (and for which Sections). The records are set with `status` "Available" or "Assigned". With the properties to specify the type of assignament: `isSelfAssignable` if it should show for self-assignment when not assigned by another user. The `isLocked` property helps defining that the review can start but not be submitted - after the application has been back to Applicant for ammendments. |
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.
Maybe bullet-point these properties to make easier to read?
Also:
isSelfAssignable
if it should show for self-assignment when not assigned by another user.
Isn't "self-assignable" a template configuration? So maybe should say "determines whether this assignment is self-assignable as determined by the template configuration for this stage/level" ?
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.
Typo on assignament
=> "assignment" ;)
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. Done
…ns_list_view and add new function to auto-generate column resulting the available_sections for one assignment
database/migration/migrateData.ts
Outdated
console.log(' - Update existing review_assignment to set is_locked=false when isSelfAssigned') | ||
// TODO - Not sure how to do 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.
What happens if we don't do 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.
Removed. 👍
…ssignments-action-not-auto-assign-final-decision
Fix mistake in review_assignment validity trigger
3827593
to
52ce0d8
Compare
Okay, @nmadruga I've updated and fixed a bunch of those things so we could get this branch working. Can see my changes in 52ce0d8 I've marked all the comments "Resolved" that I've taken care off -- you can show them again if you want to see what they were. So the only comments still visible should be minor things or questions for you to take a look at. The only one that seems fairly important is this one. |
… LOQ so any other ReviewAssignments created also are locked at that point.
…ed from Applicant to be used as model for new ReviewAssignments created after that (so those wouldn't generate an unlocked assignment in the same level/stage)
Looks good! Thanks Carl, I have made suggestions. Please just note the changes flagged on this comment, I'm happy to merge if you are ok with that. Although I haven't got much further with testing this changes yet |
@@ -92,10 +92,23 @@ const updateReviewsStatuses: ActionPluginType = async ({ | |||
ReviewStatus.Draft, | |||
]) | |||
|
|||
// Lock ReviewAssignment of Review subimmet as changes required to applicant |
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.
// Lock ReviewAssignment of Review subimmet as changes required to applicant | |
// Lock ReviewAssignment of Review submitted as changes required to applicant |
getReview: async (reviewId: number) => { | ||
const text = ` | ||
SELECT | ||
review_assignment_id AS "reviewAssignmentId" | ||
FROM review | ||
WHERE id = $1 | ||
` | ||
|
||
try { | ||
const result = await DBConnect.query({ text, values: [reviewId] }) | ||
return result.row[0] | ||
} catch (err) { | ||
console.log(err.message) | ||
throw err | ||
} | ||
}, |
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.
Not sure why we need an extra database call. We already fetched all the associated reviews at the beginning, you should be able to pull it out of that result.
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.
Reverting this - as per convo in person
Also - I'll be adding a briefing issue on what we have agreed on
…eReviewStatuses. isLocked logic as it is currently. And new ReviewAssignments gets created always as isLocked = false
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.
Part 2 fix for #953
Front-end: msupply-foundation/conforma-web-app#1428
Briefing of changes
updateReviewAssignmentStatus
not needed anymore - since we don't changeisLocked
for selfAssignmentsASSIGN_LOCKED
available_sections
in ReviewAssignmentPrevious description
Changes to action
generateReviewAssignments
required for FinalDecision to act as any other self-assignable assignment. So only one reviewAssignment should stay as ASSIGNED status. The reviewer has to self-assign first and then start the review. This fix should be resolving the existing bug with #943I also had to change howNot needed now that actionisLocked
persists. Will need further testing to make sure this is consistent with other states.updateReviewAssignmentStatus
has been fully removed.