Skip to content

Commit 0979ddd

Browse files
authored
Merge pull request #1910 from topcoder-platform/PM-5203_approval-phase-ai-only
PM-5203 approval phase ai only
2 parents 2086b96 + 63d917b commit 0979ddd

14 files changed

Lines changed: 432 additions & 536 deletions

File tree

src/apps/review/src/lib/components/AppealComment/AppealComment.tsx

Lines changed: 4 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,7 @@ import {
2424
ScorecardQuestion,
2525
SelectOption,
2626
} from '../../models'
27-
import { formAppealResponseSchema, isAppealsResponsePhase } from '../../utils'
28-
import {
29-
QUESTION_YES_NO_OPTIONS,
30-
} from '../../../config/index.config'
27+
import { formAppealResponseSchema, getScoreResponseOptions, isAppealsResponsePhase } from '../../utils'
3128
import { ChallengeDetailContext } from '../../contexts'
3229

3330
import styles from './AppealComment.module.scss'
@@ -103,28 +100,9 @@ export const AppealComment: FC<Props> = (props: Props) => {
103100
}
104101
}, [addAppealResponse, appealInfo, reviewItem, updatedResponse])
105102

106-
const responseOptions = useMemo<SelectOption[]>(() => {
107-
if (scorecardQuestion.type === 'SCALE') {
108-
const length
109-
= scorecardQuestion.scaleMax
110-
- scorecardQuestion.scaleMin
111-
+ 1
112-
return Array.from(
113-
new Array(length),
114-
(x, i) => `${i + scorecardQuestion.scaleMin}`,
115-
)
116-
.map(item => ({
117-
label: item,
118-
value: item,
119-
}))
120-
}
121-
122-
if (scorecardQuestion.type === 'YES_NO') {
123-
return QUESTION_YES_NO_OPTIONS
124-
}
125-
126-
return []
127-
}, [scorecardQuestion])
103+
const responseOptions = useMemo<SelectOption[]>(() => (
104+
getScoreResponseOptions(scorecardQuestion)
105+
), [scorecardQuestion])
128106

129107
useEffect(() => {
130108
setAppealResponse(data.appealResponse?.content ?? '')

0 commit comments

Comments
 (0)