Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More detail about PPR setting, double check it isn't going right to curation #1784

Merged
merged 2 commits into from
Jul 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions app/models/stash_engine/resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ''
Expand All @@ -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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions app/views/stash_datacite/peer_review/_review.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div>
<p>This dataset will remain private for peer review until we receive a notification from the journal confirming formal acceptance of the associated manuscript.</p>
</div>
<% elsif @resource.identifier.allow_review? && @resource.previous_curated_resource.blank? && @resource.curation_start_date.blank? %>
<% elsif @resource.identifier.allow_review? && @resource.identifier.date_last_curated.blank? %>
<!-- This is only available if the id has not been curated AND
the associated journal allows a review workflow -->
<div>
Expand Down Expand Up @@ -33,6 +33,6 @@
</div>
<% else %>
<div>
<p>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.</p>
<p>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.</p>
</div>
<% end %>