Skip to content

Commit

Permalink
we had a reason for why this was the way it was!
Browse files Browse the repository at this point in the history
  • Loading branch information
epugh committed Jul 11, 2024
1 parent a69b32b commit 19e4f82
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion app/models/snapshot.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ class Snapshot < ApplicationRecord
belongs_to :scorer, optional: true # shouldn't be optional!

# see the call back delete_associated_objects for special delete logic.
has_many :snapshot_queries, dependent: :delete_all
# rubocop:disable Rails/HasManyOrHasOneDependent
has_many :snapshot_queries
# rubocop:enable Rails/HasManyOrHasOneDependent
has_many :snapshot_docs,
through: :snapshot_queries

Expand Down
3 changes: 2 additions & 1 deletion app/services/fetch_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ def complete
# Keep the first snapshot, and the most recents, deleting the ones out of the middle.
# Not the best sampling!
snapshot_to_delete = @case.snapshots[1..((@options[:snapshot_limit] * -1) + @case.snapshots.count)]
snapshot_to_delete&.each(&:destroy)
# snapshot_to_delete&.each(&:destroy)
snapshot_to_delete.each(&:destroy!)
end

# rubocop:disable Metrics/MethodLength
Expand Down

0 comments on commit 19e4f82

Please sign in to comment.