From 07de5eead717dc00ac7ab1947ccf549a05f2d952 Mon Sep 17 00:00:00 2001
From: pabois <pierreandre.boissinot@noesya.coop>
Date: Mon, 31 Jan 2022 17:36:10 +0100
Subject: [PATCH] gestion des dates dans magazine

---
 app/models/research/journal/volume.rb                        | 4 ++--
 ...31163458_change_research_journal_volume_published_type.rb | 5 +++++
 db/schema.rb                                                 | 4 ++--
 3 files changed, 9 insertions(+), 4 deletions(-)
 create mode 100644 db/migrate/20220131163458_change_research_journal_volume_published_type.rb

diff --git a/app/models/research/journal/volume.rb b/app/models/research/journal/volume.rb
index 2fd9f3340..9365b6774 100644
--- a/app/models/research/journal/volume.rb
+++ b/app/models/research/journal/volume.rb
@@ -8,7 +8,7 @@
 #  keywords            :text
 #  number              :integer
 #  published           :boolean          default(FALSE)
-#  published_at        :date
+#  published_at        :datetime
 #  slug                :string
 #  title               :string
 #  created_at          :datetime         not null
@@ -47,7 +47,7 @@ class Research::Journal::Volume < ApplicationRecord
   end
 
   def git_path(website)
-    "content/volumes/#{published_at.year}/#{published_at.strftime "%Y-%m-%d"}-#{slug}.html" if published_at
+    "content/volumes/#{published_at.year}/#{slug}/_index.html" if published_at
   end
 
   def git_dependencies(website)
diff --git a/db/migrate/20220131163458_change_research_journal_volume_published_type.rb b/db/migrate/20220131163458_change_research_journal_volume_published_type.rb
new file mode 100644
index 000000000..6ac77d363
--- /dev/null
+++ b/db/migrate/20220131163458_change_research_journal_volume_published_type.rb
@@ -0,0 +1,5 @@
+class ChangeResearchJournalVolumePublishedType < ActiveRecord::Migration[6.1]
+  def change
+    change_column :research_journal_volumes, :published_at, :datetime
+  end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 07bcc70df..c2d823d76 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -10,7 +10,7 @@
 #
 # It's strongly recommended that you check this file into your version control system.
 
-ActiveRecord::Schema.define(version: 2022_01_28_111528) do
+ActiveRecord::Schema.define(version: 2022_01_31_163458) do
 
   # These are extensions that must be enabled in order to support this database
   enable_extension "pgcrypto"
@@ -435,7 +435,7 @@ ActiveRecord::Schema.define(version: 2022_01_28_111528) do
     t.uuid "research_journal_id", null: false
     t.string "title"
     t.integer "number"
-    t.date "published_at"
+    t.datetime "published_at"
     t.datetime "created_at", precision: 6, null: false
     t.datetime "updated_at", precision: 6, null: false
     t.text "description"
-- 
GitLab