From f011568961d9df8e09e9b4e7c56bd922735a93f1 Mon Sep 17 00:00:00 2001 From: ifirmawan Date: Thu, 14 Nov 2024 20:56:30 +0700 Subject: [PATCH 1/2] [#99] Add country in ParticipantSerializer --- backend/api/v1/v1_sessions/serializers.py | 7 ++++++- .../v1_sessions/tests/tests_participant_list_endpoint.py | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/backend/api/v1/v1_sessions/serializers.py b/backend/api/v1/v1_sessions/serializers.py index d13ad59..f3d793b 100644 --- a/backend/api/v1/v1_sessions/serializers.py +++ b/backend/api/v1/v1_sessions/serializers.py @@ -684,6 +684,7 @@ class ParticipantSerializer(serializers.ModelSerializer): email = serializers.SerializerMethodField() organization_name = serializers.SerializerMethodField() organization_acronym = serializers.SerializerMethodField() + country = serializers.SerializerMethodField() @extend_schema_field(OpenApiTypes.STR) def get_full_name(self, instance: Participant): @@ -701,11 +702,15 @@ def get_organization_name(self, instance: Participant): def get_organization_acronym(self, instance: Participant): return instance.organization.acronym + @extend_schema_field(OpenApiTypes.STR) + def get_country(self, instance: Participant): + return instance.user.country + class Meta: model = Participant fields = [ "id", "full_name", "email", "role", "organization_name", - "organization_acronym", "organization_id" + "organization_acronym", "organization_id", "country" ] diff --git a/backend/api/v1/v1_sessions/tests/tests_participant_list_endpoint.py b/backend/api/v1/v1_sessions/tests/tests_participant_list_endpoint.py index c693e7f..16a389b 100644 --- a/backend/api/v1/v1_sessions/tests/tests_participant_list_endpoint.py +++ b/backend/api/v1/v1_sessions/tests/tests_participant_list_endpoint.py @@ -46,6 +46,7 @@ def test_get_participants_list(self): "organization_name", "organization_acronym", "organization_id", + "country", ] ) self.assertEqual(len(res), pat_session.session_participant.count()) From cedfa8adec0c44fd791888f2033fb48c477a2fc6 Mon Sep 17 00:00:00 2001 From: ifirmawan Date: Thu, 14 Nov 2024 20:59:25 +0700 Subject: [PATCH 2/2] [#99] Add intro text to report & change all step titles --- .../src/components/PrintDocument/PrintPage.js | 75 +++++++++++++++---- 1 file changed, 59 insertions(+), 16 deletions(-) diff --git a/frontend/src/components/PrintDocument/PrintPage.js b/frontend/src/components/PrintDocument/PrintPage.js index 0123755..5ef4155 100644 --- a/frontend/src/components/PrintDocument/PrintPage.js +++ b/frontend/src/components/PrintDocument/PrintPage.js @@ -5,6 +5,7 @@ import dayjs from "dayjs"; import customParseFormat from "dayjs/plugin/customParseFormat"; import PrintTable from "./PrintTable"; import ScoreLegend from "../SessionWizard/ScoreLegend"; +import countryOptions from "../../../i18n/countries.json"; dayjs.extend(customParseFormat); @@ -81,25 +82,69 @@ const PrintPage = ({

PAT session details

-

Participants:

+

+ This report contains the summary of a Power Awareness Tool (PAT) session + in the framework of the partnership{" "} + {patSession?.session_name}.
+
+ The PAT session started on{" "} + {dayjs(patSession?.date, "DD-MM-YYYY").format("dddd, MMM D YYYY")} and + ended on{" "} + {dayjs(patSession?.closed_at, "YYYY-MM-DD").format("dddd, MMM D YYYY")}. +
+
+ The purpose of this session was to have a frank and open-minded + discussion among partner organisations about the way important decisions + are taken and should be taken in this partnership. Read more about the + context of the session below. +
+
+ The partner organisations in this session that were represented by one + or more participants were: +

+ + + + Partner organization (PO) + Acronym (PO) + + + + {patSession?.organizations?.map((o) => { + return ( + + {o?.name} + {o?.acronym} + + ); + })} + + +
Name Role + Country Email address - Partner organization (PO) - Acronym (PO) + + Partner organization (PO) Acronym + {participants?.map((p) => { + const fc = countryOptions.find( + (c) => c?.["alpha-2"] === p?.country + ); + const userCountry = fc?.name || p?.country; return ( {p?.full_name} {p?.role} + {userCountry} {p?.email} - {p?.organization_name} {p?.organization_acronym} ); @@ -118,7 +163,7 @@ const PrintPage = ({

PAT session content

- PAT session Step 1 List important decisions + Step 1 - List important decisions

As a first step in this joint analysis, each participant was asked to come up with at least one important decision taken in the partnership in @@ -142,8 +187,7 @@ const PrintPage = ({

- PAT session Step 2 Determine actual level of participation in decision - making + Step 2 - Determine actual level of participation in decision making

@@ -178,7 +222,7 @@ const PrintPage = ({ const actualValue = d?.scores?.find( (s) => s?.organization_id === o?.id && - (s?.desired === null || s?.desired === false), + (s?.desired === null || s?.desired === false) ); return ( @@ -195,7 +239,7 @@ const PrintPage = ({ ))}

- PAT session Step 3 Reflect actual level of participation in decision + Step 3 - Reflect on the actual level of participation in decision making
@@ -231,7 +275,7 @@ const PrintPage = ({ const actualValue = d?.scores?.find( (s) => s?.organization_id === o?.id && - (s?.desired === null || s?.desired === false), + (s?.desired === null || s?.desired === false) ); return ( @@ -279,7 +323,7 @@ const PrintPage = ({ const actualValue = d?.scores?.find( (s) => s?.organization_id === o?.id && - (s?.desired === null || s?.desired === false), + (s?.desired === null || s?.desired === false) ); return ( @@ -296,7 +340,8 @@ const PrintPage = ({ ))}
- PAT session Step 4 Determine level of participation in decision making + Step 4 - Determine the desired level of participation in decision + making
{groupedOrgPer3?.map((organizations, index) => ( @@ -329,7 +374,7 @@ const PrintPage = ({ {d?.name} {organizations?.map((o) => { const actualValue = d?.scores?.find( - (s) => s?.organization_id === o?.id && s?.desired, + (s) => s?.organization_id === o?.id && s?.desired ); return ( @@ -362,9 +407,7 @@ const PrintPage = ({
- - PAT session Step 5 Determine level of participation in decision making - + Step 5 – Actions to be taken