Skip to content

Commit

Permalink
Merge pull request #128 from isZumpo/fix_failing_test
Browse files Browse the repository at this point in the history
Fix SQL error in GetClipsQualifyingForRemoval
  • Loading branch information
tphakala authored Apr 22, 2024
2 parents cb99a02 + 9904eba commit 979e16c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion internal/datastore/interfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ func (ds *DataStore) GetClipsQualifyingForRemoval(minHours int, minClips int) ([
}

// Main query to find clips qualifying for removal based on retention policy
err := ds.DB.Model(&Note{}).
err := ds.DB.Table("(?) AS n", ds.DB.Model(&Note{})).
Select("n.ID, n.scientific_name, n.clip_name, sub.num_recordings").
Joins("INNER JOIN (?) AS sub ON n.ID = sub.ID", subquery).
Where("strftime('%s', 'now') - strftime('%s', begin_time) > ?", minHours*3600). // Convert hours to seconds for comparison
Expand Down

0 comments on commit 979e16c

Please sign in to comment.