-
Notifications
You must be signed in to change notification settings - Fork 51
Don't force skills selection on Topgear challenge edits #1706
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
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 |
|---|---|---|
|
|
@@ -26,7 +26,8 @@ import { | |
| PHASE_PRODUCT_CHALLENGE_ID_FIELD, | ||
| QA_TRACK_ID, DESIGN_CHALLENGE_TYPES, ROUND_TYPES, | ||
| MULTI_ROUND_CHALLENGE_TEMPLATE_ID, DS_TRACK_ID, | ||
| CHALLENGE_STATUS | ||
| CHALLENGE_STATUS, | ||
| SKILLS_OPTIONAL_BILLING_ACCOUNT_IDS | ||
| } from '../../config/constants' | ||
| import { | ||
| getDomainTypes, | ||
|
|
@@ -867,14 +868,20 @@ class ChallengeEditor extends Component { | |
| return false | ||
| } | ||
|
|
||
| const billingAccountId = _.get(challenge, 'billing.billingAccountId') | ||
| const normalizedBillingAccountId = _.isNil(billingAccountId) ? null : String(billingAccountId) | ||
|
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. [ |
||
| const isSkillsRequired = normalizedBillingAccountId ? !SKILLS_OPTIONAL_BILLING_ACCOUNT_IDS.includes(normalizedBillingAccountId) : true | ||
|
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. [ |
||
|
|
||
| const requiredFields = [ | ||
| 'trackId', | ||
| 'typeId', | ||
| 'name', | ||
| 'description', | ||
| 'skills', | ||
| 'prizeSets' | ||
| ] | ||
| if (isSkillsRequired) { | ||
| requiredFields.push('skills') | ||
| } | ||
| let isRequiredMissing = false | ||
|
|
||
| requiredFields.forEach((key) => { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -40,6 +40,7 @@ export const { | |
|
|
||
| export const CREATE_FORUM_TYPE_IDS = typeof process.env.CREATE_FORUM_TYPE_IDS === 'string' ? process.env.CREATE_FORUM_TYPE_IDS.split(',') : process.env.CREATE_FORUM_TYPE_IDS | ||
| export const PROJECTS_API_URL = process.env.PROJECTS_API_URL || process.env.PROJECT_API_URL | ||
| export const SKILLS_OPTIONAL_BILLING_ACCOUNT_IDS = ['80000062'] | ||
|
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. [ |
||
|
|
||
| /** | ||
| * Filepicker config | ||
|
|
||
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.
[💡
readability]The logic for determining
skillsRequiredcould be simplified. Consider using a direct check forbillingAccountIdandSKILLS_OPTIONAL_BILLING_ACCOUNT_IDSto improve readability and reduce the need fornormalizedBillingAccountId. For example:const skillsRequired = !billingAccountId || !SKILLS_OPTIONAL_BILLING_ACCOUNT_IDS.includes(String(billingAccountId));