From 0709414a2508c5a94056a28478ecec9133cf1204 Mon Sep 17 00:00:00 2001
From: Bryan Brancotte <bryan.brancotte@pasteur.fr>
Date: Fri, 28 Feb 2025 10:31:15 +0100
Subject: [PATCH] Indicate more that review assignation will not delete already
 done reviews

---
 doc/configure_instance.rst                       |  5 ++++-
 .../strass_app/locale/en/LC_MESSAGES/django.po   |  9 +++++++++
 .../strass_app/locale/fr/LC_MESSAGES/django.po   | 10 ++++++++++
 .../templates/strass_app/review_allocation.html  |  1 +
 src/strass/strass_app/views.py                   | 16 ++++++++++++++++
 5 files changed, 40 insertions(+), 1 deletion(-)

diff --git a/doc/configure_instance.rst b/doc/configure_instance.rst
index 5c52e5de..721e5ec2 100644
--- a/doc/configure_instance.rst
+++ b/doc/configure_instance.rst
@@ -396,7 +396,10 @@ Assign reviewers, again
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 Link: https://strass-master.dev.pasteur.cloud/setup/review/overview/
 
-You can still assign and re-assign reviewers. A reviewer can be automatically unassigned if zhe was not manually assigned and have not started yet to provide a review
+.. note::
+    You can re-run reviewers assignation **without risk** of data loss.
+
+You can still assign and re-assign reviewers. A reviewer can be automatically unassigned only if zhe was not manually assigned and have not started yet to provide a review. Reviews that have been already started are kept.
 
 **Use case: new conflicts of interest**
 
diff --git a/src/strass/strass_app/locale/en/LC_MESSAGES/django.po b/src/strass/strass_app/locale/en/LC_MESSAGES/django.po
index 6798b567..c5af561a 100644
--- a/src/strass/strass_app/locale/en/LC_MESSAGES/django.po
+++ b/src/strass/strass_app/locale/en/LC_MESSAGES/django.po
@@ -2840,6 +2840,15 @@ msgstr ""
 "automatically assigned. Any review that is either manually assigned or "
 "already answered by the author will be kept."
 
+msgid "ComputeAutoReviewView information about"
+msgstr ""
+"When re-running assignation data loss is prevented. Any review that is "
+"either manually assigned or already answered by the author will be kept, i.e "
+"a reviewer will not be unsigned if zhe have started to review.<br/>Re-"
+"running the assignation is useful when new reviewers arrive or new conflicts "
+"of interest declared, see <a href=\"/doc/configure_instance.html#assign-"
+"reviewers-again\" target=\"_blank\">documentation</a> for more."
+
 msgid "MassMailingWizard.Prepare.title"
 msgstr "Preparing the mass mailing"
 
diff --git a/src/strass/strass_app/locale/fr/LC_MESSAGES/django.po b/src/strass/strass_app/locale/fr/LC_MESSAGES/django.po
index f88d736d..171655e2 100644
--- a/src/strass/strass_app/locale/fr/LC_MESSAGES/django.po
+++ b/src/strass/strass_app/locale/fr/LC_MESSAGES/django.po
@@ -2969,6 +2969,16 @@ msgstr ""
 "vides et assignées automatiquement. Une review qui est donc soit "
 "manuellement assignée, soit déjà remplie sera gardée."
 
+msgid "ComputeAutoReviewView information about"
+msgstr ""
+"Vous ne pouvez pas perdre de donnée en relançant l'assignation. Toutes les "
+"reviews attribuées manuellement ou déjà commencées seront conservées. En "
+"d'autre terme un(e) reviewer ne sera pas dé-assigné d'un candidat si iel à "
+"commencé à écrire la review.<br/>Relancer l'assignation est utile en cas de "
+"nouveau reviewer, ou de nouveau conflit d'intérêt, voir la <a href=\"/doc/"
+"configure_instance.html#assign-reviewers-again\" "
+"target=\"_blank\">documentation</a>."
+
 msgid "MassMailingWizard.Prepare.title"
 msgstr "Préparer le message"
 
diff --git a/src/strass/strass_app/templates/strass_app/review_allocation.html b/src/strass/strass_app/templates/strass_app/review_allocation.html
index 5f4d10ca..4081e723 100644
--- a/src/strass/strass_app/templates/strass_app/review_allocation.html
+++ b/src/strass/strass_app/templates/strass_app/review_allocation.html
@@ -41,6 +41,7 @@
      data-target="#modalForm"
      data-modal-title="{%trans 'Automatized allocation of reviewer'%}"
      data-modal-submit="{%trans 'Compute automatic allocation'%}"
+     data-modal-css-class="modal-dialog modal-lg"
   ><i class="fa fa-cogs"></i> {%trans "Compute automatic allocation" %}...</a>
 </div>
 {% endblock page_title_right%}
diff --git a/src/strass/strass_app/views.py b/src/strass/strass_app/views.py
index f0f9dd23..945b7fc9 100644
--- a/src/strass/strass_app/views.py
+++ b/src/strass/strass_app/views.py
@@ -2102,6 +2102,22 @@ class ReviewAllocationFormView(mixins.OnlyJuryManagerMixin, ModalFormMixin, Form
     success_url = reverse_lazy('strass:review-allocation')
     form_class = forms.ReviewPerCandidateForm
 
+    def get_form(self, form_class=None):
+        form = super().get_form()
+        helper = FormHelper()
+        helper.form_tag = False
+        helper.layout = layout.Layout(
+            layout.HTML('<p>' + gettext("ComputeAutoReviewView information about") + '</p>'),
+            'stage',
+            'count',
+            'match',
+            'reviewer_groups',
+            'candidate_groups',
+            'refused_candidate_groups',
+        )
+        form.helper = helper
+        return form
+
     def form_valid(self, form):
         review_allocation.compute_allocation(
             min_review_per_candidate=form.cleaned_data["count"],
-- 
GitLab