From d4be86c2d340ecbbaaef8d0d8d6a3b991d3b80d7 Mon Sep 17 00:00:00 2001
From: Arnaud Levy <contact@arnaudlevy.com>
Date: Thu, 19 Jan 2023 18:54:28 +0100
Subject: [PATCH] fix paper and volume path

---
 app/models/research/journal/paper.rb  | 4 ++--
 app/models/research/journal/volume.rb | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/app/models/research/journal/paper.rb b/app/models/research/journal/paper.rb
index 9761f41a4..bf7e587d7 100644
--- a/app/models/research/journal/paper.rb
+++ b/app/models/research/journal/paper.rb
@@ -67,7 +67,7 @@ class Research::Journal::Paper < ApplicationRecord
   scope :ordered, -> { order(published_at: :desc, created_at: :desc) }
 
   def git_path(website)
-    "#{git_path_content_prefix(website)}papers/#{published_at.year}/#{published_at.strftime "%Y-%m-%d"}-#{slug}.html" if (volume.nil? || volume.published_at) && published_at
+    "#{git_path_content_prefix(website)}papers/#{published_at.year}#{path}.html" if published_at
   end
 
   def template_static
@@ -89,7 +89,7 @@ class Research::Journal::Paper < ApplicationRecord
   end
 
   def path
-    "/#{slug}"
+    "/#{published_at.strftime "%Y-%m-%d"}-#{slug}" if published_at
   end
 
   protected
diff --git a/app/models/research/journal/volume.rb b/app/models/research/journal/volume.rb
index 7954879f6..2779adf14 100644
--- a/app/models/research/journal/volume.rb
+++ b/app/models/research/journal/volume.rb
@@ -54,7 +54,7 @@ class Research::Journal::Volume < ApplicationRecord
   end
 
   def git_path(website)
-    "#{git_path_content_prefix(website)}volumes/#{published_at.year}/#{slug}/_index.html" if published_at
+    "#{git_path_content_prefix(website)}volumes/#{published_at.year}#{path}/_index.html" if published_at
   end
 
   def template_static
@@ -77,7 +77,7 @@ class Research::Journal::Volume < ApplicationRecord
   end
 
   def path
-    "/#{published_at&.year}/#{slug}" if published_at
+    "/#{published_at&.year}-#{slug}" if published_at
   end
 
   def to_s
-- 
GitLab