diff --git a/app/models/stash_engine/resource.rb b/app/models/stash_engine/resource.rb index 10e01f89ae..d0b22b7923 100644 --- a/app/models/stash_engine/resource.rb +++ b/app/models/stash_engine/resource.rb @@ -1088,6 +1088,7 @@ def prepare_for_curation note: 'System set back to curation') end + # rubocop:disable Metrics/AbcSize def create_post_submission_status(prior_cur_act) attribution = (prior_cur_act.nil? ? (current_editor_id || user_id) : prior_cur_act.user_id) curation_note = '' @@ -1104,16 +1105,20 @@ def create_post_submission_status(prior_cur_act) target_status = previous_resource.last_curation_activity.status curation_note = "Auto-published with minimal changes to #{changes.join(', ')}" end + # Determine which submission status to use, :submitted or :peer_review status - elsif hold_for_peer_review? && previous_curated_resource.blank? && curation_start_date.blank? - # Moving this logic to user facing, will not allow PPR selection by user + elsif hold_for_peer_review? && identifier.allow_review? publication_accepted = identifier.has_accepted_manuscript? || identifier.publication_article_doi if publication_accepted curation_note = "Private for peer review was requested, but associated manuscript #{manuscript} has already been accepted" target_status = 'submitted' update(hold_for_peer_review: false, peer_review_end_date: nil) + elsif identifier.date_last_curated.present? + curation_note = 'Private for peer review was requested, but the submission has already been curated' + target_status = 'submitted' + update(hold_for_peer_review: false, peer_review_end_date: nil) else - curation_note = "Set to Private for peer review at author's request" + curation_note = "Set to Private for peer review at #{identifier.automatic_ppr? ? "journal's" : "author's"} request" target_status = 'peer_review' update(peer_review_end_date: Time.now.utc + 6.months) end @@ -1124,6 +1129,7 @@ def create_post_submission_status(prior_cur_act) curation_activities << StashEngine::CurationActivity.create(user_id: attribution, status: target_status, note: curation_note) target_status end + # rubocop:enable Metrics/AbcSize def auto_assign_curator(target_status:) target_curator = identifier.most_recent_curator diff --git a/app/views/stash_datacite/peer_review/_review.html.erb b/app/views/stash_datacite/peer_review/_review.html.erb index 94ab7b607b..101a0b5612 100644 --- a/app/views/stash_datacite/peer_review/_review.html.erb +++ b/app/views/stash_datacite/peer_review/_review.html.erb @@ -2,7 +2,7 @@
This dataset will remain private for peer review until we receive a notification from the journal confirming formal acceptance of the associated manuscript.
The private for peer review option is not available for this data submission<% if @resource.identifier.pub_state == 'published' %>, because the data has been previously published<% elsif @resource.identifier.has_accepted_manuscript? %>, because the associated article has been accepted for publication by the journal<% elsif @resource.identifier.publication_article_doi %>, because the associated article has been published by the journal<% elsif @resource.previous_curated_resource.present? || @resource.curation_start_date.present? %>, because the dataset has been submitted and entered curation<% end %>. Upon submission, the dataset will proceed to our curation process for evaluation and publication.
+The private for peer review option is not available for this data submission<% if @resource.identifier.pub_state == 'published' %>, because the data has been previously published<% elsif @resource.identifier.has_accepted_manuscript? %>, because the associated article has been accepted for publication by the journal<% elsif @resource.identifier.publication_article_doi %>, because the associated article has been published by the journal<% elsif @resource.identifier.date_last_curated.present? %>, because the dataset has previously been submitted and entered curation<% end %>. Upon submission, the dataset will proceed to our curation process for evaluation and publication.