Skip to content

Commit

Permalink
fix date list properties population helper
Browse files Browse the repository at this point in the history
  • Loading branch information
syphax-bouazzouni committed Nov 26, 2023
1 parent ac0d71b commit 3961e14
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ GIT

GIT
remote: https://github.com/ontoportal-lirmm/ontologies_linked_data.git
revision: 4c7dfa80a8bb4a7d8cfb7ad1fc8a1a88e420e59e
revision: a199eff007f5d7f18205d61194f3823445aa6460
branch: development
specs:
ontologies_linked_data (0.0.1)
Expand Down
5 changes: 4 additions & 1 deletion helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,10 @@ def populate_from_params(obj, params)
value = retrieved_values
elsif attribute_settings && attribute_settings[:enforce] && attribute_settings[:enforce].include?(:date_time)
# TODO: Remove this awful hack when obj.class.model_settings[:range][attribute] contains DateTime class
value = DateTime.parse(value)
is_array = value.is_a?(Array)
value = Array(value).map{ |v| DateTime.parse(v) }
value = value.first unless is_array
value
elsif attribute_settings && attribute_settings[:enforce] && attribute_settings[:enforce].include?(:uri) && attribute_settings[:enforce].include?(:list)
# in case its a list of URI, convert all value to IRI
value = value.map { |v| RDF::IRI.new(v) }
Expand Down

0 comments on commit 3961e14

Please sign in to comment.