Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,14 @@ export default function SuppPreview({resource, previous, curator}) {
</span>
</>
)}
{curator && ['NIH', 'NSF'].includes(funder.api_integration_key) && !funder.award_number && (
<i
className="fas fa-circle-exclamation unmatched-icon"
role="note"
aria-label="Missing award number"
title={`Award number missing for ${funder.api_integration_key} funder`}
/>
)}
{!funder.award_number && previous && prev?.award_number && <del>prev.award_number</del>}
{funder.award_description && (
<>:{' '}
Expand Down
5 changes: 2 additions & 3 deletions app/models/stash_datacite/contributor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)

Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion app/views/stash_datacite/contributors/_show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
%><span><%= contributor.contributor_name_friendly%><%if current_user&.min_app_admin? && contributor.name_identifier_id.blank? %><i class="fas fa-triangle-exclamation unmatched-icon" role="note" aria-label="Unmatched funder" title="Unmatched funder"></i><%end%></span><%
end
%><% if contributor.award_number.present? || contributor.award_title.present? %>: <span><%if contributor.award_number.present? && ror_funder
%><a href="<%= new_search_path(funder: contributor.name_identifier_id, award: contributor.award_number) %>"><%= contributor.award_number%></a><% else %><%= contributor.award_number.presence || contributor.award_title %><% end %></span><% end %><% if contributor.award_description.present? %>, <span><%= contributor.award_description %></span><% end %>
%><a href="<%= new_search_path(funder: contributor.name_identifier_id, award: contributor.award_number) %>"><%= contributor.award_number%></a><% else %><%= contributor.award_number.presence || contributor.award_title %><% end %></span><% end %><% if current_user&.min_app_admin? && contributor.api_integration_key.present? && contributor.award_number.blank? %><i class="fas fa-circle-exclamation unmatched-icon" role="note" aria-label="Missing award number" title="Award number missing for <%= contributor.api_integration_key %> funder"></i><% end %><% if contributor.award_description.present? %>, <span><%= contributor.award_description %></span><% end %>
</li>
<% end %>
</ul>
Expand Down