Skip to content

Commit

Permalink
implement auto approve for Back-End Google Cloud
Browse files Browse the repository at this point in the history
  • Loading branch information
dimasmds committed Nov 3, 2023
1 parent 16f5e61 commit 9c7e7d4
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/service/report-generator/report-generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class ReportGenerator {
checklist: reviewResult.checklist,
checklist_keys: this.getCompletedChecklist(reviewResult),
is_passed: isApproved,
is_draft: reviewResult.draft,
is_draft: this.getDraftDecision(isApproved, autoReviewConfig),
};

this.result.push(summary);
Expand All @@ -41,6 +41,19 @@ class ReportGenerator {
raiseDomainEvent('report generated')
}

private getDraftDecision(isApproved: boolean, autoReviewConfig: any): boolean {

Check warning on line 44 in src/service/report-generator/report-generator.ts

View workflow job for this annotation

GitHub Actions / lint (14.x)

Unexpected any. Specify a different type
const allowedCoursesThatFullyGrading = [
342, // Back-End Pemula with Google Cloud
]

if (allowedCoursesThatFullyGrading.includes(autoReviewConfig.course_id)) {
// set `draft` to false, if approved is true
return !isApproved
}

return true
}

private getCompletedChecklist(reviewResult: ReviewResult) {
return Object.keys(reviewResult.checklist)
.filter(requirementName => reviewResult.checklist[requirementName].status)
Expand Down

0 comments on commit 9c7e7d4

Please sign in to comment.