Skip to content

Commit

Permalink
Merge pull request #1810 from datadryad/ppr-checks
Browse files Browse the repository at this point in the history
Make sure all PPR assignments align exactly and use same checks
  • Loading branch information
ryscher authored Aug 16, 2024
2 parents 3c8cfe5 + 546a5bd commit 341c785
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
4 changes: 2 additions & 2 deletions app/controllers/stash_datacite/resources_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ def review
check_required_fields(@resource)
@review = Resource::Review.new(@resource)
@resource.has_geolocation = @review.geolocation_data?
if @resource.identifier.automatic_ppr?
if @resource.identifier.automatic_ppr? && @resource.identifier.date_last_curated.blank?
@resource.hold_for_peer_review = true
elsif !@resource.identifier.allow_review? || @resource.previous_curated_resource.present? || @resource.curation_start_date.present?
elsif !@resource.identifier.allow_review? || @resource.identifier.date_last_curated.present?
@resource.hold_for_peer_review = false
@resource.peer_review_end_date = nil
end
Expand Down
5 changes: 4 additions & 1 deletion app/models/stash_engine/identifier.rb
Original file line number Diff line number Diff line change
Expand Up @@ -357,8 +357,11 @@ def latest_manuscript

def automatic_ppr?
return false unless latest_manuscript.present?
return false if has_accepted_manuscript?
return false if has_rejected_manuscript?
return false if publication_article_doi.present?

!has_accepted_manuscript? && !has_rejected_manuscript?
true
end

# rubocop:disable Naming/PredicateName
Expand Down
4 changes: 2 additions & 2 deletions app/models/stash_engine/resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1107,7 +1107,7 @@ def create_post_submission_status(prior_cur_act)
end

# Determine which submission status to use, :submitted or :peer_review status
elsif hold_for_peer_review? && identifier.allow_review?
elsif (hold_for_peer_review? && identifier.allow_review?) || identifier.automatic_ppr?
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"
Expand All @@ -1120,7 +1120,7 @@ def create_post_submission_status(prior_cur_act)
else
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)
update(hold_for_peer_review: true, peer_review_end_date: Time.now.utc + 6.months)
end
end

Expand Down
2 changes: 1 addition & 1 deletion app/views/stash_datacite/peer_review/_review.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<% if @resource.identifier.automatic_ppr? %>
<% if @resource.identifier.automatic_ppr? && @resource.identifier.date_last_curated.blank? %>
<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>
Expand Down

0 comments on commit 341c785

Please sign in to comment.