Skip to content

Commit

Permalink
Merge pull request PapillonApp#154 from Vilerio/fix3
Browse files Browse the repository at this point in the history
fix: saut d'un cours annulé pour le widget prochain cours
  • Loading branch information
ecnivtwelve committed Sep 5, 2024
2 parents a639a79 + 57207ed commit 1e4eb8f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/widgets/Components/NextCourse.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ const NextCourseWidget = forwardRef(({ hidden, setHidden, loading, setLoading }:
let nextCourse = null;

nextCourse = allCourses
.filter(c => c.startTimestamp < today && c.endTimestamp > today)
.filter(c => c.startTimestamp < today && c.endTimestamp > today && c.status !== "Cours annulé")
.sort((a, b) => b.endTimestamp - a.endTimestamp)[0];

if (!nextCourse) {
nextCourse = allCourses
.filter(c => c.startTimestamp > today)
.filter(c => c.startTimestamp > today && c.status !== "Cours annulé")
.sort((a, b) => a.startTimestamp - b.startTimestamp)[0];
}

Expand All @@ -61,7 +61,7 @@ const NextCourseWidget = forwardRef(({ hidden, setHidden, loading, setLoading }:

setLoading(false);
}();
}, [account.instance, timetables]);
}, [account.instance, timetables]);

return !hidden && (
<View
Expand Down Expand Up @@ -250,4 +250,4 @@ const NextCourseLesson: React.FC<{
);
};

export default NextCourseWidget;
export default NextCourseWidget;

0 comments on commit 1e4eb8f

Please sign in to comment.