Skip to content

Commit

Permalink
simplify conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
CollinBeczak committed Nov 20, 2024
1 parent 63d7cd8 commit cff173b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/components/TaskAnalysisTable/TaskAnalysisTable.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -423,14 +423,14 @@ const setupColumnTypes = (props, taskBaseRoute, manager, data, openComments) =>
const { taskBundle, task, initialBundle } = props;
const { id: taskId, bundleId, status } = row._original;

Check warning on line 424 in src/components/TaskAnalysisTable/TaskAnalysisTable.jsx

View check run for this annotation

Codecov / codecov/patch

src/components/TaskAnalysisTable/TaskAnalysisTable.jsx#L423-L424

Added lines #L423 - L424 were not covered by tests

const isTaskSelected = taskId === task?.id
const isActiveTask = taskId === task?.id
const isInActiveBundle = taskBundle?.taskIds?.includes(taskId);
const alreadyBundled = bundleId && taskBundle?.bundleId !== bundleId;
const enableBundleEdits = initialBundle?.taskIds?.includes(taskId) || [0, 3, 6].includes(status) && !alreadyBundled
const validBundlingStatus = initialBundle?.taskIds?.includes(taskId) || [0, 3, 6].includes(status)

Check warning on line 429 in src/components/TaskAnalysisTable/TaskAnalysisTable.jsx

View check run for this annotation

Codecov / codecov/patch

src/components/TaskAnalysisTable/TaskAnalysisTable.jsx#L426-L429

Added lines #L426 - L429 were not covered by tests

return (
<div>
{!isTaskSelected && enableBundleEdits && isInActiveBundle && (
{!isActiveTask && validBundlingStatus && isInActiveBundle && !alreadyBundled && (

Check warning on line 433 in src/components/TaskAnalysisTable/TaskAnalysisTable.jsx

View check run for this annotation

Codecov / codecov/patch

src/components/TaskAnalysisTable/TaskAnalysisTable.jsx#L433

Added line #L433 was not covered by tests
<button
disabled={props.bundleEditsDisabled}
className="mr-text-red-light"
Expand All @@ -445,7 +445,7 @@ const setupColumnTypes = (props, taskBaseRoute, manager, data, openComments) =>
</button>
)}

{isTaskSelected && <div className="mr-text-yellow">Primary Task</div>}
{isActiveTask && <div className="mr-text-yellow">Primary Task</div>}

Check warning on line 448 in src/components/TaskAnalysisTable/TaskAnalysisTable.jsx

View check run for this annotation

Codecov / codecov/patch

src/components/TaskAnalysisTable/TaskAnalysisTable.jsx#L448

Added line #L448 was not covered by tests
</div>
);
},
Expand Down

0 comments on commit cff173b

Please sign in to comment.