diff --git a/src/features/checker/utils/mapApplicationsForOverviewPage.ts b/src/features/checker/utils/mapApplicationsForOverviewPage.ts
index 431f008..c47fd4d 100644
--- a/src/features/checker/utils/mapApplicationsForOverviewPage.ts
+++ b/src/features/checker/utils/mapApplicationsForOverviewPage.ts
@@ -6,7 +6,10 @@ import { ProjectReview, Review } from "../types";
// Define the structure of the function's return type
interface ProjectReviewsResultByCategory {
- categorizedReviews: Record<"INREVIEW" | "READY_TO_REVIEW", ProjectReview[]>;
+ categorizedReviews: Record<
+ "INREVIEW" | "READY_TO_REVIEW" | "APPROVED" | "REJECTED",
+ ProjectReview[]
+ >;
statCardsProps: StatCardProps[];
application: CheckerApplication;
}
@@ -21,9 +24,14 @@ export function categorizeProjectReviews(
const applicationsArray = Object.values(applications);
// Initialize the categorized reviews record
- const categorizedReviews: Record<"INREVIEW" | "READY_TO_REVIEW", ProjectReview[]> = {
+ const categorizedReviews: Record<
+ "INREVIEW" | "READY_TO_REVIEW" | "APPROVED" | "REJECTED",
+ ProjectReview[]
+ > = {
INREVIEW: [],
READY_TO_REVIEW: [],
+ APPROVED: [],
+ REJECTED: [],
};
// Initialize application counts
@@ -35,25 +43,23 @@ export function categorizeProjectReviews(
};
for (const application of applicationsArray) {
+ const reviewedApplicationStatus = application.status !== "PENDING";
+
// Only consider applications that are PENDING
- if (application.status !== "PENDING") {
- // Update application counts based on status
- switch (application.status) {
- case "APPROVED":
- applicationCounts.approved += 1;
- break;
- case "REJECTED":
- applicationCounts.rejected += 1;
- break;
- default:
- break;
- }
- applicationCounts.total += 1;
- continue; // Skip non-PENDING applications
+ // Update application counts based on status
+ switch (application.status) {
+ case "APPROVED":
+ applicationCounts.approved += 1;
+ break;
+ case "REJECTED":
+ applicationCounts.rejected += 1;
+ break;
+ case "PENDING":
+ applicationCounts.pending += 1;
+ break;
+ default:
+ continue;
}
-
- // Update application counts for PENDING
- applicationCounts.pending += 1;
applicationCounts.total += 1;
if (!application.evaluations) {
@@ -73,16 +79,19 @@ export function categorizeProjectReviews(
// Determine the category based on the number of human evaluations
const isReadyForReview = humanEvaluations.length >= 2;
- const category: "INREVIEW" | "READY_TO_REVIEW" = isReadyForReview
- ? "READY_TO_REVIEW"
- : "INREVIEW";
+ const category: "INREVIEW" | "READY_TO_REVIEW" | "APPROVED" | "REJECTED" | "IGNORE" =
+ !reviewedApplicationStatus && isReadyForReview
+ ? "READY_TO_REVIEW"
+ : !reviewedApplicationStatus
+ ? "INREVIEW"
+ : application.status !== "PENDING"
+ ? application.status
+ : "IGNORE";
// Map human evaluations to reviews
const reviews: Review[] = humanEvaluations?.map((evaluation) => {
- const isApproved = evaluation.evaluatorScore >= 50; // Assuming 50 as the approval threshold
- const reviewerAddress: `0x${string}` = evaluation.evaluator.startsWith("0x")
- ? (evaluation.evaluator as `0x${string}`)
- : (`0x${evaluation.evaluator}` as `0x${string}`);
+ const isApproved = evaluation.evaluationStatus === "APPROVED"; // Assuming 50 as the approval threshold
+ const reviewerAddress = evaluation.evaluator as `0x${string}`;
return {
reviewer: reviewerAddress,
approved: isApproved,
@@ -115,8 +124,7 @@ export function categorizeProjectReviews(
scoreAverage, // Average score from all evaluations
};
- // Add the ProjectReview to the appropriate category
- categorizedReviews[category].push(projectReview);
+ if (category !== "IGNORE") categorizedReviews[category].push(projectReview);
}
const statCardsProps: StatCardProps[] = [
diff --git a/src/primitives/Indicators/CircleStat/CircleStat.tsx b/src/primitives/Indicators/CircleStat/CircleStat.tsx
index ed5a213..80f315d 100644
--- a/src/primitives/Indicators/CircleStat/CircleStat.tsx
+++ b/src/primitives/Indicators/CircleStat/CircleStat.tsx
@@ -35,13 +35,13 @@ export const CircleStat: React.FC = ({
value,
size = "medium",
showPercentageSymbol = true,
- thresholds = { low: 30, mid: 60 },
+ thresholds = { low: 40, mid: 60 },
colors,
className,
}) => {
const getColorVariant = () => {
const _value = typeof value === "string" ? parseFloat(value) : value;
- if (isNaN(_value) || _value <= thresholds.low) return "low";
+ if (isNaN(_value) || _value < thresholds.low) return "low";
else if (_value < thresholds.mid) return "mid";
else return "high";
};