-
Notifications
You must be signed in to change notification settings - Fork 51
PM-3926 #time 45m show "virtual" ai screening phase when ai config is… #1739
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,9 +26,11 @@ import { | |
| DEV_TRACK_ID, | ||
| MARATHON_TYPE_ID, | ||
| CHALLENGE_TYPE_ID, | ||
| COMMUNITY_APP_URL | ||
| COMMUNITY_APP_URL, | ||
| AI_SCREENING_PHASE_NAME | ||
| } from '../../../config/constants' | ||
| import PhaseInput from '../../PhaseInput' | ||
| import { hasAiReviewers } from '../ChallengeReviewer-Field/AiReviewerTab/utils' | ||
| import CheckpointPrizesField from '../CheckpointPrizes-Field' | ||
| import { isBetaMode } from '../../../util/localstorage' | ||
| import WiproAllowedField from '../WiproAllowedField' | ||
|
|
@@ -224,21 +226,41 @@ const ChallengeView = ({ | |
| </div> | ||
| </div> | ||
| { | ||
| challenge.legacy.subTrack === 'WEB_DESIGNS' && challenge.phases.length === 8 ? phases.map((phase, index) => ( | ||
| <PhaseInput | ||
| phase={phase} | ||
| phaseIndex={index} | ||
| key={index} | ||
| readOnly | ||
| /> | ||
| )) : _.sortBy(phases, ['scheduledEndDate']).map((phase, index) => ( | ||
| <PhaseInput | ||
| phase={phase} | ||
| phaseIndex={index} | ||
| key={index} | ||
| readOnly | ||
| /> | ||
| )) | ||
| (() => { | ||
| const phaseList = challenge.legacy.subTrack === 'WEB_DESIGNS' && challenge.phases.length === 8 | ||
| ? phases | ||
| : _.sortBy(phases, ['scheduledEndDate']) | ||
| const hasRealAiScreeningPhase = phaseList.some(p => p.name === AI_SCREENING_PHASE_NAME) | ||
kkartunov marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| const showVirtualAiScreening = hasAiReviewers(challenge.reviewers) && !hasRealAiScreeningPhase | ||
kkartunov marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| const submissionIndex = phaseList.findIndex(p => p.name === 'Submission') | ||
| return ( | ||
| <> | ||
| {phaseList.map((phase, index) => ( | ||
| <React.Fragment key={index}> | ||
kkartunov marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| <PhaseInput | ||
| phase={phase} | ||
| phaseIndex={index} | ||
| readOnly | ||
| /> | ||
| {showVirtualAiScreening && index === submissionIndex && ( | ||
|
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. [💡 |
||
| <PhaseInput | ||
| phase={{ name: AI_SCREENING_PHASE_NAME }} | ||
| readOnly | ||
| isVirtual | ||
| /> | ||
| )} | ||
| </React.Fragment> | ||
| ))} | ||
| {showVirtualAiScreening && submissionIndex === -1 && ( | ||
| <PhaseInput | ||
| phase={{ name: AI_SCREENING_PHASE_NAME }} | ||
| readOnly | ||
| isVirtual | ||
| /> | ||
| )} | ||
| </> | ||
| ) | ||
| })() | ||
| } | ||
| {showTimeline && ( | ||
| <ChallengeScheduleField | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,7 +27,8 @@ import { | |
| QA_TRACK_ID, DESIGN_CHALLENGE_TYPES, ROUND_TYPES, | ||
| MULTI_ROUND_CHALLENGE_TEMPLATE_ID, | ||
| CHALLENGE_STATUS, | ||
| SKILLS_OPTIONAL_BILLING_ACCOUNT_IDS | ||
| SKILLS_OPTIONAL_BILLING_ACCOUNT_IDS, | ||
| AI_SCREENING_PHASE_NAME | ||
| } from '../../config/constants' | ||
| import { | ||
| getDomainTypes, | ||
|
|
@@ -62,6 +63,7 @@ import Track from '../Track' | |
| import ConfirmationModal from '../Modal/ConfirmationModal' | ||
| import AlertModal from '../Modal/AlertModal' | ||
| import PhaseInput from '../PhaseInput' | ||
| import { hasAiReviewers } from './ChallengeReviewer-Field/AiReviewerTab/utils' | ||
| import LegacyLinks from '../LegacyLinks' | ||
| import AssignedMemberField from './AssignedMember-Field' | ||
| import Tooltip from '../Tooltip' | ||
|
|
@@ -2047,18 +2049,41 @@ class ChallengeEditor extends Component { | |
| </div> | ||
| </div> | ||
| { | ||
| phases.map((phase, index) => ( | ||
| <PhaseInput | ||
| phase={phase} | ||
| phaseIndex={index} | ||
| key={index} | ||
| readOnly={false} | ||
| onUpdatePhase={(item) => { | ||
| this.onUpdatePhaseDate(item, index) | ||
| }} | ||
| /> | ||
| ) | ||
| ) | ||
| (() => { | ||
| const hasRealAiScreeningPhase = phases.some(p => p.name === AI_SCREENING_PHASE_NAME) | ||
|
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 showVirtualAiScreening = hasAiReviewers(challenge.reviewers) && !hasRealAiScreeningPhase | ||
| const submissionIndex = phases.findIndex(p => p.name === 'Submission') | ||
| return ( | ||
| <> | ||
| {phases.map((phase, index) => ( | ||
| <React.Fragment key={index}> | ||
| <PhaseInput | ||
| phase={phase} | ||
| phaseIndex={index} | ||
| readOnly={false} | ||
| onUpdatePhase={(item) => { | ||
| this.onUpdatePhaseDate(item, index) | ||
| }} | ||
| /> | ||
| {showVirtualAiScreening && index === submissionIndex && ( | ||
|
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. [ |
||
| <PhaseInput | ||
| phase={{ name: AI_SCREENING_PHASE_NAME }} | ||
| readOnly | ||
| isVirtual | ||
| /> | ||
| )} | ||
| </React.Fragment> | ||
| ))} | ||
| {showVirtualAiScreening && submissionIndex === -1 && ( | ||
| <PhaseInput | ||
| phase={{ name: AI_SCREENING_PHASE_NAME }} | ||
| readOnly | ||
| isVirtual | ||
| /> | ||
| )} | ||
| </> | ||
| ) | ||
| })() | ||
| } | ||
| </> | ||
| )} | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,12 +14,39 @@ const inputDateFormat = 'MM/dd/yyyy' | |
| const inputTimeFormat = 'HH:mm' | ||
| const MAX_LENGTH = 5 | ||
|
|
||
| const PhaseInput = ({ onUpdatePhase, phase, readOnly, phaseIndex }) => { | ||
| const PhaseInput = ({ onUpdatePhase, phase, readOnly, phaseIndex, isVirtual }) => { | ||
| const { scheduledStartDate: startDate, scheduledEndDate: endDate, duration, isStartTimeActive, isDurationActive } = phase | ||
|
|
||
| const durationHoursMinutes = useMemo(() => getPhaseHoursMinutes(duration), [duration]) | ||
| const endDateInputRef = useRef() | ||
|
|
||
| useEffect(() => { | ||
| if (!startDate && onUpdatePhase && !isVirtual) { | ||
| let startDate = moment().format(dateFormat) | ||
| let endDate = getPhaseEndDate(startDate, duration) | ||
| onUpdatePhase({ | ||
| startDate, | ||
| endDate, | ||
| duration | ||
| }) | ||
| } | ||
| }, [startDate]) | ||
|
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. [❗❗ |
||
|
|
||
| if (isVirtual && readOnly) { | ||
|
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. [💡 |
||
| return ( | ||
| <div className={styles.container}> | ||
| <div className={styles.row}> | ||
| <div className={cn(styles.field, styles.col1, styles.phaseName)}> | ||
| <label>{phase.name} :</label> | ||
| </div> | ||
| <div className={cn(styles.field, styles.col2)}> | ||
| <span className={styles.title}>Automated (AI)</span> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| ) | ||
| } | ||
|
|
||
| const onStartDateChange = (e) => { | ||
| let startDate = moment(e).format(dateFormat) | ||
| let endDate = getPhaseEndDate(startDate, duration) | ||
|
|
@@ -44,18 +71,6 @@ const PhaseInput = ({ onUpdatePhase, phase, readOnly, phaseIndex }) => { | |
| } | ||
| } | ||
|
|
||
| useEffect(() => { | ||
| if (!startDate && onUpdatePhase) { | ||
| let startDate = moment().format(dateFormat) | ||
| let endDate = getPhaseEndDate(startDate, duration) | ||
| onUpdatePhase({ | ||
| startDate, | ||
| endDate, | ||
| duration | ||
| }) | ||
| } | ||
| }, [startDate]) | ||
|
|
||
| const onDurationChange = (e, isBlur = false) => { | ||
| if (`${e}`.length > MAX_LENGTH) return null | ||
|
|
||
|
|
@@ -144,13 +159,16 @@ const PhaseInput = ({ onUpdatePhase, phase, readOnly, phaseIndex }) => { | |
|
|
||
| PhaseInput.defaultProps = { | ||
| endDate: null, | ||
| readOnly: false | ||
| readOnly: false, | ||
| isVirtual: false, | ||
| phaseIndex: -1 | ||
| } | ||
|
|
||
| PhaseInput.propTypes = { | ||
| phase: PropTypes.shape().isRequired, | ||
| onUpdatePhase: PropTypes.func, | ||
| readOnly: PropTypes.bool, | ||
| phaseIndex: PropTypes.number.isRequired | ||
| phaseIndex: PropTypes.number, | ||
| isVirtual: PropTypes.bool | ||
| } | ||
| export default PhaseInput | ||
Uh oh!
There was an error while loading. Please reload this page.