-
Notifications
You must be signed in to change notification settings - Fork 14
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
#2183 - Queued Assessments - Assessment Gateway Changes #2245
#2183 - Queued Assessments - Assessment Gateway Changes #2245
Conversation
if (!assessment.assessmentWorkflowId) { | ||
// Assessment is available to be associated with the workflow instance id. | ||
await assessmentRepo.update(assessmentId, { assessmentWorkflowId }); | ||
const now = new Date(); | ||
await assessmentRepo.update(assessmentId, { | ||
assessmentWorkflowId, | ||
studentAssessmentStatus: StudentAssessmentStatus.InProgress, | ||
studentAssessmentStatusUpdatedOn: now, | ||
modifier: auditUser, | ||
updatedAt: now, | ||
}); | ||
return; | ||
} | ||
if (assessment.assessmentWorkflowId !== assessmentWorkflowId) { | ||
throw new CustomNamedError( | ||
`The assessment is already associated with another workflow instance. Current associated instance id ${assessment.assessmentWorkflowId}.`, | ||
ASSESSMENT_INVALID_OPERATION_IN_THE_CURRENT_STATE, | ||
ASSESSMENT_ALREADY_ASSOCIATED_WITH_DIFFERENT_WORKFLOW, | ||
); | ||
} | ||
// The workflow was already associated with the workflow, no need to update it again. |
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.
I guess so, I will take a look 😉
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.
Method refactored, please take a look 😉
* in the format "Message (ERROR_CODE).". | ||
* @returns user friendly error message. | ||
*/ | ||
getSummaryMessage() { |
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.
Good job! Left a question.
// Check if the assessment is in one of the initial statuses. Any status different than "Submitted" and "Queued" should | ||
// cancel the workflow because there is no point executing it. | ||
// A workflow in these statuses can be associated and updated to "In progress" nicely. The expectation is that it would | ||
// be primarily "Queued" but there is no harm in allowing "Submitted" also. |
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.
Considering submitted here is to keep the option of starting the assessments manually for any troubleshooting purpose if required right?
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.
Yes, you are right. The concern here was more about not allowing the association to other statuses.
* in the format "Message (ERROR_CODE).". | ||
* @returns user friendly error message. | ||
*/ | ||
getSummaryMessage() { |
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.
return type to signature?
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.
Added the return type.
Nice work @andrewsignori-aot . Minor comment and a clarification. |
job.variables.assessmentId, | ||
job.processInstanceKey, | ||
); | ||
jobLogger.log("Associated the assessment id."); | ||
logger.log("Associated the assessment 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.
do we need to update the log content too?
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.
@@ -102,7 +102,7 @@ export class DisbursementController { | |||
await this.disbursementScheduleService.associateMSFAANumber( | |||
job.variables.assessmentId, | |||
); | |||
jobLogger.error("Associated the MSFAA number to the disbursements."); | |||
jobLogger.log("Associated the MSFAA number to the disbursements."); |
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.
👍
throw new CustomNamedError( | ||
`The assessment is already associated with another workflow instance. Current associated instance id ${assessment.assessmentWorkflowId}.`, | ||
ASSESSMENT_INVALID_OPERATION_IN_THE_CURRENT_STATE, | ||
`The assessment is already associated to the 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.
double quotes?
workflowData, | ||
studentAssessmentStatus: StudentAssessmentStatus.Completed, | ||
studentAssessmentStatusUpdatedOn: now, | ||
modifier: auditUser, |
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.
LGTM 👍 Good work @andrewsignori-aot . approving the PR as the added comments are very minor
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.
Looks good 👍
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, nice work @andrewsignori-aot
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.
Looks good! Thanks for the refactoring!
Kudos, SonarCloud Quality Gate passed!
|
associateWorkflowId
toassociateWorkflowInstance
to include the part of the process to update the status to "In progress".associateWorkflowInstance
from being executed with an unexpected status (see comments in code).wrap up task
.CustomNamedError
.