fix: course start button bug

This commit is contained in:
swve 2023-12-22 16:36:18 +01:00
parent 1c86a829b0
commit 2108763b6d

View file

@ -43,8 +43,7 @@ const CourseClient = (props: any) => {
function isCourseStarted() {
const runs = course.trail.runs;
// checks if one of the obejcts in the array has the property "STATUS_IN_PROGRESS"
return runs.some((run: any) => run.status === "STATUS_IN_PROGRESS");
return runs.some((run: any) => run.status === "STATUS_IN_PROGRESS" && run.course_id === course.id);
}
async function quitCourse() {
@ -197,7 +196,6 @@ const CourseClient = (props: any) => {
</div>
</div>
}
{console.log(course)}
{isCourseStarted() ? (
<button className="py-2 px-5 mx-auto rounded-xl text-white font-bold h-12 w-[200px] drop-shadow-md bg-red-600 hover:bg-red-700 hover:cursor-pointer" onClick={quitCourse}>