Skip to content

Commit

Permalink
Optimization suggestions
Browse files Browse the repository at this point in the history
Signed-off-by: Ian Bolton <[email protected]>
  • Loading branch information
ibolton336 committed Mar 20, 2024
1 parent 73e5f86 commit cecde39
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions client/src/app/hooks/useAssessmentStatus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ export const useAssessmentStatus = (application: Application) => {
const { assessments } = useFetchAssessments();
const { archetypes } = useFetchArchetypes();

const isDirectlyAssessed =
(application.assessed && (application.assessments?.length ?? 0) > 0) ??
false;

return useMemo(() => {
const applicationAssessments =
assessments?.filter(
Expand Down Expand Up @@ -65,16 +69,12 @@ export const useAssessmentStatus = (application: Application) => {
assessment.status === "empty" ||
assessment.status === "complete"
);
const isDirectlyAssessed =
(application.assessed && (application.assessments?.length ?? 0) > 0) ??
false;

return {
allArchetypesAssessed,
countOfFullyAssessedArchetypes: assessedArchetypesCount,
countOfArchetypesWithRequiredAssessments: assessmentsFromArchetypesCount,
hasApplicationAssessmentInProgress,
isApplicationDirectlyAssessed: isDirectlyAssessed,
};
}, [assessments, archetypes, application]);
}, [assessments, archetypes, application.id, isDirectlyAssessed]);
};

0 comments on commit cecde39

Please sign in to comment.