Skip to content

Commit

Permalink
Use numRatings to determine if CompareTable should show RMP data
Browse files Browse the repository at this point in the history
  • Loading branch information
AbhiramTadepalli committed Nov 10, 2024
1 parent 4028296 commit 51144fd
Showing 1 changed file with 21 additions and 19 deletions.
40 changes: 21 additions & 19 deletions src/components/common/CompareTable/compareTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -143,28 +143,30 @@ function GradeOrRmpRow<T>({
<Typography className="text-base">{loadingFiller}</Typography>
</Skeleton>
)) ||
(value.state === 'done' && getValue(value.data) > 0 && (
<Tooltip
title={`${name}: ${formatValue(getValue(value.data))}`}
placement="top"
>
<Typography
className="text-base inline rounded-full px-5 py-2 text-black"
style={{
backgroundColor: colorMidpoint(
goodValue,
badValue,
getValue(value.data),
),
}}
(value.state === 'done' &&
name !== 'GPA' &&
(value.data as RMPInterface).numRatings > 0 && ( // do not display RMP data (non-GPA data) if there are no reviews
<Tooltip
title={`${name}: ${formatValue(getValue(value.data))}`}
placement="top"
>
{/*value.data is all the data past the state of loading, done, or error.
<Typography
className="text-base inline rounded-full px-5 py-2 text-black"
style={{
backgroundColor: colorMidpoint(
goodValue,
badValue,
getValue(value.data),
),
}}
>
{/*value.data is all the data past the state of loading, done, or error.
getValue returns the specific value from the data structure, like gpa.
formatValue makes it look pretty like 3.7216373 displaying as 3.72.*/}
{formatValue(getValue(value.data))}
</Typography>
</Tooltip>
)) ||
{formatValue(getValue(value.data))}
</Typography>
</Tooltip>
)) ||
null}
</TableCell>
))}
Expand Down

0 comments on commit 51144fd

Please sign in to comment.