mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-09-10 15:14:33 +08:00
Add last_modified evaluation for PIO import
This commit is contained in:
parent
87d5e5029a
commit
2c8a7f8eca
2 changed files with 8 additions and 1 deletions
|
@ -155,6 +155,13 @@ module ProtocolsIoHelper
|
|||
text.map { |auth| auth['name'] }.join(', ')
|
||||
end
|
||||
|
||||
def eval_last_modified(steps)
|
||||
timestamps = steps.map do |step|
|
||||
step['modified_on'] if step['modified_on'].present?
|
||||
end
|
||||
Time.at(timestamps.max).utc.to_datetime
|
||||
end
|
||||
|
||||
# Checks so that null values are returned as zero length strings
|
||||
# Did this so views arent as ugly (i avoid using if present statements)
|
||||
def not_null(attribute)
|
||||
|
|
|
@ -59,7 +59,7 @@
|
|||
<div class="col-xs-4">
|
||||
<label><%= t('protocols.import_export.import_modal.updated_at_label') %></label>
|
||||
|
||||
<% display_last_modified=Time.at(not_null(@json_object['last_modified']).to_i) %>
|
||||
<% display_last_modified=eval_last_modified(@json_object['steps']) %>
|
||||
<%= f.text_field :last_modified, :value =>
|
||||
display_last_modified.to_s,readonly: true, class:
|
||||
"form-control" %>
|
||||
|
|
Loading…
Add table
Reference in a new issue