diff --git a/app/controllers/stash_engine/user_admin_controller.rb b/app/controllers/stash_engine/user_admin_controller.rb index 80070f9a21..099ded8e02 100644 --- a/app/controllers/stash_engine/user_admin_controller.rb +++ b/app/controllers/stash_engine/user_admin_controller.rb @@ -171,7 +171,7 @@ def setup_tenants end def add_filters - @users = @users.joins(:roles).where(roles: { role: params[:role] }) if params[:role].present? + @users = @users.joins(:roles).where(roles: { role: params[:role] }).distinct if params[:role].present? @users = @users.where(tenant_id: params[:tenant_id]) if params[:tenant_id].present? end diff --git a/app/models/stash_engine/resource.rb b/app/models/stash_engine/resource.rb index bef176e112..748e7d57d7 100644 --- a/app/models/stash_engine/resource.rb +++ b/app/models/stash_engine/resource.rb @@ -857,8 +857,8 @@ def changed_fields(other_resource) changed = [] - changed << 'journal' if journal != other_resource.journal - changed << 'manuscript' if manuscript != other_resource.manuscript + changed << 'journal' if resource_publication&.publication_name != other_resource&.resource_publication&.publication_name + changed << 'manuscript' if resource_publication&.manuscript_number != other_resource&.resource_publication&.manuscript_number changed << 'title' if title != other_resource.title changed.concat(changed_authors(other_resource.authors)) diff --git a/app/views/stash_datacite/resources/_review.html.erb b/app/views/stash_datacite/resources/_review.html.erb index e20d12f2ac..1aadc4b68f 100644 --- a/app/views/stash_datacite/resources/_review.html.erb +++ b/app/views/stash_datacite/resources/_review.html.erb @@ -15,6 +15,13 @@ <%= link_to "Edit Description", stash_url_helpers.metadata_entry_pages_find_or_create_path(resource_id: @resource.id), class: 't-review__edit-button-top o-button__icon-left', role: 'button' %> + <% if highlight_fields.intersect?(['journal', 'manuscript'])%> + <% prev = @resource.previous_curated_resource&.resource_publication %> + <% curr = @resource&.resource_publication %> +

Journal: <%if prev&.publication_name != curr&.publication_name %><%= prev&.publication_name %> <%end%> class="highlight"<%end%>><%= curr&.publication_name %> + Manuscript: <%if prev&.manuscript_number != curr&.manuscript_number %><%= prev&.manuscript_number %> <%end%> class="highlight"<%end%>><%= curr&.manuscript_number %> +

+ <% end %> <%= render partial: "stash_datacite/titles/show", locals: { title: @review.title_str, highlight: highlight_fields.include?('title') } %>
<% author_highlight = highlight_fields[highlight_fields.find_index('authors') + 1] if highlight_fields.include?('authors') %> diff --git a/app/views/stash_engine/resources/prepare_readme.html.erb b/app/views/stash_engine/resources/prepare_readme.html.erb index 0e91bb0dff..67dde4dd04 100644 --- a/app/views/stash_engine/resources/prepare_readme.html.erb +++ b/app/views/stash_engine/resources/prepare_readme.html.erb @@ -34,7 +34,7 @@ fileList: @resource.data_files.map do |f| h = { name: f.upload_file_name } if f.upload_file_name.end_with?('.csv', '.tsv', '.xlsx', '.xls', '.rdata', '.rda', '.mat', '.txt') - h[:variables] = f.upload_file_name.end_with?('.csv', '.tsv') ? f.preview_file.lines.first.chomp.delete_prefix('"').delete_suffix('"').split(Regexp.union([/"?,"?/, /"?\t"?/])) : [] + h[:variables] = f.upload_file_name.end_with?('.csv', '.tsv') && f.preview_file.present? ? f.preview_file.lines.first.chomp.delete_prefix('"').delete_suffix('"').split(Regexp.union([/"?,"?/, /"?\t"?/])) : [] end h end,