Skip to content

Commit

Permalink
correct submitted date display for datasets before processing status …
Browse files Browse the repository at this point in the history
…existed
  • Loading branch information
ahamelers committed Jul 31, 2024
1 parent c1f864c commit 17ac877
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
10 changes: 7 additions & 3 deletions app/controllers/stash_engine/admin_dashboard_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,13 @@ def add_fields

def date_fields
if @filters[:submit_date]&.values&.any?(&:present?)
@datasets = @datasets.joins(:process_date).select('stash_engine_process_dates.processing as submit_date')
@datasets = @datasets.joins(:process_date).select(
'IFNULL(stash_engine_process_dates.processing, stash_engine_process_dates.submitted) as submit_date'
)
elsif @sort == 'submit_date'
@datasets = @datasets.left_outer_joins(:process_date).select('stash_engine_process_dates.processing as submit_date')
@datasets = @datasets.left_outer_joins(:process_date).select(
'IFNULL(stash_engine_process_dates.processing, stash_engine_process_dates.submitted) as submit_date'
)
end
return unless @sort == 'first_pub_date' || @filters[:first_pub_date]&.values&.any?(&:present?)

Expand Down Expand Up @@ -220,7 +224,7 @@ def date_filters
"stash_engine_curation_activities.updated_at #{date_string(@filters[:updated_at])}"
) unless @filters[:updated_at].nil? || @filters[:updated_at].values.all?(&:blank?)
@datasets = @datasets.where(
"stash_engine_process_dates.processing #{date_string(@filters[:submit_date])}"
"IFNULL(stash_engine_process_dates.processing, stash_engine_process_dates.submitted) #{date_string(@filters[:submit_date])}"
) unless @filters[:submit_date].nil? || @filters[:submit_date].values.all?(&:blank?)
if %w[first_sub_date queue_date].include?(@sort) || @filters[:first_sub_date]&.values&.any?(&:present?)
filter_on = @filters[:first_sub_date]&.values&.any?(&:present?)
Expand Down
2 changes: 1 addition & 1 deletion app/views/stash_engine/admin_dashboard/_table_row.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
</td>
<% end %>
<% if @fields.include?('submit_date') %>
<td class="c-lined-table__digits"><%= formatted_datetime(dataset.process_date.processing) %></td>
<td class="c-lined-table__digits"><%= formatted_datetime(dataset.process_date.processing || dataset.process_date.submitted) %></td>
<% end %>
<% if @fields.include?('first_sub_date') %>
<td class="c-lined-table__digits"><%= formatted_datetime(dataset.identifier.process_date.processing || dataset.identifier.process_date.submitted) %></td>
Expand Down
2 changes: 1 addition & 1 deletion app/views/stash_engine/admin_dashboard/results.csv.erb
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ head += ',First queued' if @fields.include?('queue_date')
row << dpc
end
row << dataset.last_curation_activity.updated_at if @fields.include?('updated_at')
row << dataset.process_date.processing if @fields.include?('submit_date')
row << dataset.process_date.processing || dataset.process_date.submitted if @fields.include?('submit_date')
row << dataset.identifier.process_date.processing || dataset.identifier.process_date.submitted if @fields.include?('first_sub_date')
row << dataset.publication_date if @fields.include?('publication_date')
row << dataset.identifier.publication_date if @fields.include?('first_pub_date')
Expand Down

0 comments on commit 17ac877

Please sign in to comment.