From 20de87d86772e08d7f78fccfc2b79b0a13ac2742 Mon Sep 17 00:00:00 2001
From: Todd Dembrey <todd.dembrey@torchbox.com>
Date: Tue, 28 Aug 2018 16:41:54 +0100
Subject: [PATCH] Add comments block to the hidden fields

---
 opentech/apply/review/views.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/opentech/apply/review/views.py b/opentech/apply/review/views.py
index a287d9159..72a7127e6 100644
--- a/opentech/apply/review/views.py
+++ b/opentech/apply/review/views.py
@@ -9,7 +9,7 @@ from wagtail.core.blocks import RichTextBlock
 
 from opentech.apply.activity.messaging import messenger, MESSAGES
 from opentech.apply.funds.models import ApplicationSubmission
-from opentech.apply.review.blocks import RecommendationBlock
+from opentech.apply.review.blocks import RecommendationBlock, RecommendationCommentsBlock
 from opentech.apply.review.forms import ReviewModelForm
 from opentech.apply.stream_forms.models import BaseStreamForm
 from opentech.apply.users.decorators import staff_required
@@ -122,6 +122,9 @@ class ReviewListView(ListView):
         self.queryset = self.model.objects.filter(submission=self.submission, is_draft=False)
         return super().get_queryset()
 
+    def should_display(self, field):
+        return not isinstance(field.block, (RecommendationBlock, RecommendationCommentsBlock, RichTextBlock))
+
     def get_context_data(self, **kwargs):
         review_data = {}
 
@@ -148,7 +151,7 @@ class ReviewListView(ListView):
             for field_id in review.fields:
                 field = review.field(field_id)
                 data = review.data(field_id)
-                if not isinstance(field.block, (RecommendationBlock, RichTextBlock)):
+                if self.should_display(field):
                     question = field.value['field_label']
                     review_data.setdefault(field.id, {'question': question, 'answers': [''] * responses})
                     review_data[field.id]['answers'][i] = field.block.render(None, {'data': data})
-- 
GitLab