From bd315d8b08dffd721dc70e86ef5d743f8d99e474 Mon Sep 17 00:00:00 2001
From: George Katsikas <giorgakis.katsikas@gmail.com>
Date: Wed, 19 Jul 2023 17:43:43 +0300
Subject: [PATCH] block actions for streams waiting offer acceptance

---
 .../production/management/commands/advance_git_repos.py   | 1 +
 scipost_django/production/models.py                       | 8 ++++++++
 .../production/_hx_productionstream_details.html          | 5 +++--
 3 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/scipost_django/production/management/commands/advance_git_repos.py b/scipost_django/production/management/commands/advance_git_repos.py
index 6212b7c38..77bec1252 100644
--- a/scipost_django/production/management/commands/advance_git_repos.py
+++ b/scipost_django/production/management/commands/advance_git_repos.py
@@ -498,6 +498,7 @@ class Command(BaseCommand):
         # Create the repos
         repos_to_be_created = repos.filter(
             status=ProofsRepository.PROOFS_REPO_UNINITIALIZED
+            stream__in_stasis=False
         )
         for repo in repos_to_be_created:
             try:
diff --git a/scipost_django/production/models.py b/scipost_django/production/models.py
index 1e52ef4eb..2f36ed8cd 100644
--- a/scipost_django/production/models.py
+++ b/scipost_django/production/models.py
@@ -16,6 +16,7 @@ from django.db.models.functions import Concat
 from django.conf import settings
 
 from common.utils import latinise
+from submissions.models.decision import EditorialDecision
 
 from .constants import (
     PRODUCTION_STREAM_STATUS,
@@ -128,6 +129,13 @@ class ProductionStream(models.Model):
     def completed(self):
         return self.status == PRODUCTION_STREAM_COMPLETED
 
+    @cached_property
+    def in_stasis(self):
+        return (
+            self.submission.editorial_decision.status
+            == EditorialDecision.AWAITING_PUBOFFER_ACCEPTANCE
+        )
+
     @property
     def latest_activity(self):
         if self.events.last():
diff --git a/scipost_django/production/templates/production/_hx_productionstream_details.html b/scipost_django/production/templates/production/_hx_productionstream_details.html
index a4977aae4..51c8a3792 100644
--- a/scipost_django/production/templates/production/_hx_productionstream_details.html
+++ b/scipost_django/production/templates/production/_hx_productionstream_details.html
@@ -1,5 +1,6 @@
-<details id="productionstream-{{ productionstream.id }}-details"
-         class="border border-2 mx-3 p-2 bg-primary bg-opacity-10">
+<details id="productionstream-{{ productionstream.id }}-details" class="border border-2 mx-3 p-2 bg-primary bg-opacity-10 
+  {% if productionstream.in_stasis %}bg-opacity-25 bg-secondary pe-none{% endif %}
+   ">
   <summary class="list-none">
     {% include "production/_productionstream_details_summary_contents.html" with productionstream=productionstream %}
   </summary>
-- 
GitLab