Skip to content

Commit

Permalink
Update ProgressService.php (#326)
Browse files Browse the repository at this point in the history
* Update ProgressService.php

* WIP
  • Loading branch information
mako321 authored Nov 28, 2024
1 parent 3f3b07f commit 8140414
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Services/ProgressService.php
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,13 @@ private function filterForStartedCourses(Builder $query, int $userId): Builder
->where('course_progress.user_id', $userId);
})
->whereColumn('lessons.course_id', 'courses.id')
->where('course_progress.status', ProgressStatus::IN_PROGRESS);
->where('course_progress.status', ProgressStatus::IN_PROGRESS)
->orWhere(function (QueryBuilder $query) {
$query->groupBy('topic.id')
->selectRaw('COUNT(CASE WHEN status = ? THEN 1 END) as completed_count', [ProgressStatus::COMPLETE])
->selectRaw('COUNT(CASE WHEN status = ? THEN 1 END) as in_completed_count', [ProgressStatus::INCOMPLETE])
->havingRaw('completed_count > 0 AND in_completed_count > 0');
});
});
}

Expand Down

0 comments on commit 8140414

Please sign in to comment.