PM-3926 #time 45m show "virtual" ai screening phase when ai config is…#1739
PM-3926 #time 45m show "virtual" ai screening phase when ai config is…#1739
Conversation
… selected for challenge
src/components/ChallengeEditor/ChallengeReviewer-Field/AiReviewerTab/utils.js
Show resolved
Hide resolved
| phaseIndex={index} | ||
| readOnly | ||
| /> | ||
| {showVirtualAiScreening && index === submissionIndex && ( |
There was a problem hiding this comment.
[💡 design]
The PhaseInput component is conditionally rendered for the virtual AI screening phase. Ensure that the PhaseInput component can handle the isVirtual prop correctly.
| ) | ||
| ) | ||
| (() => { | ||
| const hasRealAiScreeningPhase = phases.some(p => p.name === AI_SCREENING_PHASE_NAME) |
There was a problem hiding this comment.
[performance]
The use of some and findIndex to check for the presence of specific phases could be optimized by using a single iteration over phases. Consider refactoring to improve performance, especially if phases can be large.
| this.onUpdatePhaseDate(item, index) | ||
| }} | ||
| /> | ||
| {showVirtualAiScreening && index === submissionIndex && ( |
There was a problem hiding this comment.
[maintainability]
The logic for rendering the virtual AI screening phase is duplicated. Consider extracting this logic into a separate function to improve maintainability and reduce code duplication.
| duration | ||
| }) | ||
| } | ||
| }, [startDate]) |
There was a problem hiding this comment.
[❗❗ correctness]
The useEffect dependency array should include onUpdatePhase, isVirtual, and duration to ensure the effect runs correctly when these values change.
| } | ||
| }, [startDate]) | ||
|
|
||
| if (isVirtual && readOnly) { |
There was a problem hiding this comment.
[💡 readability]
The condition if (isVirtual && readOnly) could be more explicit by checking isVirtual === true && readOnly === true to avoid potential issues with truthy values.
When we select AI config for a challenge, need to show an entry for the "ai screning" phase in the timeline. This phase will then be created at activation time, and will replace the "virtual" row.