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 612d657 commit 818f1ee
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 818f1ee

Please sign in to comment.