From 0f52b9bd8c8fae247108fdeadcf9d12e515ace38 Mon Sep 17 00:00:00 2001
From: George Katsikas <giorgakis.katsikas@gmail.com>
Date: Wed, 25 Oct 2023 14:43:25 +0200
Subject: [PATCH] change git repo creation behavior

---
 .../management/commands/advance_git_repos.py          | 11 +++++++++++
 scipost_django/production/models.py                   |  2 +-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/scipost_django/production/management/commands/advance_git_repos.py b/scipost_django/production/management/commands/advance_git_repos.py
index 42da5e382..a9dad63fb 100644
--- a/scipost_django/production/management/commands/advance_git_repos.py
+++ b/scipost_django/production/management/commands/advance_git_repos.py
@@ -583,6 +583,12 @@ class Command(BaseCommand):
             status=ProofsRepository.PROOFS_REPO_TEMPLATE_ONLY
         )
         for repo in repos_to_be_formatted:
+            if repo.journal_abbrev == "MigPol":
+                # We cannot format the skeleton of MigPol because it is not a LaTeX file
+                repo.status = ProofsRepository.PROOFS_REPO_TEMPLATE_FORMATTED
+                repo.save()
+                continue
+
             try:
                 self._format_skeleton(repo)
                 repo.status = ProofsRepository.PROOFS_REPO_TEMPLATE_FORMATTED
@@ -604,6 +610,11 @@ class Command(BaseCommand):
                     self._copy_arxiv_source_files(repo)
                     repo.status = ProofsRepository.PROOFS_REPO_PRODUCTION_READY
                     repo.save()
+                else:
+                    # We cannot automatically copy the source files of non-arXiv submissions
+                    repo.status = ProofsRepository.PROOFS_REPO_PRODUCTION_READY
+                    repo.save()
+
             except Exception as e:
                 self.stdout.write(
                     self.style.ERROR(
diff --git a/scipost_django/production/models.py b/scipost_django/production/models.py
index 14c75506d..522519e69 100644
--- a/scipost_django/production/models.py
+++ b/scipost_django/production/models.py
@@ -372,7 +372,7 @@ class ProofsRepository(models.Model):
         if proceedings_issue := self.stream.submission.proceedings:
             return "{journal}/{year}/{conference}".format(
                 journal=self.journal_abbrev,
-                year=self.stream.submission.proceedings.event_end_date.year,
+                year=proceedings_issue.event_end_date.year,
                 conference=proceedings_issue.event_suffix.replace(" ", ""),
             )
         else:
-- 
GitLab