From a58a40b50699ecce0b0403e7ccecb72d096ab933 Mon Sep 17 00:00:00 2001 From: egsch Date: Tue, 19 Nov 2024 13:33:52 -0600 Subject: [PATCH 1/4] re-add check for -1 gpa, add placeholder --- src/components/compare/CompareTable/compareTable.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/compare/CompareTable/compareTable.tsx b/src/components/compare/CompareTable/compareTable.tsx index 9bf85eee..ce954b68 100644 --- a/src/components/compare/CompareTable/compareTable.tsx +++ b/src/components/compare/CompareTable/compareTable.tsx @@ -141,7 +141,7 @@ function GradeOrRmpRow({ {loadingFiller} )) || - (value.state === 'done' && + ((value.state === 'done' && getValue(value.data) !== -1) ? (name !== 'GPA' ? (value.data as RMPInterface).numRatings > 0 : true) && ( // do not display RMP data (non-GPA data) if there are no reviews @@ -165,7 +165,7 @@ function GradeOrRmpRow({ {formatValue(getValue(value.data))} - )) || + ) : 0.00) || null} ))} From 7e57b6d3d27d671f6fe5d54600e30256798b83b1 Mon Sep 17 00:00:00 2001 From: egsch Date: Tue, 19 Nov 2024 13:38:45 -0600 Subject: [PATCH 2/4] format --- src/components/compare/CompareTable/compareTable.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/components/compare/CompareTable/compareTable.tsx b/src/components/compare/CompareTable/compareTable.tsx index ce954b68..42229817 100644 --- a/src/components/compare/CompareTable/compareTable.tsx +++ b/src/components/compare/CompareTable/compareTable.tsx @@ -141,7 +141,7 @@ function GradeOrRmpRow({ {loadingFiller} )) || - ((value.state === 'done' && getValue(value.data) !== -1) ? + (value.state === 'done' && getValue(value.data) !== -1 ? ( (name !== 'GPA' ? (value.data as RMPInterface).numRatings > 0 : true) && ( // do not display RMP data (non-GPA data) if there are no reviews @@ -165,7 +165,10 @@ function GradeOrRmpRow({ {formatValue(getValue(value.data))} - ) : 0.00) || + ) + ) : ( + 0.00 + )) || null} ))} From d31810352692e63a3e40b9a77688c714ef49464a Mon Sep 17 00:00:00 2001 From: AbhiramTadepalli Date: Wed, 27 Nov 2024 07:10:46 -0600 Subject: [PATCH 3/4] Handle N/A or Null for individual RMP data --- .../common/SingleProfInfo/singleProfInfo.tsx | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/components/common/SingleProfInfo/singleProfInfo.tsx b/src/components/common/SingleProfInfo/singleProfInfo.tsx index ac989b0f..8b009fa4 100644 --- a/src/components/common/SingleProfInfo/singleProfInfo.tsx +++ b/src/components/common/SingleProfInfo/singleProfInfo.tsx @@ -116,11 +116,20 @@ function SingleProfInfo({ rmp }: Props) { return ( -

{rmp.data.avgRating}

+

+ {typeof rmp.data.avgRating !== undefined && rmp.data.avgRating > 0 + ? rmp.data.avgRating + : 'N/A'} +

Professor rating

-

{rmp.data.avgDifficulty}

+

+ {typeof rmp.data.avgDifficulty !== undefined && + rmp.data.avgDifficulty > 0 + ? rmp.data.avgDifficulty + : 'N/A'} +

Difficulty

@@ -131,7 +140,10 @@ function SingleProfInfo({ rmp }: Props) {

- {rmp.data.wouldTakeAgainPercent.toFixed(0) + '%'} + {typeof rmp.data.wouldTakeAgainPercent !== undefined && + rmp.data.wouldTakeAgainPercent > 0 + ? rmp.data.wouldTakeAgainPercent.toFixed(0) + '%' + : 'N/A'}

Would take again

From b3a874dd4f380503a54cac4a71fa631ea7501182 Mon Sep 17 00:00:00 2001 From: AbhiramTadepalli Date: Wed, 27 Nov 2024 07:24:22 -0600 Subject: [PATCH 4/4] lint --- .../common/SingleProfInfo/singleProfInfo.tsx | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/components/common/SingleProfInfo/singleProfInfo.tsx b/src/components/common/SingleProfInfo/singleProfInfo.tsx index 8b009fa4..0f62b094 100644 --- a/src/components/common/SingleProfInfo/singleProfInfo.tsx +++ b/src/components/common/SingleProfInfo/singleProfInfo.tsx @@ -117,18 +117,13 @@ function SingleProfInfo({ rmp }: Props) {

- {typeof rmp.data.avgRating !== undefined && rmp.data.avgRating > 0 - ? rmp.data.avgRating - : 'N/A'} + {rmp.data.avgRating > 0 ? rmp.data.avgRating : 'N/A'}

Professor rating

- {typeof rmp.data.avgDifficulty !== undefined && - rmp.data.avgDifficulty > 0 - ? rmp.data.avgDifficulty - : 'N/A'} + {rmp.data.avgDifficulty > 0 ? rmp.data.avgDifficulty : 'N/A'}

Difficulty

@@ -140,8 +135,7 @@ function SingleProfInfo({ rmp }: Props) {

- {typeof rmp.data.wouldTakeAgainPercent !== undefined && - rmp.data.wouldTakeAgainPercent > 0 + {rmp.data.wouldTakeAgainPercent > 0 ? rmp.data.wouldTakeAgainPercent.toFixed(0) + '%' : 'N/A'}