Skip to content

Commit

Permalink
small refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
lumi-tip committed Dec 16, 2024
1 parent 08a40d2 commit e0c9417
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions src/pages/syllabus/[cohortSlug]/[lesson]/[lessonSlug]/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -263,18 +263,10 @@ function SyllabusContent() {
];

if (taskTodo.length > 0) {
let foundTask = null;

slugPriorities.some((slug) => {
if (!slug) return false;

foundTask = taskTodo.find(
(el) => el.task_type === assetTypeValues[lesson]
&& (el.associated_slug === slug || currentAsset?.aliases?.includes(el.associated_slug)),
);

return !!foundTask;
});
const foundTask = taskTodo.find((el) => (
el.task_type === assetTypeValues[lesson]
&& slugPriorities.some((slug) => slug && (el.associated_slug === slug || currentAsset?.aliases?.includes(slug)))
));

setCurrentTask(foundTask);
}
Expand Down

0 comments on commit e0c9417

Please sign in to comment.