Skip to content

Commit e6ba3b5

Browse files
authored
fix: delete underlying FIT file when deleting a workout from history (#4788)
Deleting a workout only removed its row from the SQLite database, leaving the .fit file on disk. FitDatabaseProcessor::processDirectory() rescans that directory on every app start and re-imports any file whose hash isn't already in the DB, so deleted workouts silently reappeared after restart. Verified on-device: end 3 workouts, delete one, restart the app -> before this fix it came back, after this fix it stays deleted.
1 parent 5e08fcb commit e6ba3b5

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

src/workoutmodel.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,11 @@ bool WorkoutModel::deleteWorkout(int workoutId) {
138138
return false;
139139
}
140140

141-
// Optionally, you could also delete the FIT file here if desired
142-
// if (!filePath.isEmpty()) {
143-
// QFile::remove(filePath);
144-
// }
141+
// Delete the underlying FIT file too, otherwise FitDatabaseProcessor::processDirectory()
142+
// will find it unindexed on the next app start and re-insert it into the workouts table.
143+
if (!filePath.isEmpty()) {
144+
QFile::remove(filePath);
145+
}
145146

146147
// Refresh the model
147148
refresh();

0 commit comments

Comments
 (0)