diff --git a/client/src/app/pages/applications/applications-table-assessment/applications-table-assessment.tsx b/client/src/app/pages/applications/applications-table-assessment/applications-table-assessment.tsx
index 04874ac4ae..339d5a8ce9 100644
--- a/client/src/app/pages/applications/applications-table-assessment/applications-table-assessment.tsx
+++ b/client/src/app/pages/applications/applications-table-assessment/applications-table-assessment.tsx
@@ -655,7 +655,7 @@ export const ApplicationsTable: React.FC = () => {
{...getTdProps({ columnKey: "assessment" })}
>
{
- switch (assessment.status) {
- case "empty":
- return "NotStarted";
- case "started":
- return "InProgress";
- case "complete":
- return "Completed";
- default:
- return "NotStarted";
- }
-};
-
export const ApplicationAssessmentStatus: React.FC<
ApplicationAssessmentStatusProps
-> = ({ assessments, isLoading = false, fetchError = null }) => {
+> = ({ application, isLoading = false }) => {
const { t } = useTranslation();
- //TODO: remove this once we have a proper assessment status
- const { assessment } = useFetchAssessmentById(assessments?.[0]?.id);
+
+ const {
+ assessments,
+ isFetching: isFetchingAssessmentsById,
+ fetchError,
+ } = useFetchAssessmentsByItemId(false, application.id);
+
+ if (application?.assessed) {
+ return ;
+ }
if (fetchError) {
return ;
}
- if (isLoading) {
+
+ if (isLoading || isFetchingAssessmentsById) {
return ;
}
- return assessment ? (
-
- ) : (
-
- );
+ if (
+ assessments?.some((a) => a.status === "started" || a.status === "complete")
+ ) {
+ return ;
+ }
+
+ return ;
};
|