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
23 changes: 14 additions & 9 deletions app/helpers/deepblue/json_logger_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,7 @@ def form_params_to_update_attribute_key_values( curation_concern:,
end
next unless has_old_value
if value.is_a? Array
if value.blank?
value = nil
elsif [''] == value
value = nil
elsif 1 < value.size
value.pop if '' == value.last
end
value = handle_array_value(value)
end
# old_value = curation_concern[key]
new_value = nil
Expand All @@ -116,6 +110,17 @@ def form_params_to_update_attribute_key_values( curation_concern:,
attr_key_values
end

def handle_array_value (array)
if array.blank?
array = nil
elsif array == ['']
array = nil
elsif array.size > 1
array.pop if '' == array.last
end
array
end

def logger_initialize_key_values( user_email:, event_note:, **added_key_values )
key_values = { user_email: user_email }
key_values.merge!( event_note: event_note ) if event_note.present?
Expand Down Expand Up @@ -190,11 +195,11 @@ def system_as_current_user
end

def timestamp_now
Time.now.to_formatted_s(:db )
Deepblue::LoggingHelper.timestamp_now
end

def timestamp_zone
DeepBlueDocs::Application.config.timezone_zone
Deepblue::LoggingHelper.timestamp_zone
end

def to_log_format_timestamp( timestamp )
Expand Down
Loading