mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-03-05 04:03:45 +08:00
Merge pull request #7720 from artoscinote/ma_SCI_10890
Fix repository row touch for checklist values [SCI-10890]
This commit is contained in:
commit
69165c96a6
1 changed files with 7 additions and 3 deletions
|
@ -6,14 +6,18 @@ class RepositoryChecklistItemsValue < ApplicationRecord
|
|||
|
||||
validates :repository_checklist_item, :repository_checklist_value, presence: true
|
||||
|
||||
after_create :touch_repository_checklist_value
|
||||
before_destroy :touch_repository_checklist_value
|
||||
after_commit :touch_repository_checklist_value
|
||||
|
||||
private
|
||||
|
||||
# rubocop:disable Rails/SkipsModelValidations
|
||||
def touch_repository_checklist_value
|
||||
repository_checklist_value.touch
|
||||
# check if value was deleted, if so, touch repositroy_row directly
|
||||
if RepositoryChecklistValue.exists?(repository_checklist_value.id)
|
||||
repository_checklist_value.touch
|
||||
elsif RepositoryRow.exists?(repository_checklist_value.repository_cell.repository_row.id)
|
||||
repository_checklist_value.repository_cell.repository_row.touch
|
||||
end
|
||||
end
|
||||
# rubocop:enable Rails/SkipsModelValidations
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue