From 8e947fbd15d9892ee5e686cf0a01e7c793c6fab9 Mon Sep 17 00:00:00 2001 From: Chiara Dinan Date: Thu, 19 Oct 2023 10:20:37 +0100 Subject: [PATCH] PC-505: Add new GBIS feedback questions --- help_to_heat/frontdoor/schemas.py | 68 +++++-- help_to_heat/frontdoor/views.py | 34 +++- help_to_heat/locale/cy/LC_MESSAGES/django.mo | Bin 79510 -> 80604 bytes help_to_heat/locale/cy/LC_MESSAGES/django.po | 175 +++++++++++------- help_to_heat/portal/download_views.py | 18 +- help_to_heat/templates/frontdoor/base.html | 1 - .../templates/frontdoor/feedback.html | 100 ++++++---- static/feedback.css | 44 ----- tests/test_frontdoor.py | 107 +++++++++-- 9 files changed, 367 insertions(+), 180 deletions(-) delete mode 100644 static/feedback.css diff --git a/help_to_heat/frontdoor/schemas.py b/help_to_heat/frontdoor/schemas.py index 664b122a..06aee38d 100644 --- a/help_to_heat/frontdoor/schemas.py +++ b/help_to_heat/frontdoor/schemas.py @@ -598,30 +598,76 @@ "value": "No loft", }, ) -multichoice_options = ( +agreement_multichoice_options = ( { - "value": "Completely disagree", - "label": _("Completely disagree"), + "value": "Completely agree", + "label": _("Completely agree"), }, { - "value": "Disagree", - "label": _("Disagree"), + "value": "Agree", + "label": _("Agree"), }, { "value": "Neutral", "label": _("Neutral"), }, { - "value": "Agree", - "label": _("Agree"), + "value": "Disagree", + "label": _("Disagree"), }, { - "value": "Completely agree", - "label": _("Completely agree"), + "value": "Completely disagree", + "label": _("Completely disagree"), + }, +) + +satisfaction_multichoice_options = ( + { + "value": "Very satisfied", + "label": _("Very satisfied"), + }, + { + "value": "Somewhat satisfied", + "label": _("Somewhat satisfied"), + }, + { + "value": "Neither satisfied nor dissatisfied", + "label": _("Neither satisfied nor dissatisfied"), + }, + { + "value": "Somewhat dissatisfied", + "label": _("Somewhat dissatisfied"), + }, + { + "value": "Very dissatisfied", + "label": _("Very dissatisfied"), + }, +) + +service_usage_multichoice_options = ( + { + "value": "To find ways to reduce my energy bills", + "label": _("To find ways to reduce my energy bills"), + }, + { + "value": "To find ways to reduce my carbon emissions", + "label": _("To find ways to reduce my carbon emissions"), + }, + { + "value": "To find ways to install a specific measure in my home", + "label": _("To find ways to install a specific measure in my home"), + }, + { + "value": "To find ways to improve my EPC rating", + "label": _("To find ways to improve my EPC rating"), + }, + { + "value": "To find ways to make my home more comfortable", + "label": _("To find ways to make my home more comfortable"), }, { - "value": "Not sure / not applicable", - "label": _("Not sure / not applicable"), + "value": "Other", + "label": _("Other"), }, ) diff --git a/help_to_heat/frontdoor/views.py b/help_to_heat/frontdoor/views.py index 36349094..52575c4c 100644 --- a/help_to_heat/frontdoor/views.py +++ b/help_to_heat/frontdoor/views.py @@ -725,24 +725,46 @@ def get_context(self, session_id, *args, **kwargs): class FeedbackView(utils.MethodDispatcher): - def get(self, request, session_id=None, page_name=None): + def get(self, request, session_id=None, page_name=None, errors=None): template_name = "frontdoor/feedback.html" prev_page_url = page_name and reverse("frontdoor:page", kwargs=dict(session_id=session_id, page_name=page_name)) context = { "session_id": session_id, "page_name": page_name, "prev_url": prev_page_url, - "multichoice_options": schemas.multichoice_options, + "multichoice_options_agreement": schemas.agreement_multichoice_options, + "multichoice_options_satisfaction": schemas.satisfaction_multichoice_options, + "multichoice_options_service_usage": schemas.service_usage_multichoice_options, + "errors": errors, } return render(request, template_name=template_name, context=context) def post(self, request, session_id=None, page_name=None): data = request.POST.dict() - interface.api.feedback.save_feedback(session_id, page_name, data) - if session_id and page_name: - return redirect("frontdoor:feedback-thanks", session_id=session_id, page_name=page_name) + errors = self.validate(data) + if errors: + return self.get(request, session_id, page_name, errors=errors) + else: + interface.api.feedback.save_feedback(session_id, page_name, data) + if session_id and page_name: + return redirect("frontdoor:feedback-thanks", session_id=session_id, page_name=page_name) + + else: + return redirect("frontdoor:feedback-thanks") + + def validate(self, data): + if ( + (not data.get("satisfaction")) + and (not data.get("usage-reason")) + and (not data.get("guidance")) + and (not data.get("accuracy")) + and (not data.get("advice")) + and (data.get("more-detail") == "") + ): + errors = True + return errors else: - return redirect("frontdoor:feedback-thanks") + return None def feedback_thanks_view(request, session_id=None, page_name=None): diff --git a/help_to_heat/locale/cy/LC_MESSAGES/django.mo b/help_to_heat/locale/cy/LC_MESSAGES/django.mo index f658a0494488be165153a8821ec84e366594bc1e..0bbdce3f30b708bbc5a9df5471d7154536bc6f39 100644 GIT binary patch delta 12370 zcmajl2Y3|K+Q9KMDTEq2gaF9|2%XRc0qLO^>Ah^Sn`C86*i8rv#05k^su&R|3L?^r z-l(xr6h(@NpojvZAXf!MDWb@|>i2)=Os?MYJl{ON`JMO7?97={W;Vg6u1B4}6BWKt zDQcx+yJIL-3*RlT)N>I^c@m{osT+-yYKk|pHYPOI$92LK@-ZlfF2oYJ6*u7?T#mz= zC{>elUq%PHYNpg!NW)mA!fG#tdQ^OX)$t}KV=2zg0jfFHz|I(rqp>bdL}}1mY>68% z4o{(+=NjfJ3I8wa%3 z7kU!qLc1^<-$N7cYok<29ED|ZGWyVqId~q+;E=ZT7}r-5C`g49t6?_spIX3=p12o> zVZ?n(Rl<>24&7J*^Kb+%#L{@duD^nn$?suBjBTesZ=#&9HHHUJSU{mXeuA-h8T;UE zq?c4Dxi3P(^v(+K*e2vDn$m8A~i0=$JX z<}-Te=fX0S<+}qD@gz!*-o*J>jv3t-pTtaA{}(9KrlMD>9vdf07e0j2^>Z)*S6~vp zh|-W#I0gTS8HQ3>y_8~QsS~|*gQFO)TI3aR5T>BqP(Jp@%{YMTt6LPdQPG8FNtax~ zJy^4!zQ8e*J8j3OKt77A(y8hdl*#=Iw#HV2^`y=~ zH`iAODdc0b2bFphcVK1isO1p798-ttJ0FhC*+0$BHzSV*br_|qf4A!shUrPx6{ROf zqs#$6(%EVr%1|G{a59CTC}d##aJ^#=a&5H}WoUlKidc)MjN~auZ>s@V3JXwX^E0+Z zwkNR!_17>BZ=uYk5llEaPufWOUuNZOD%#>QY=iIOEc_Lvfzw9mNAo(YL;f7b$Z;5f zA7CXsVb@18Ff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GtI3kf4k}8|M%CYvN`Yzq6#sT zV2v@C-`*TPk@5r_iDm!K>3ztymEFoI}K1Do9c^JyKmsH$F$kvnSK>0B7j#eqg476WeC|`wA_!fo_~%7#8<>etS=Q;JKhd^&zgZ0DFaiK$k7RmvX{wFtfhncD_S zNzPg2&nPdZ+!nhM%PEHt8I*me`12%51L8fRJo#|qSwgl*;%Vyt-uU)pZmamaj`B(( zllYpv9+nVA`Vdu$Yl#iS+k|X8HEJ%$-F|%hHKxK%G_nq8Vp#@XrG7k7fsk#tMhzgZ zOL?qSFV(9l?;tJ_FA-a*yDmG}8WMx3t4KHr`Tr08*`zDd$)3PDR&5yNrzyLzl#nfl zIB%8T#Za?W|6|j3s~ltPe}>#kxg{PT4iWEI`~FRNu-w0+RdJ89Y+sUZ(na&D^IKL~ zn907&#Ir;N@^3JaSV8%H;s_zzLn4IeA_?1z8uNXfltVe^ZNgWRg=)?XR=J#!q z>Lfvgoj63u_JHs!xzn^kwUU{g;sT3L_j)Zh(UWh>%u7kPIXt!kPoB-5=5;!4`L5h_ zTW-43mXmAGb!Ixm>7DFKaoX~7oT+&kwp5ST zmf^H}-7a^UoRXJoOXEDRTdq<3V@@3-rnp7o(2})@e^n_tII6%1_2k-e^1M!4tj$f) zo|Tp1O0g$rI7_;W8DkVL9s8ih8{QrFd!d?wPbkZo1o^ z~WY+pX~JJc-%a;+{Ny7+1-*9 zxNS}s!-#jwbtcD@9Jtn}a!Iq_pAA`bCeYZpeR(D0NT_d=yqCk_Om*`@E|1v=kF|^2 z6>T$HE6?psFUV&s=1bcpJKY`!x3GKvw;8z}( diff --git a/help_to_heat/locale/cy/LC_MESSAGES/django.po b/help_to_heat/locale/cy/LC_MESSAGES/django.po index 3f1d036b..229ed8ce 100644 --- a/help_to_heat/locale/cy/LC_MESSAGES/django.po +++ b/help_to_heat/locale/cy/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-10-19 09:28+0000\n" +"POT-Creation-Date: 2023-10-25 12:01+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -382,46 +382,86 @@ msgid "Bulb, now part of Octopus Energy" msgstr "Bulb, sydd bellach yn rhan o Octopus" #: help_to_heat/frontdoor/schemas.py:604 -msgid "Completely disagree" -msgstr "Anghytuno'n llwyr" +msgid "Completely agree" +msgstr "Cytuno'n llwyr" #: help_to_heat/frontdoor/schemas.py:608 -msgid "Disagree" -msgstr "Anghytuno" +msgid "Agree" +msgstr "Cytuno" #: help_to_heat/frontdoor/schemas.py:612 msgid "Neutral" msgstr "Niwtral" #: help_to_heat/frontdoor/schemas.py:616 -msgid "Agree" -msgstr "Cytuno" +msgid "Disagree" +msgstr "Anghytuno" #: help_to_heat/frontdoor/schemas.py:620 -msgid "Completely agree" -msgstr "Cytuno'n llwyr" +msgid "Completely disagree" +msgstr "Anghytuno'n llwyr" + +#: help_to_heat/frontdoor/schemas.py:627 +msgid "Very satisfied" +msgstr "Bodlon iawn" + +#: help_to_heat/frontdoor/schemas.py:631 +msgid "Somewhat satisfied" +msgstr "Eithaf bodlon" + +#: help_to_heat/frontdoor/schemas.py:635 +msgid "Neither satisfied nor dissatisfied" +msgstr "Ddim yn fodlon nac yn anfodlon" + +#: help_to_heat/frontdoor/schemas.py:639 +msgid "Somewhat dissatisfied" +msgstr "Eithaf anfodlon" + +#: help_to_heat/frontdoor/schemas.py:643 +msgid "Very dissatisfied" +msgstr "Anfodlon iawn" + +#: help_to_heat/frontdoor/schemas.py:650 +msgid "To find ways to reduce my energy bills" +msgstr "Dod o hyd i ffyrdd i leihau fy miliau ynni" + +#: help_to_heat/frontdoor/schemas.py:654 +msgid "To find ways to reduce my carbon emissions" +msgstr "Dod o hyd i ffyrdd i leihau fy allyriadau carbon" + +#: help_to_heat/frontdoor/schemas.py:658 +msgid "To find ways to install a specific measure in my home" +msgstr "Dod o hyd i ffyrdd o osod mesur penodol yn fy nghartref" + +#: help_to_heat/frontdoor/schemas.py:662 +msgid "To find ways to improve my EPC rating" +msgstr "Dod o hyd i ffyrdd i wella fy sgôr EPC" + +#: help_to_heat/frontdoor/schemas.py:666 +msgid "To find ways to make my home more comfortable" +msgstr "Dod o hyd i ffyrdd i wneud fy nghartref yn fwy cyffyrddus" -#: help_to_heat/frontdoor/schemas.py:624 -msgid "Not sure / not applicable" -msgstr "Ansicr / Amherthnasol" +#: help_to_heat/frontdoor/schemas.py:670 +msgid "Other" +msgstr "Arall" -#: help_to_heat/frontdoor/schemas.py:657 +#: help_to_heat/frontdoor/schemas.py:703 msgid "Please enter a valid UK postcode" msgstr "Rhowch god post dilys yn y Deyrnas Unedig" -#: help_to_heat/frontdoor/schemas.py:693 +#: help_to_heat/frontdoor/schemas.py:739 msgid "Invalid contact number" msgstr "Rhif ffôn annilys" -#: help_to_heat/frontdoor/schemas.py:701 +#: help_to_heat/frontdoor/schemas.py:747 msgid "Invalid email format" msgstr "Fformat ebost annilys" -#: help_to_heat/frontdoor/schemas.py:712 +#: help_to_heat/frontdoor/schemas.py:758 msgid "Energy Company Obligation 4" msgstr "Rhwymedigaeth Cwmni Ynni 4" -#: help_to_heat/frontdoor/schemas.py:713 +#: help_to_heat/frontdoor/schemas.py:759 msgid "Great British Insulation Scheme" msgstr "Cynllun Inswleiddio Mawr Prydain" @@ -545,7 +585,7 @@ msgstr "" "roi tic yn y blwch hwn" #: help_to_heat/templates/allauth/account/base.html:103 -#: help_to_heat/templates/frontdoor/base.html:183 +#: help_to_heat/templates/frontdoor/base.html:182 #: help_to_heat/templates/portal/base_generic_gov.html:164 msgid "©Crown copyright" msgstr "©Hawlfraint y Goron" @@ -587,7 +627,7 @@ msgstr "" "Inswleiddio Mawr Prydain - GOV.UK" #: help_to_heat/templates/frontdoor/accessibility-statement.html:11 -#: help_to_heat/templates/frontdoor/base.html:164 +#: help_to_heat/templates/frontdoor/base.html:163 msgid "Accessibility Statement" msgstr "Datganiad Hygyrchedd" @@ -908,11 +948,11 @@ msgstr "" msgid "Great British Insulation Scheme - GOV.UK" msgstr "Cynllun Inswleiddio Mawr Prydain - GOV.UK" -#: help_to_heat/templates/frontdoor/base.html:38 +#: help_to_heat/templates/frontdoor/base.html:37 msgid "Cookies we are using on our service" msgstr "Cwcis rydyn ni'n eu defnyddio ar ein gwasanaeth" -#: help_to_heat/templates/frontdoor/base.html:41 +#: help_to_heat/templates/frontdoor/base.html:40 msgid "" "We will use necessary cookies when you use this service to help you move " "around the site." @@ -920,7 +960,7 @@ msgstr "" "Byddwn yn defnyddio cwcis angenrheidiol wrth ichi ddefnyddio'r gwasanaeth " "yma, a hynny i'ch helpu i symud o amgylch y wefan." -#: help_to_heat/templates/frontdoor/base.html:44 +#: help_to_heat/templates/frontdoor/base.html:43 msgid "" "We will also use analytic cookies using Google Analytics to tell us how you " "got to our service, the pages you visit, and how long you spent on them. " @@ -935,55 +975,55 @@ msgstr "" "caniatáu i Google ddefnyddio na rhannu'r data am sut rydych chi'n " "defnyddio'r wefan yma ac mae'r data'n cael ei storio'n ddienw." -#: help_to_heat/templates/frontdoor/base.html:53 +#: help_to_heat/templates/frontdoor/base.html:52 msgid "Accept cookies" msgstr "Derbyn cwcis" -#: help_to_heat/templates/frontdoor/base.html:54 +#: help_to_heat/templates/frontdoor/base.html:53 msgid "Reject cookies" msgstr "Gwrthod cwcis" -#: help_to_heat/templates/frontdoor/base.html:55 +#: help_to_heat/templates/frontdoor/base.html:54 msgid "View cookies we use on this service" msgstr "Gweld y cwcis rydyn ni'n eu defnyddio ar y gwasanaeth yma" -#: help_to_heat/templates/frontdoor/base.html:62 +#: help_to_heat/templates/frontdoor/base.html:61 msgid "Skip to main content" msgstr "Neidio i'r prif gynnwys" -#: help_to_heat/templates/frontdoor/base.html:89 +#: help_to_heat/templates/frontdoor/base.html:88 msgid "Check eligibility for Great British Insulation Scheme" msgstr "Gwirio'ch Cymhwystra ar gyfer Cynllun Inswleiddio Mawr Prydain" -#: help_to_heat/templates/frontdoor/base.html:102 +#: help_to_heat/templates/frontdoor/base.html:101 msgid "This is a new service – your " msgstr "Gwasanaeth newydd yw hwn – bydd eich " -#: help_to_heat/templates/frontdoor/base.html:104 +#: help_to_heat/templates/frontdoor/base.html:103 msgid "feedback" msgstr "adborth" -#: help_to_heat/templates/frontdoor/base.html:104 +#: help_to_heat/templates/frontdoor/base.html:103 msgid " will help us to improve it." msgstr " yn ein helpu i'w wella." -#: help_to_heat/templates/frontdoor/base.html:154 +#: help_to_heat/templates/frontdoor/base.html:153 msgid "Support links" msgstr "Dolenni cymorth" -#: help_to_heat/templates/frontdoor/base.html:159 +#: help_to_heat/templates/frontdoor/base.html:158 msgid "Privacy Policy" msgstr "Polisi Preifatrwydd" -#: help_to_heat/templates/frontdoor/base.html:174 +#: help_to_heat/templates/frontdoor/base.html:173 msgid "All content is available under the " msgstr "Mae'r cynnwys i gyd ar gael o dan " -#: help_to_heat/templates/frontdoor/base.html:176 +#: help_to_heat/templates/frontdoor/base.html:175 msgid "Open Government Licence v3.0" msgstr "Drwydded Llywodraeth Agored v3.0" -#: help_to_heat/templates/frontdoor/base.html:177 +#: help_to_heat/templates/frontdoor/base.html:176 msgid ", except where otherwise stated" msgstr ", ac eithrio lle nodir fel arall" @@ -1477,49 +1517,60 @@ msgstr "" msgid "Help us improve the service" msgstr "Helpwch ni i wella'r gwasanaeth" -#: help_to_heat/templates/frontdoor/feedback.html:23 -msgid "" -"I found this service useful for learning about government energy efficiency " -"support." -msgstr "" -"Roedd y gwasanaeth yma’n fuddiol imi ddysgu am gymorth effeithlonrwydd " -"ynni'r llywodraeth." +#: help_to_heat/templates/frontdoor/feedback.html:22 +#: help_to_heat/templates/macros.html:77 +msgid "There is a problem" +msgstr "Mae yna broblem" #: help_to_heat/templates/frontdoor/feedback.html:27 -#: help_to_heat/templates/frontdoor/feedback.html:45 -#: help_to_heat/templates/frontdoor/feedback.html:64 -msgid "How much do you agree with the statement above?" -msgstr "I ba raddau rydych chi'n cytuno â'r gosodiad uchod?" +msgid "Please answer at least one question before submitting feedback" +msgstr "Atebwch o leiaf un cwestiwn cyn cyflwyno adborth" + +#: help_to_heat/templates/frontdoor/feedback.html:40 +msgid "Overall, how satisfied are you with this online service?" +msgstr "Yn gyffredinol, pa mor fodlon rydych chi â'r gwasanaeth ar-lein yma?" -#: help_to_heat/templates/frontdoor/feedback.html:41 +#: help_to_heat/templates/frontdoor/feedback.html:53 +msgid "Why did you use this service today?" +msgstr "Pam defnyddioch chi'r gwasanaeth yma heddiw?" + +#: help_to_heat/templates/frontdoor/feedback.html:66 msgid "" "I had sufficient detail or guidance on every page to proceed to the next " "step." msgstr "" -"Roedd digon o fanylion neu ganllawiau imi ar bob tudalen i symud ymlaen i'r " +"Fe ges i ddigon o fanylion neu arweiniad ar bob tudalen i symud ymlaen i'r " "cam nesaf." -#: help_to_heat/templates/frontdoor/feedback.html:60 +#: help_to_heat/templates/frontdoor/feedback.html:70 +#: help_to_heat/templates/frontdoor/feedback.html:86 +#: help_to_heat/templates/frontdoor/feedback.html:102 +msgid "To what extent do you agree with the above statement?" +msgstr "I ba raddau rydych chi'n cytuno â'r gosodiad uchod?" + +#: help_to_heat/templates/frontdoor/feedback.html:82 msgid "" "I was able to answer all questions accurately, to the best of my knowledge." msgstr "" "Roeddwn i'n gallu ateb pob cwestiwn yn gywir, hyd eithaf fy ngwybodaeth." -#: help_to_heat/templates/frontdoor/feedback.html:76 -msgid "" -"While using our service, was there any specific aspect of this service that " -"you believe can be improved?" -msgstr "" -"Wrth ddefnyddio’n gwasanaeth ni, oedd unrhyw agwedd benodol ar y gwasanaeth " -"rydych chi’n credu bod modd ei gwella?" +#: help_to_heat/templates/frontdoor/feedback.html:98 +msgid "I received the advice I was looking for." +msgstr "Fe ges i’r cyngor roeddwn i’n chwilio amdano." -#: help_to_heat/templates/frontdoor/feedback.html:80 +#: help_to_heat/templates/frontdoor/feedback.html:114 +msgid "How could we improve the service?" +msgstr "Sut gallen ni wella'r gwasanaeth?" + +#: help_to_heat/templates/frontdoor/feedback.html:118 msgid "" -"Please do not include any personal or financial information in your response." +"Do not include any personal or financial information, for example your " +"National Insurance or credit card numbers." msgstr "" -"Peidiwch â chynnwys unrhyw wybodaeth bersonol neu ariannol yn eich ymateb." +"Peidiwch â chynnwys unrhyw faterion personol na gwybodaeth ariannol, er " +"enghraifft eich rhif Yswiriant Gwladol neu rifau cardiau credyd." -#: help_to_heat/templates/frontdoor/feedback.html:86 +#: help_to_heat/templates/frontdoor/feedback.html:124 msgid "Send feedback" msgstr "Anfon adborth" @@ -2965,10 +3016,6 @@ msgstr "" msgid "Continue" msgstr "Parhau" -#: help_to_heat/templates/macros.html:77 -msgid "There is a problem" -msgstr "Mae yna broblem" - #: help_to_heat/templates/macros.html:104 msgid "Change" msgstr "Newid" diff --git a/help_to_heat/portal/download_views.py b/help_to_heat/portal/download_views.py index ea1955ab..34a0c5ef 100644 --- a/help_to_heat/portal/download_views.py +++ b/help_to_heat/portal/download_views.py @@ -77,9 +77,11 @@ feedback_column_headings = ( "page_name", - "useful_for_learning", - "sufficient_guidance", - "able_to_answer", + "satisfaction_level", + "service_usage_reason", + "sufficient_detail_or_guidance", + "able_to_answer_accurately", + "received_desired_advice", "improvement_comment", "submission_date", "submission_time", @@ -160,7 +162,7 @@ def handle_create_spreadsheet_request(request, creator): @require_http_methods(["GET"]) @decorators.requires_service_manager def download_feedback_view(request): - feedbacks = frontdoor_models.Feedback.objects.all() + feedbacks = frontdoor_models.Feedback.objects.all().order_by("created_at") downloaded_at = timezone.now() file_name = downloaded_at.strftime("%d-%m-%Y %H_%M") new_feedback_download = frontdoor_models.FeedbackDownload.objects.create( @@ -276,9 +278,11 @@ def match_rows_for_feedback(feedback): row = dict(feedback.data) row = { **row, - "useful_for_learning": row.get("how-much", "Unanswered"), - "sufficient_guidance": row.get("guidance-detail", "Unanswered"), - "able_to_answer": row.get("accuracy-detail", "Unanswered"), + "satisfaction_level": row.get("satisfaction", "Unanswered"), + "service_usage_reason": row.get("usage-reason", "Unanswered"), + "sufficient_detail_or_guidance": row.get("guidance", "Unanswered"), + "able_to_answer_accurately": row.get("accuracy", "Unanswered"), + "received_desired_advice": row.get("advice", "Unanswered"), "improvement_comment": row["more-detail"], "page_name": page_name, "submission_date": created_at.date(), diff --git a/help_to_heat/templates/frontdoor/base.html b/help_to_heat/templates/frontdoor/base.html index 48ed2328..f76d056e 100644 --- a/help_to_heat/templates/frontdoor/base.html +++ b/help_to_heat/templates/frontdoor/base.html @@ -22,7 +22,6 @@ - diff --git a/help_to_heat/templates/frontdoor/feedback.html b/help_to_heat/templates/frontdoor/feedback.html index 3ff3d3b2..012b1d7c 100644 --- a/help_to_heat/templates/frontdoor/feedback.html +++ b/help_to_heat/templates/frontdoor/feedback.html @@ -12,72 +12,110 @@ {% endif %}

{{_("Help us improve the service")}}

-
+ {{csrf_input}} + {% if errors %} +
+
+

+ {{_("There is a problem")}} +

+ +
+
+ {% endif %} + +
+
+ +

+ +

+
+ {{macros.radios('satisfaction', multichoice_options_satisfaction, data={}, errors={})}} +
+
+ +
+
+ +

+ +

+
+ {{macros.radios('usage-reason', multichoice_options_service_usage, data={}, errors={})}} +
+
+
-

-

+
+ {{_("To what extent do you agree with the above statement?")}}
- - {{macros.radios('how-much', multichoice_options, data={}, errors={})}} - + {{macros.radios('guidance', multichoice_options_agreement, data={}, errors={})}}
-

-

+
+ {{_("To what extent do you agree with the above statement?")}}
-
- - {{macros.radios('guidance-detail', multichoice_options, data={}, errors={})}} - + {{macros.radios('accuracy', multichoice_options_agreement, data={}, errors={})}}
-

-

+
+ {{_("To what extent do you agree with the above statement?")}}
- {{macros.radios('accuracy-detail', multichoice_options, data={}, errors={})}} + {{macros.radios('advice', multichoice_options_agreement, data={}, errors={})}}
-

+

-

+
- {{_("Please do not include any personal or financial information in your response.")}} + {{_("Do not include any personal or financial information, for example your National Insurance or credit card numbers.")}}
diff --git a/static/feedback.css b/static/feedback.css deleted file mode 100644 index 85bdbb57..00000000 --- a/static/feedback.css +++ /dev/null @@ -1,44 +0,0 @@ -@media (min-width: 40.0625em) { - form#feedback .govuk-radios { - display: flex; - } - form#feedback .govuk-radios .govuk-radios__item { - display: flex; - flex: 1; - flex-direction: column; - padding-left: 0; - } - - form#feedback .govuk-radios__label:before { - top: auto; - bottom: 0; - left: 35%; - } - - form#feedback .govuk-radios__input:checked + .govuk-radios__label:after { - opacity: 1; - } - - form#feedback .govuk-radios__label:after { - content: ""; - position: absolute; - top: auto; - bottom: 10px; - left: calc(35% + 10px); - width: 0; - height: 0; - border: 10px solid; - border-radius: 50%; - opacity: 0; - background: currentcolor; - } - - form#feedback .govuk-radios__label { - margin-bottom: 40px; - flex: 1; - align-items: center; - text-align: center; - justify-content: center; - display: flex; - } -} diff --git a/tests/test_frontdoor.py b/tests/test_frontdoor.py index 2acca35e..47ec094c 100644 --- a/tests/test_frontdoor.py +++ b/tests/test_frontdoor.py @@ -667,20 +667,24 @@ def test_feedback_no_session(): page = page.follow() page = page.click(contains="feedback") form = page.get_form() - form["how-much"] = "Agree" - form["guidance-detail"] = "Completely disagree" - form["accuracy-detail"] = "Disagree" - form["more-detail"] = "Blah, blah, blah" + form["satisfaction"] = "Somewhat satisfied" + form["usage-reason"] = "To find ways to reduce my energy bills" + form["guidance"] = "Agree" + form["accuracy"] = "Neutral" + form["advice"] = "Agree" + form["more-detail"] = "Improvement comment" page = form.submit().follow() assert page.has_one("h1:contains('Thank you for your feedback')") assert not page.all("a:contains('Back')") feedback = frontdoor_models.Feedback.objects.latest("created_at") - assert feedback.data["how-much"] == "Agree" - assert feedback.data["guidance-detail"] == "Completely disagree" - assert feedback.data["accuracy-detail"] == "Disagree" - assert feedback.data["more-detail"] == "Blah, blah, blah" + assert feedback.data["satisfaction"] == "Somewhat satisfied" + assert feedback.data["usage-reason"] == "To find ways to reduce my energy bills" + assert feedback.data["guidance"] == "Agree" + assert feedback.data["accuracy"] == "Neutral" + assert feedback.data["advice"] == "Agree" + assert feedback.data["more-detail"] == "Improvement comment" def test_feedback_with_session(): @@ -703,19 +707,90 @@ def test_feedback_with_session(): page = page.click(contains="feedback") form = page.get_form() - form["how-much"] = "Agree" - form["guidance-detail"] = "Completely disagree" - form["accuracy-detail"] = "Disagree" - form["more-detail"] = "Blah, blah, blah" + form["satisfaction"] = "Somewhat satisfied" + form["usage-reason"] = "To find ways to reduce my energy bills" + form["guidance"] = "Agree" + form["accuracy"] = "Neutral" + form["advice"] = "Agree" + form["more-detail"] = "Improvement comment" + + page = form.submit().follow() + + assert page.has_one("h1:contains('Thank you for your feedback')") + + feedback = frontdoor_models.Feedback.objects.latest("created_at") + assert feedback.data["satisfaction"] == "Somewhat satisfied" + assert feedback.data["usage-reason"] == "To find ways to reduce my energy bills" + assert feedback.data["guidance"] == "Agree" + assert feedback.data["accuracy"] == "Neutral" + assert feedback.data["advice"] == "Agree" + assert feedback.data["more-detail"] == "Improvement comment" + + feedback_session_id = page.path.split("/")[3] + assert uuid.UUID(feedback_session_id) + + page = page.click(contains="Return to your application") + assert page.has_one("h1:contains('Do you own the property?')") + + +def test_feedback_validation_with_session_no_answers(): + client = utils.get_client() + page = client.get("/start") + page = page.follow() + + session_id = page.path.split("/")[1] + assert uuid.UUID(session_id) + + form = page.get_form() + form["country"] = "Scotland" + page = form.submit().follow() + + form = page.get_form() + form["supplier"] = "Utilita" + page = form.submit().follow() + + assert page.has_one("h1:contains('Do you own the property?')") + + page = page.click(contains="feedback") + form = page.get_form() + + page = form.submit() + + assert page.has_one("h1:contains('Help us improve the service')") + assert page.has_one("h2:contains('There is a problem')") + assert page.has_one("a:contains('Please answer at least one question before submitting feedback')") + + +def test_feedback_validation_with_session_two_answers(): + client = utils.get_client() + page = client.get("/start") + page = page.follow() + + session_id = page.path.split("/")[1] + assert uuid.UUID(session_id) + + form = page.get_form() + form["country"] = "Scotland" + page = form.submit().follow() + + form = page.get_form() + form["supplier"] = "Utilita" + page = form.submit().follow() + + assert page.has_one("h1:contains('Do you own the property?')") + + page = page.click(contains="feedback") + form = page.get_form() + form["satisfaction"] = "Somewhat satisfied" + form["more-detail"] = "Improvement comment" + page = form.submit().follow() assert page.has_one("h1:contains('Thank you for your feedback')") feedback = frontdoor_models.Feedback.objects.latest("created_at") - assert feedback.data["how-much"] == "Agree" - assert feedback.data["guidance-detail"] == "Completely disagree" - assert feedback.data["accuracy-detail"] == "Disagree" - assert feedback.data["more-detail"] == "Blah, blah, blah" + assert feedback.data["satisfaction"] == "Somewhat satisfied" + assert feedback.data["more-detail"] == "Improvement comment" feedback_session_id = page.path.split("/")[3] assert uuid.UUID(feedback_session_id)