Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 40 additions & 40 deletions src/components/ChallengeEditor/ChallengeReviewer-Field/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -760,57 +760,57 @@ class ChallengeReviewerField extends Component {
onChange={(e) => this.updateReviewer(index, 'phaseId', e.target.value)}
>
<option value=''>Select Phase</option>
{challenge.phases && challenge.phases
.filter(phase => {
const rawName = phase.name ? phase.name : ''
const phaseName = rawName.toLowerCase()
const norm = phaseName.replace(/[-\s]/g, '')
const isReviewPhase = phaseName.includes('review')
const isSubmissionPhase = phaseName.includes('submission')
const isScreeningPhase = norm === 'screening' || norm === 'checkpointscreening'
const isApprovalPhase = norm === 'approval'
const isPostMortemPhase = norm === 'postmortem'
const isCurrentlySelected = reviewer.phaseId && ((phase.id === reviewer.phaseId) || (phase.phaseId === reviewer.phaseId)) && !isSubmissionPhase

// Collect phases already assigned to other reviewers (excluding current reviewer)
const assignedPhaseIds = new Set(
(challenge.reviewers || [])
.filter((r, i) => i !== index)
.map(r => r.phaseId)
.filter(id => id !== undefined && id !== null)
)
{challenge.phases && challenge.phases
.filter(phase => {
const rawName = phase.name ? phase.name : ''
const phaseName = rawName.toLowerCase()
const norm = phaseName.replace(/[-\s]/g, '')
const isReviewPhase = phaseName.includes('review')
const isSubmissionPhase = phaseName.includes('submission')
const isScreeningPhase = norm === 'screening' || norm === 'checkpointscreening'
const isApprovalPhase = norm === 'approval'
const isPostMortemPhase = norm === 'postmortem'
const isCurrentlySelected = reviewer.phaseId && ((phase.id === reviewer.phaseId) || (phase.phaseId === reviewer.phaseId)) && !isSubmissionPhase

// Collect phases already assigned to other reviewers (excluding current reviewer)
const assignedPhaseIds = new Set(
(challenge.reviewers || [])
.filter((r, i) => i !== index)
.map(r => r.phaseId)
.filter(id => id !== undefined && id !== null)
)

// Exclude phases already assigned to other reviewers, except the currently selected phase
if (assignedPhaseIds.has(phase.phaseId || phase.id) && !isCurrentlySelected) {
return false
}
// Exclude phases already assigned to other reviewers, except the currently selected phase
if (assignedPhaseIds.has(phase.phaseId || phase.id) && !isCurrentlySelected) {
return false
}

// For AI reviewers, allow review, submission, and other required phases
// For member reviewers, allow review and other required phases
if (this.isAIReviewer(reviewer)) {
return (
isReviewPhase ||
// For AI reviewers, allow review, submission, and other required phases
// For member reviewers, allow review and other required phases
if (this.isAIReviewer(reviewer)) {
return (
isReviewPhase ||
isSubmissionPhase ||
isScreeningPhase ||
isApprovalPhase ||
isPostMortemPhase ||
isCurrentlySelected
)
} else {
return (
isReviewPhase ||
)
} else {
return (
isReviewPhase ||
isScreeningPhase ||
isApprovalPhase ||
isPostMortemPhase ||
isCurrentlySelected
)
}
})
.map(phase => (
<option key={phase.id || phase.phaseId} value={phase.phaseId || phase.id}>
{phase.name || `Phase ${phase.phaseId || phase.id}`}
</option>
))}
)
}
})
.map(phase => (
<option key={phase.id || phase.phaseId} value={phase.phaseId || phase.id}>
{phase.name || `Phase ${phase.phaseId || phase.id}`}
</option>
))}
</select>
)}
{!readOnly && challenge.submitTriggered && validationErrors.phaseId && (
Expand Down