From be861eb6edfddde4737e332e5872265eba9642e4 Mon Sep 17 00:00:00 2001
From: Syphax bouazzouni <gs_bouazzouni@esi.dz>
Date: Sun, 26 Nov 2023 07:45:52 +0100
Subject: [PATCH] fix date list properties population helper

---
 .github/workflows/docker-image.yml | 2 +-
 Gemfile.lock                       | 2 +-
 helpers/application_helper.rb      | 5 ++++-
 3 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml
index 0368c3ac..1f82c680 100644
--- a/.github/workflows/docker-image.yml
+++ b/.github/workflows/docker-image.yml
@@ -47,7 +47,7 @@ jobs:
         uses: docker/build-push-action@v4
         with:
           context: .
-          platforms: linux/amd64, linux/arm64
+          platforms: linux/amd64
           build-args: |
             RUBY_VERSION=2.7.8
           push: true
diff --git a/Gemfile.lock b/Gemfile.lock
index 9875b7fc..1381b423 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -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)
diff --git a/helpers/application_helper.rb b/helpers/application_helper.rb
index 172170fa..d90630a3 100644
--- a/helpers/application_helper.rb
+++ b/helpers/application_helper.rb
@@ -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) }