Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ exports[`Matches shallow shapshot 1`] = `
"id": "test-challenge",
}
}
hasPendingWorkflowRuns={null}
isWorkflowRunComplete={true}
onDelete={[Function]}
onDownload={[Function]}
onOpenDownloadArtifactsModal={[Function]}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export default function Submission(props) {
onOpenRatingsListModal,
status,
allowDelete,
hasPendingWorkflowRuns,
isWorkflowRunComplete,
Copy link

Choose a reason for hiding this comment

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

[❗❗ correctness]
The variable isWorkflowRunComplete is used to determine if the delete button should be enabled. Ensure that this variable accurately reflects the completion status of the workflow run, as any discrepancy could lead to incorrect UI behavior.

} = props;
const formatDate = date => moment(+new Date(date)).format('MMM DD, YYYY hh:mm A');
const onDownloadSubmission = onDownload.bind(1, submissionObject.id);
Expand Down Expand Up @@ -71,8 +71,6 @@ export default function Submission(props) {
&& track === COMPETITION_TRACKS.DES
&& safeForDownloadCheck === true;

const showPendingTooltip = !allowDelete && hasPendingWorkflowRuns;

return (
<tr styleName="submission-row">
<td styleName="id-col">
Expand Down Expand Up @@ -154,11 +152,12 @@ export default function Submission(props) {
><DownloadIcon /></button>
*/ }
{showDeleteButton && (
!showPendingTooltip ? (
isWorkflowRunComplete ? (
Copy link

Choose a reason for hiding this comment

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

[❗❗ correctness]
The logic for enabling the delete button has been changed to depend on isWorkflowRunComplete. Verify that this change aligns with the intended business logic, as it alters when a submission can be deleted.

<button
styleName="delete-icon"
onClick={() => onDelete(submissionObject.id)}
type="button"
disabled={!allowDelete}
Copy link

Choose a reason for hiding this comment

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

[⚠️ correctness]
The disabled attribute is conditionally set based on allowDelete, but the logic for showDeleteButton already checks for allowDelete indirectly through safeForDownloadCheck. Consider reviewing the conditions to ensure they align with the intended behavior.

>
<DeleteIcon />
</button>
Expand Down Expand Up @@ -239,5 +238,5 @@ Submission.propTypes = {
allowDelete: PT.bool.isRequired,
onOpenDownloadArtifactsModal: PT.func,
onOpenRatingsListModal: PT.func,
hasPendingWorkflowRuns: PT.bool.isRequired,
isWorkflowRunComplete: PT.bool.isRequired,
};
Original file line number Diff line number Diff line change
Expand Up @@ -87,19 +87,15 @@ export default function SubmissionsTable(props) {
? submissionWorkflowRuns[subObject.id]
: null;

let isWorkflowRunComplete = true; // allow delete if no runs
const hasRuns = workflowRunsForSubmission && workflowRunsForSubmission.length > 0;

if (workflowRunsForSubmission && workflowRunsForSubmission.length > 0) {
isWorkflowRunComplete = workflowRunsForSubmission.length === 0
|| workflowRunsForSubmission.every(run => TERMINAL_STATUSES.includes(run.status));
}
const isWorkflowRunComplete = !hasRuns
? true
: workflowRunsForSubmission.every(run => TERMINAL_STATUSES.includes(run.status));

const allowDelete = submissionPhaseStartDate
&& moment(subObject.submissionDate).isAfter(submissionPhaseStartDate)
&& isWorkflowRunComplete;
&& moment(subObject.submissionDate).isAfter(submissionPhaseStartDate);
Copy link

Choose a reason for hiding this comment

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

[❗❗ correctness]
The allowDelete logic has been changed to no longer consider isWorkflowRunComplete. If this was intentional, ensure that it aligns with the desired behavior. If not, this could lead to allowing deletions when there are incomplete workflow runs.


const hasPendingWorkflowRuns = workflowRunsForSubmission
&& workflowRunsForSubmission.some(run => !TERMINAL_STATUSES.includes(run.status));

const submission = (
<Submission
Expand All @@ -115,7 +111,7 @@ export default function SubmissionsTable(props) {
allowDelete={allowDelete}
onOpenDownloadArtifactsModal={onOpenDownloadArtifactsModal}
onOpenRatingsListModal={onOpenRatingsListModal}
hasPendingWorkflowRuns={hasPendingWorkflowRuns}
isWorkflowRunComplete={isWorkflowRunComplete}
Copy link

Choose a reason for hiding this comment

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

[❗❗ correctness]
The prop hasPendingWorkflowRuns was replaced with isWorkflowRunComplete. Ensure that the Submission component is updated accordingly to handle this change, as it may affect the component's logic.

/>
);
submissionsWithDetails.push(submission);
Expand Down
Loading