@@ -42,6 +42,7 @@ class Register < ApplicationRecord
4242 before_validation ( :propose_and_save_title , if : :submitted? )
4343 before_destroy ( :return_names_to_draft )
4444 before_save ( :update_name_order )
45+ after_save ( :unsnooze_curation! )
4546
4647 validates ( :publication_id , presence : true , if : :validated? )
4748 validates ( :publication_pdf , presence : true , if : :validated? )
@@ -84,11 +85,17 @@ def nom_nov(name)
8485 end
8586
8687 def pending_for_curation
87- where ( validated : false , notified : true )
88- . or ( where ( validated : false , submitted : true ) )
88+ where ( validated : false )
89+ . where ( 'notified = ? OR submitted = ?' , true , true )
90+ . where ( 'snooze_curation is null or snooze_curation <= ?' , Time . now )
8991 . order ( updated_at : :asc )
9092 . select { |i | i . notified? || !i . endorsed? }
9193 end
94+
95+ def snoozed_for_curation
96+ where ( 'snooze_curation > ?' , Time . now )
97+ . order ( updated_at : :asc )
98+ end
9299 end
93100
94101 def acc_url ( protocol = false )
@@ -256,6 +263,19 @@ def doi_url
256263 'https://doi.org/%s' % doi
257264 end
258265
266+ def snoozed_curation?
267+ snooze_curation . present? && snooze_curation > Time . now
268+ end
269+
270+ def snooze_curation! ( time )
271+ time = nil if time && time <= Time . now
272+ update_column ( :snooze_curation , time )
273+ end
274+
275+ def unsnooze_curation!
276+ snooze_curation! ( nil )
277+ end
278+
259279 def citations
260280 @citations ||=
261281 ( [ publication ] + sorted_names . map ( &:citations ) . flatten ) . compact . uniq
0 commit comments