Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Add assessment/review status to archetype table #1755

Merged
merged 2 commits into from
Mar 15, 2024

Conversation

rszwajko
Copy link
Collaborator

@rszwajko rszwajko commented Mar 8, 2024

Review states:

  1. Completed - a review exists
  2. NotStarted

Assessment states:

  1. Completed - all required assessments done (based on 'assessed' flag)
  2. InProgress - some assessments done
  3. NotStarted

Resolves: #1751

@rszwajko
Copy link
Collaborator Author

rszwajko commented Mar 8, 2024

Assessment completed, review not started

Screenshot from 2024-03-08 18-53-46

Assessment in progress, review completed

Screenshot from 2024-03-08 18-48-31

Copy link
Member

@ibolton336 ibolton336 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Look good so far. Discarding review/assessment doesn't invalidate the archetypes query & results in stale data.

@rszwajko
Copy link
Collaborator Author

rszwajko commented Mar 8, 2024

@ibolton336

Discarding review/assessment doesn't invalidate the archetypes query & results in stale data.

I've added the invalidation but the re-fetch is happening too quick. Even when manual refetch() is used then only 2nd or 3rd call returns updated value.

@rszwajko rszwajko marked this pull request as draft March 8, 2024 19:55
@sjd78
Copy link
Member

sjd78 commented Mar 8, 2024

Look good so far. Discarding review/assessment doesn't invalidate the archetypes query & results in stale data.

This is what application table does:

const onDeleteReviewSuccess = (name: string) => {
pushNotification({
title: t("toastr.success.reviewDiscarded", {
application: name,
}),
variant: "success",
});
queryClient.invalidateQueries([ApplicationsQueryKey]);
};
const { mutate: deleteReview } = useDeleteReviewMutation(
onDeleteReviewSuccess
);

const discardReview = async (application: Application) => {
try {
if (application.review?.id) {
await deleteReview({
id: application.review.id,
name: application.name,
});
}
} catch (error) {
console.error("Error while deleting review:", error);
pushNotification({
title: getAxiosErrorMessage(error as AxiosError),
variant: "danger",
});
}
};

I'm not a fan of the invalidation in the component's mutation onSuccess() handler, but it is what it is.

@rszwajko rszwajko marked this pull request as ready for review March 11, 2024 17:07
Copy link
Member

@sjd78 sjd78 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Tested and the assessment and review columns seem to reset immediately after the delete/discard is complete. Looks like the query invalidations are working correctly now.

@sjd78 sjd78 dismissed ibolton336’s stale review March 12, 2024 17:35

Stale data issue tests to be fixed.

Review states:
1. Completed - a review exists
2. NotStarted

Assessment states:
1. Completed - all required assessments done (based on 'assessed' flag)
2. InProgress - some assessments done
3. NotStarted

Signed-off-by: Radoslaw Szwajkowski <[email protected]>
@rszwajko
Copy link
Collaborator Author

@sjd78 removed unnecessary async in the newest force push

Copy link
Member

@sjd78 sjd78 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM and no more nit-picks! :-)

Copy link
Member

@ibolton336 ibolton336 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Copy link
Member

@aufi aufi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Archetype status for assessment / review missing in archetype table
4 participants