Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/99 finetune report text 2 #117

Merged
merged 2 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion backend/api/v1/v1_sessions/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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"
]


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
75 changes: 59 additions & 16 deletions frontend/src/components/PrintDocument/PrintPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -81,25 +82,69 @@ const PrintPage = ({
</div>
<div style={{ breakAfter: "page" }}></div>
<h3 style={style.title}>PAT session details</h3>
<p>Participants:</p>
<p>
This report contains the summary of a Power Awareness Tool (PAT) session
in the framework of the partnership{" "}
<strong>{patSession?.session_name}</strong>.<br />
<br />
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")}.
<br />
<br />
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.
<br />
<br />
The partner organisations in this session that were represented by one
or more participants were:
</p>
<PrintTable>
<thead>
<tr>
<PrintTable.TH>Partner organization (PO)</PrintTable.TH>
<PrintTable.TH>Acronym (PO)</PrintTable.TH>
</tr>
</thead>
<tbody>
{patSession?.organizations?.map((o) => {
return (
<tr key={o?.id}>
<PrintTable.TD>{o?.name}</PrintTable.TD>
<PrintTable.TD>{o?.acronym}</PrintTable.TD>
</tr>
);
})}
</tbody>
</PrintTable>
<br />
<PrintTable>
<thead>
<tr>
<PrintTable.TH>Name</PrintTable.TH>
<PrintTable.TH>Role</PrintTable.TH>
<PrintTable.TH>Country</PrintTable.TH>
<PrintTable.TH>Email address</PrintTable.TH>
<PrintTable.TH>Partner organization (PO)</PrintTable.TH>
<PrintTable.TH>Acronym (PO)</PrintTable.TH>
<PrintTable.TH width="100">
Partner organization (PO) Acronym
</PrintTable.TH>
</tr>
</thead>
<tbody>
{participants?.map((p) => {
const fc = countryOptions.find(
(c) => c?.["alpha-2"] === p?.country
);
const userCountry = fc?.name || p?.country;
return (
<tr key={p?.id}>
<PrintTable.TD>{p?.full_name}</PrintTable.TD>
<PrintTable.TD>{p?.role}</PrintTable.TD>
<PrintTable.TD>{userCountry}</PrintTable.TD>
<PrintTable.TD>{p?.email}</PrintTable.TD>
<PrintTable.TD>{p?.organization_name}</PrintTable.TD>
<PrintTable.TD>{p?.organization_acronym}</PrintTable.TD>
</tr>
);
Expand All @@ -118,7 +163,7 @@ const PrintPage = ({
</PrintTable>
<div style={{ breakAfter: "page" }}></div>
<h3 style={style.title}>PAT session content</h3>
<strong>PAT session Step 1 List important decisions</strong>
<strong>Step 1 - List important decisions</strong>
<p>
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
Expand All @@ -142,8 +187,7 @@ const PrintPage = ({
<br />
<div style={{ paddingTop: 24 }}>
<strong>
PAT session Step 2 Determine actual level of participation in decision
making
Step 2 - Determine actual level of participation in decision making
</strong>
</div>
<p>
Expand Down Expand Up @@ -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 (
<PrintTable.TD key={`${d?.id}-${o?.id}`}>
Expand All @@ -195,7 +239,7 @@ const PrintPage = ({
))}
<div style={{ paddingTop: 24 }}>
<strong>
PAT session Step 3 Reflect actual level of participation in decision
Step 3 - Reflect on the actual level of participation in decision
making
</strong>
</div>
Expand Down Expand Up @@ -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 (
<PrintTable.TD key={`${d?.id}-${o?.id}`}>
Expand Down Expand Up @@ -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 (
<PrintTable.TD key={`${d?.id}-${o?.id}`}>
Expand All @@ -296,7 +340,8 @@ const PrintPage = ({
))}
<div style={{ paddingTop: 24 }}>
<strong>
PAT session Step 4 Determine level of participation in decision making
Step 4 - Determine the desired level of participation in decision
making
</strong>
</div>
{groupedOrgPer3?.map((organizations, index) => (
Expand Down Expand Up @@ -329,7 +374,7 @@ const PrintPage = ({
<PrintTable.TD>{d?.name}</PrintTable.TD>
{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 (
<PrintTable.TD key={`${d?.id}-${o?.id}`}>
Expand Down Expand Up @@ -362,9 +407,7 @@ const PrintPage = ({
</div>
<br />
<div style={{ paddingTop: 24 }}>
<strong>
PAT session Step 5 Determine level of participation in decision making
</strong>
<strong>Step 5 – Actions to be taken</strong>
</div>

<p>
Expand Down