diff --git a/modules/core-data/src/main/java/com/ankitsuda/rebound/data/db/daos/ExercisesDao.kt b/modules/core-data/src/main/java/com/ankitsuda/rebound/data/db/daos/ExercisesDao.kt index 4977f899..506424ae 100644 --- a/modules/core-data/src/main/java/com/ankitsuda/rebound/data/db/daos/ExercisesDao.kt +++ b/modules/core-data/src/main/java/com/ankitsuda/rebound/data/db/daos/ExercisesDao.kt @@ -36,6 +36,14 @@ interface ExercisesDao { @Query( """ + SELECT + e.*, + (SELECT + COUNT(ewj.id) + FROM exercise_workout_junctions ewj + JOIN workouts w ON ewj.workout_id = w.id AND e.exercise_id = ewj.exercise_id + WHERE w.id = ewj.workout_id AND w.is_hidden = 0 AND w.in_progress = 0) as logs_count + FROM exercises e ORDER BY name COLLATE NOCASE ASC """ ) fun getAllExercisesWithExtraInfoPaged(searchQuery: String?): PagingSource