Skip to content

Commit 2ae7173

Browse files
committed
Merge branch 'dev' into mm-final-2025-reveal
2 parents fdbd7f8 + 2a17ea4 commit 2ae7173

File tree

7 files changed

+108
-19
lines changed

7 files changed

+108
-19
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,7 @@ export const ChallengeDetailsContent: FC<Props> = (props: Props) => {
508508
selectedTab={props.selectedTab}
509509
reviews={reviewTabReviews}
510510
submitterReviews={reviewTabSubmitterReviews}
511+
screeningOutcome={screeningOutcome}
511512
reviewMinimumPassingScore={props.reviewMinimumPassingScore}
512513
isLoadingReview={props.isLoadingSubmission}
513514
isDownloading={isDownloadingSubmission}

src/apps/review/src/lib/components/ChallengeDetailsContent/TabContentCheckpoint.tsx

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* Content of checkpoint tab.
33
*/
4-
import { FC, useContext, useMemo } from 'react'
4+
import { FC, useCallback, useContext, useMemo } from 'react'
55

66
import { TableLoading } from '~/apps/admin/src/lib'
77
import { IsRemovingType } from '~/apps/admin/src/lib/models'
@@ -75,6 +75,32 @@ export const TabContentCheckpoint: FC<Props> = (props: Props) => {
7575
[props.checkpointReview, myMemberIds, props.checkpointReviewMinimumPassingScore],
7676
)
7777

78+
const checkpointScreeningOutcome = useMemo(
79+
() => {
80+
const passingSubmissionIds = new Set<string>()
81+
const failingSubmissionIds = new Set<string>()
82+
83+
props.checkpoint.forEach(entry => {
84+
if (!entry?.submissionId) {
85+
return
86+
}
87+
88+
const normalizedResult = (entry.result || '').toUpperCase()
89+
if (normalizedResult === 'PASS') {
90+
passingSubmissionIds.add(`${entry.submissionId}`)
91+
} else if (normalizedResult === 'NO PASS') {
92+
failingSubmissionIds.add(`${entry.submissionId}`)
93+
}
94+
})
95+
96+
return {
97+
failingSubmissionIds,
98+
passingSubmissionIds,
99+
}
100+
},
101+
[props.checkpoint],
102+
)
103+
78104
const filteredCheckpoint = useMemo<Screening[]>(
79105
() => {
80106
const baseRows = props.checkpoint ?? []
@@ -107,9 +133,15 @@ export const TabContentCheckpoint: FC<Props> = (props: Props) => {
107133
],
108134
)
109135

136+
const filterCheckpointReviewByScreeningResult = useCallback(
137+
(screening: Screening[]) => screening
138+
.filter(row => checkpointScreeningOutcome.passingSubmissionIds.has(`${row.submissionId}`)),
139+
[checkpointScreeningOutcome],
140+
)
141+
110142
const filteredCheckpointReview = useMemo<Screening[]>(
111143
() => {
112-
const baseRows = props.checkpointReview ?? []
144+
const baseRows = filterCheckpointReviewByScreeningResult(props.checkpointReview ?? [])
113145

114146
if (isPrivilegedRole || (isChallengeCompleted && hasPassedCheckpointReviewThreshold)) {
115147
return baseRows
@@ -135,6 +167,7 @@ export const TabContentCheckpoint: FC<Props> = (props: Props) => {
135167
hasPassedCheckpointReviewThreshold,
136168
checkpointReviewerResourceIds,
137169
myMemberIds,
170+
checkpointScreeningOutcome,
138171
],
139172
)
140173

src/apps/review/src/lib/components/ChallengeDetailsContent/TabContentReview.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ import { hasSubmitterPassedThreshold } from '../../utils/reviewScoring'
4646
interface Props {
4747
aiReviewers?: { aiWorkflowId: string }[]
4848
selectedTab: string
49+
screeningOutcome: {
50+
failingSubmissionIds: Set<string>;
51+
passingSubmissionIds: Set<string>;
52+
}
4953
reviews: SubmissionInfo[]
5054
submitterReviews: SubmissionInfo[]
5155
reviewMinimumPassingScore?: number | null
@@ -636,6 +640,7 @@ export const TabContentReview: FC<Props> = (props: Props) => {
636640
},
637641
[resolvedReviewsWithSubmitter],
638642
)
643+
639644
const filteredSubmitterReviews = useMemo(
640645
() => {
641646
if (!resolvedSubmitterReviews.length) {
@@ -729,6 +734,7 @@ export const TabContentReview: FC<Props> = (props: Props) => {
729734
<TableReview
730735
aiReviewers={props.aiReviewers}
731736
datas={reviewRows}
737+
screeningOutcome={props.screeningOutcome}
732738
isDownloading={props.isDownloading}
733739
downloadSubmission={props.downloadSubmission}
734740
mappingReviewAppeal={props.mappingReviewAppeal}

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

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -104,13 +104,30 @@ export const ChallengePhaseInfo: FC<Props> = (props: Props) => {
104104
const formatCurrency = useCallback((amount: number | string, currency?: string): string => {
105105
const n = typeof amount === 'number' ? amount : Number(amount)
106106
if (Number.isNaN(n)) return String(amount)
107-
const nf = new Intl.NumberFormat('en-US', {
108-
currency: currency || 'USD',
109-
maximumFractionDigits: 2,
110-
minimumFractionDigits: 2,
111-
style: 'currency',
112-
})
113-
return nf.format(n)
107+
108+
const normalizedCurrency = (currency || 'USD').toUpperCase()
109+
if (normalizedCurrency === 'POINT') {
110+
return `${n.toLocaleString('en-US', {
111+
maximumFractionDigits: 2,
112+
minimumFractionDigits: 0,
113+
})} Points`
114+
}
115+
116+
try {
117+
const nf = new Intl.NumberFormat('en-US', {
118+
currency: normalizedCurrency,
119+
maximumFractionDigits: 2,
120+
minimumFractionDigits: 2,
121+
style: 'currency',
122+
})
123+
return nf.format(n)
124+
} catch (err) {
125+
// Fallback for any non-ISO currency codes
126+
return `${normalizedCurrency} ${n.toLocaleString('en-US', {
127+
maximumFractionDigits: 2,
128+
minimumFractionDigits: 2,
129+
})}`
130+
}
114131
}, [])
115132

116133
const taskPaymentFromPrizeSets = useMemo(() => {

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

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,30 @@ type PastRow = { id: string, description: string, handle: string, amount: string
2424
const formatCurrency = (amount: number | string, currency?: string): string => {
2525
const n = typeof amount === 'number' ? amount : Number(amount)
2626
if (Number.isNaN(n)) return String(amount)
27-
const nf = new Intl.NumberFormat('en-US', {
28-
currency: currency || 'USD',
29-
maximumFractionDigits: 2,
30-
minimumFractionDigits: 2,
31-
style: 'currency',
32-
})
33-
return nf.format(n)
27+
28+
const normalizedCurrency = (currency || 'USD').toUpperCase()
29+
if (normalizedCurrency === 'POINT') {
30+
return `${n.toLocaleString('en-US', {
31+
maximumFractionDigits: 2,
32+
minimumFractionDigits: 0,
33+
})} Points`
34+
}
35+
36+
try {
37+
const nf = new Intl.NumberFormat('en-US', {
38+
currency: normalizedCurrency,
39+
maximumFractionDigits: 2,
40+
minimumFractionDigits: 2,
41+
style: 'currency',
42+
})
43+
return nf.format(n)
44+
} catch (err) {
45+
// Fallback for any non-ISO currency codes
46+
return `${normalizedCurrency} ${n.toLocaleString('en-US', {
47+
maximumFractionDigits: 2,
48+
minimumFractionDigits: 2,
49+
})}`
50+
}
3451
}
3552

3653
const ordinal = (i: number): string => {

src/apps/review/src/lib/components/Scorecard/ScorecardViewer/ScorecardQuestion/ReviewResponse/ReviewManagerComment/ReviewManagerComment.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ const ReviewManagerComment: FC<ReviewManagerCommentProps> = props => {
119119
<div className={styles.content}>
120120
<MarkdownReview value={comment} />
121121
</div>
122-
{isManagerEdit && (
122+
{isManagerEdit && canAddManagerComment && (
123123
<button
124124
type='button'
125125
onClick={handleShowCommentForm}

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

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ export interface TableReviewProps {
7272
aiReviewers?: { aiWorkflowId: string }[]
7373
className?: string
7474
datas: SubmissionInfo[]
75+
screeningOutcome: {
76+
failingSubmissionIds: Set<string>;
77+
passingSubmissionIds: Set<string>;
78+
}
7579
isDownloading: IsRemovingType
7680
downloadSubmission: (submissionId: string) => void
7781
mappingReviewAppeal: MappingReviewAppeal
@@ -230,9 +234,20 @@ export const TableReview: FC<TableReviewProps> = (props: TableReviewProps) => {
230234
[myReviewerResourceIds],
231235
)
232236

237+
const filterScreeningPassedReviews = useCallback(
238+
(submissions: SubmissionInfo[]): SubmissionInfo[] => submissions.filter(
239+
submission => props.screeningOutcome.passingSubmissionIds.has(submission.id ?? ''),
240+
),
241+
[props.screeningOutcome.passingSubmissionIds],
242+
)
243+
233244
const submissionsForAggregation = useMemo<SubmissionInfo[]>(
234-
() => (restrictToLatest ? latestSubmissions : reviewPhaseDatas),
235-
[latestSubmissions, restrictToLatest, reviewPhaseDatas],
245+
() => (
246+
restrictToLatest
247+
? filterScreeningPassedReviews(latestSubmissions)
248+
: filterScreeningPassedReviews(reviewPhaseDatas)
249+
),
250+
[latestSubmissions, restrictToLatest, reviewPhaseDatas, filterScreeningPassedReviews],
236251
)
237252

238253
const aggregatedSubmissionRows = useMemo<AggregatedSubmissionReviews[]>(() => (

0 commit comments

Comments
 (0)