Skip to content

Commit

Permalink
🐛 Fix create assessment logic to prevent 409 conflicts (#1631)
Browse files Browse the repository at this point in the history
  • Loading branch information
ibolton336 authored Dec 18, 2023
1 parent 1d21f06 commit 2de18b7
Showing 1 changed file with 18 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -156,23 +156,25 @@ const DynamicAssessmentActionsRow: FunctionComponent<
};

const takeAssessment = async () => {
if (!isArchetype && application?.archetypes?.length) {
for (const archetypeRef of application.archetypes) {
try {
createAssessment();
} catch (error) {
console.error(
`Error fetching archetype with ID ${archetypeRef.id}:`,
error
);
pushNotification({
title: t("terms.error"),
variant: "danger",
});
}
}
} else {
try {
createAssessment();
} catch (error) {
if (isArchetype) {
console.error(
`Error fetching archetype with ID ${archetype?.id}:`,
error
);
} else {
console.error(
`Error fetching application with ID ${application?.id}:`,
error
);
}

pushNotification({
title: t("terms.error"),
variant: "danger",
});
}
};

Expand Down

0 comments on commit 2de18b7

Please sign in to comment.