-
Notifications
You must be signed in to change notification settings - Fork 9
Skip tasks #152
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
Skip tasks #152
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -111,6 +111,15 @@ async function fetchDefaultReviewers( | |
|
|
||
| async function backfillChallengeReviewers() { | ||
| const defaultsCache = new Map<string, DefaultChallengeReviewer[]>(); | ||
|
|
||
| const taskTypes = await prisma.challengeType.findMany({ | ||
| where: { | ||
| name: { equals: 'Task', mode: 'insensitive' }, | ||
| }, | ||
| select: { id: true }, | ||
| }); | ||
| const taskTypeIds = new Set(taskTypes.map((type) => type.id)); | ||
|
|
||
| const challenges = await prisma.challenge.findMany({ | ||
| where: { | ||
| status: ChallengeStatusEnum.ACTIVE, | ||
|
|
@@ -148,6 +157,13 @@ async function backfillChallengeReviewers() { | |
| continue; | ||
| } | ||
|
|
||
| if (taskTypeIds.has(challenge.typeId)) { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [💡 |
||
| console.log( | ||
| `Skipping challenge ${challenge.id} (${challenge.name}) because it is a Task type.`, | ||
| ); | ||
| continue; | ||
| } | ||
|
|
||
| const defaultReviewers = await fetchDefaultReviewers( | ||
| challenge.typeId, | ||
| challenge.trackId, | ||
|
|
||
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.
[⚠️
maintainability]Consider adding error handling for the
prisma.challengeType.findManycall to handle cases where the database query might fail. This will improve the robustness of the script.