From 0c61cbbacd2dc2133687b8ca4096bcf6e566313e Mon Sep 17 00:00:00 2001 From: Audrey Hamelers Date: Mon, 16 Mar 2026 16:43:11 +0100 Subject: [PATCH] add a new curation warning for missing award numbers --- .../components/MetadataEntry/Support/SuppPreview.jsx | 8 ++++++++ app/models/stash_datacite/contributor.rb | 5 ++--- app/views/stash_datacite/contributors/_show.html.erb | 2 +- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/app/javascript/react/components/MetadataEntry/Support/SuppPreview.jsx b/app/javascript/react/components/MetadataEntry/Support/SuppPreview.jsx index aff4e22a35..b4bc5e0a28 100644 --- a/app/javascript/react/components/MetadataEntry/Support/SuppPreview.jsx +++ b/app/javascript/react/components/MetadataEntry/Support/SuppPreview.jsx @@ -57,6 +57,14 @@ export default function SuppPreview({resource, previous, curator}) { )} + {curator && ['NIH', 'NSF'].includes(funder.api_integration_key) && !funder.award_number && ( + + )} {!funder.award_number && previous && prev?.award_number && prev.award_number} {funder.award_description && ( <>:{' '} diff --git a/app/models/stash_datacite/contributor.rb b/app/models/stash_datacite/contributor.rb index 113c59c86a..a5f8052fa1 100644 --- a/app/models/stash_datacite/contributor.rb +++ b/app/models/stash_datacite/contributor.rb @@ -43,6 +43,7 @@ class Contributor < ApplicationRecord validates_length_of :award_title, maximum: 191, allow_blank: true, message: 'Award title is too long. Value was not saved' validates_length_of :award_description, maximum: 191, allow_blank: true, message: 'Program/division is too long. Value was not saved' + # scopes for contributor scope :completed, -> { where("TRIM(IFNULL(contributor_name, '')) > '' AND TRIM('N/A' FROM IFNULL(contributor_name, '')) > ''") } # only non-null & blank, no N/A funders @@ -56,6 +57,7 @@ class Contributor < ApplicationRecord scope :needs_award_details, -> { where.not(award_number: [nil, '']).where(award_title: [nil, '']) } scope :updatable, -> { where(auto_update: true) } scope :on_latest_resource, -> { joins(:resource).merge(StashEngine::Resource.latest_per_dataset) } + scope :with_award_numbers, -> { where("award_number <> ''") } ContributorTypes = Datacite::Mapping::ContributorType.map(&:value) @@ -78,9 +80,6 @@ class Contributor < ApplicationRecord enable end - # scopes for contributor - scope :with_award_numbers, -> { where("award_number <> ''") } - def contributor_type_friendly=(type) self.contributor_type = type.to_s.downcase unless type.blank? end diff --git a/app/views/stash_datacite/contributors/_show.html.erb b/app/views/stash_datacite/contributors/_show.html.erb index 855509d223..69aac937be 100644 --- a/app/views/stash_datacite/contributors/_show.html.erb +++ b/app/views/stash_datacite/contributors/_show.html.erb @@ -11,7 +11,7 @@ %><%= contributor.contributor_name_friendly%><%if current_user&.min_app_admin? && contributor.name_identifier_id.blank? %><%end%><% end %><% if contributor.award_number.present? || contributor.award_title.present? %>: <%if contributor.award_number.present? && ror_funder - %><%= contributor.award_number%><% else %><%= contributor.award_number.presence || contributor.award_title %><% end %><% end %><% if contributor.award_description.present? %>, <%= contributor.award_description %><% end %> + %><%= contributor.award_number%><% else %><%= contributor.award_number.presence || contributor.award_title %><% end %><% end %><% if current_user&.min_app_admin? && contributor.api_integration_key.present? && contributor.award_number.blank? %><% end %><% if contributor.award_description.present? %>, <%= contributor.award_description %><% end %> <% end %>