-
Notifications
You must be signed in to change notification settings - Fork 52
feat: add phase management api #635
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
Conversation
Signed-off-by: Rakib Ansary <[email protected]>
Signed-off-by: Rakib Ansary <[email protected]>
Signed-off-by: Rakib Ansary <[email protected]>
Signed-off-by: Rakib Ansary <[email protected]>
Signed-off-by: Rakib Ansary <[email protected]>
Signed-off-by: Rakib Ansary <[email protected]>
Signed-off-by: Rakib Ansary <[email protected]>
Signed-off-by: Rakib Ansary <[email protected]>
Signed-off-by: Rakib Ansary <[email protected]>
Signed-off-by: Rakib Ansary <[email protected]>
Signed-off-by: Rakib Ansary <[email protected]>
Signed-off-by: Rakib Ansary <[email protected]>
@@ -2235,6 +2209,115 @@ deleteChallenge.schema = { | |||
challengeId: Joi.id(), | |||
}; | |||
|
|||
async function advancePhase(currentUser, challengeId, data) { | |||
if (currentUser && (currentUser.isMachine || hasAdminRole(currentUser))) { |
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 check looks unnecessary
); | ||
|
||
const updatedChallenge = await challengeDomain.lookup(getLookupCriteria("id", challengeId)); | ||
await indexChallengeAndPostToKafka(updatedChallenge); |
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.
we can avoid raising challenge.update event unless there is a change in challenge status or winners are set.
for other cases, we need to raise event using another topic and another format
} | ||
|
||
async #areAllSubmissionsReviewed(challengeId) { | ||
console.log(`Getting review count for challenge ${challengeId}`); |
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: also we need to check if enough review is present per submission according to "Reviewer Count" phase constraint.
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 will double check - however areAllSubmissionReviewed is an essential rule
while checking if all submissions received the minimum requisite reviews would be a constraint check
{ | ||
"fact": "isPredecessorPhaseClosed", | ||
"operator": "equal", | ||
"value": true |
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.
predecessor phase is "Submission" and it can be open
regular "isClosed" check can be added
"value": true | ||
}, | ||
{ | ||
"fact": "isPostMortemOpen", |
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 unnecessary, post mortem is created following registration and submission. If Appeals response is already scheduled then it means that there is no post mortem created in the system.
"value": true | ||
}, | ||
{ | ||
"all": [ |
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 couldn't understand why submission phase is closed here if this is F2F and there is a submission pending to be reviewed.
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 this is an oversight - submission should not be closed! I'll fix it.
return facts; | ||
} | ||
|
||
async advancePhase(challengeId, phases, operation, phaseName) { |
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.
How to identify correct phase if phase name is "Iterative Review"
allSubmissionsReviewed: await this.#areAllSubmissionsReviewed(challengeId), | ||
}), | ||
"Iterative Review": async (challengeId) => ({ | ||
hasActiveUnreviewedSubmissions: await this.#hasActiveUnreviewedSubmissions(challengeId), |
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.
hasActiveUnreviewedSubmissions is for opening the phase.
for closing the phase, the fact should check if the earliest active submission has a committed review. there can be other active unreviewed submissions in the queue but they are ignored.
"value": true | ||
}, | ||
{ | ||
"fact": "hasActiveUnreviewedSubmissions", |
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.
need a different fact to check if the earliest active submission has enough commited review(s)
"value": true | ||
}, | ||
{ | ||
"fact": "isPastScheduledEndTime", |
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.
isPastScheduledEndTime or check if every submitters aggreed on early appeals
"value": true | ||
}, | ||
{ | ||
"fact": "isPastScheduledEndTime", |
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.
scheduled end time is not considered to close Appeals Response phase
hasActiveUnreviewedSubmissions: await this.#hasActiveUnreviewedSubmissions(challengeId), | ||
}), | ||
Review: async (challengeId) => ({ | ||
allSubmissionsReviewed: await this.#areAllSubmissionsReviewed(challengeId), |
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 is another fact that checks if all test cases are uploaded If there is a development reviewer for challenge. But this could be something we are not doing anymore.
"value": true | ||
}, | ||
{ | ||
"fact": "isPastScheduledEndTime", |
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.
scheduled end time is not considered to close Review phase
} | ||
|
||
// prettier-ignore | ||
#updateSubsequentPhases(phases, currentPhase, delta) { |
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 F2F, after submission phase is closed we shouldn't update iterative phases.
Signed-off-by: Rakib Ansary <[email protected]>
Signed-off-by: Rakib Ansary <[email protected]>
Signed-off-by: Rakib Ansary <[email protected]>
Signed-off-by: Rakib Ansary <[email protected]>
Signed-off-by: Rakib Ansary <[email protected]>
Signed-off-by: Rakib Ansary <[email protected]>
Signed-off-by: Rakib Ansary <[email protected]>
Signed-off-by: Rakib Ansary <[email protected]>
No description provided.