From 71f8c5e34982257c8490ea11d15e6bd315a7bbcc Mon Sep 17 00:00:00 2001
From: gmurtaza00 <111306331+gmurtaza00@users.noreply.github.com>
Date: Fri, 28 Apr 2023 02:46:51 -0400
Subject: [PATCH] feature: show review count as fraction (#3300)

Visual enhancement of Reviews column in All submission table. Adds a
slash between completed reviews and assigned reviewers.

Closes #3299

---------

Co-authored-by: Chris Zubak-Skees <chriszs@gmail.com>
---
 hypha/apply/funds/tables.py                       |  2 +-
 .../templates/funds/tables/column_reviews.html    | 15 +++++++++------
 hypha/apply/review/templatetags/review_tags.py    |  2 +-
 .../sass/apply/components/_reviews-summary.scss   |  9 +++++++++
 4 files changed, 20 insertions(+), 8 deletions(-)

diff --git a/hypha/apply/funds/tables.py b/hypha/apply/funds/tables.py
index 45a1352f9..90c88a2ea 100644
--- a/hypha/apply/funds/tables.py
+++ b/hypha/apply/funds/tables.py
@@ -132,7 +132,7 @@ class LabeledCheckboxColumn(tables.CheckBoxColumn):
 
 class BaseAdminSubmissionsTable(SubmissionsTable):
     lead = tables.Column(order_by=('lead__full_name',))
-    reviews_stats = tables.TemplateColumn(template_name='funds/tables/column_reviews.html', verbose_name=mark_safe("Reviews<div>Assgn.\tComp.</div>"), orderable=False)
+    reviews_stats = tables.TemplateColumn(template_name='funds/tables/column_reviews.html', verbose_name=mark_safe("Reviews<div>Comp. <span class=\"counts-separator\">/</span> Assgn.</div>"), orderable=False)
     screening_status = tables.Column(verbose_name=_('Screening'), accessor='screening_statuses')
 
     class Meta(SubmissionsTable.Meta):
diff --git a/hypha/apply/funds/templates/funds/tables/column_reviews.html b/hypha/apply/funds/templates/funds/tables/column_reviews.html
index e7c0666c7..1b89d74a3 100644
--- a/hypha/apply/funds/templates/funds/tables/column_reviews.html
+++ b/hypha/apply/funds/templates/funds/tables/column_reviews.html
@@ -3,13 +3,16 @@
 <table class="reviews-summary">
     <tr class="reviews-summary__tr">
         <td class="reviews-summary__td">
-            {% if record.stage.has_external_review %}
-                {{ record.review_count|default:'0' }}
-            {% else %}
-                {{ record.review_staff_count|default:'0' }}
-            {% endif %}
+            <div class="reviews-summary__td-width">
+                {{ record.review_submitted_count|default:'0' }} 
+                <span class="counts-separator">/</span>
+                {% if record.stage.has_external_review %}
+                    {{ record.review_count|default:'0' }}
+                {% else %}
+                    {{ record.review_staff_count|default:'0' }}
+                {% endif %}
+            </div>
         </td>
-        <td class="reviews-summary__td">{{ record.review_submitted_count|default:'0' }}</td>
         <td class="reviews-summary__td">{{ record.review_recommendation|traffic_light }}</td>
     </tr>
 </table>
diff --git a/hypha/apply/review/templatetags/review_tags.py b/hypha/apply/review/templatetags/review_tags.py
index 891c3699f..b240d5ede 100644
--- a/hypha/apply/review/templatetags/review_tags.py
+++ b/hypha/apply/review/templatetags/review_tags.py
@@ -29,7 +29,7 @@ def traffic_light(value):
     try:
         return mark_safe(TRAFFIC_LIGHT_TEMPLATE.format(**TRAFFIC_LIGHT_COLORS[value]))
     except KeyError:
-        return '-'
+        return ''
 
 
 @register.filter
diff --git a/hypha/static_src/src/sass/apply/components/_reviews-summary.scss b/hypha/static_src/src/sass/apply/components/_reviews-summary.scss
index 82005d63b..73d823ad3 100644
--- a/hypha/static_src/src/sass/apply/components/_reviews-summary.scss
+++ b/hypha/static_src/src/sass/apply/components/_reviews-summary.scss
@@ -14,5 +14,14 @@
     &__td {
         padding: 10px;
         vertical-align: middle;
+        text-align: center;
     }
+
+    &__td-width {
+        width: max-content;
+    }
+}
+
+.counts-separator {
+    color: $color--mid-grey;
 }
-- 
GitLab