Skip to content

Commit

Permalink
Populate NGO name in email with evaluation results
Browse files Browse the repository at this point in the history
  • Loading branch information
cipick committed May 10, 2023
1 parent fe573a4 commit f2eb0dd
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions server/src/api/evaluation/controllers/evaluation.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ module.exports = createCoreController(
`${acc}<h3>Intrebare: ${matrixQuiz.question}</h3><p>Raspuns: ${
matrixQuiz[
`option_${
dimensions[dimensionIndex]?.quiz[quizIndex]?.answer + 1
+dimensions[dimensionIndex]?.quiz[quizIndex]?.answer + 1
}`
]
}</p>`,
Expand All @@ -74,10 +74,20 @@ module.exports = createCoreController(
);
try {
const email = response?.data?.attributes?.email;
if (email)
const evaluation = await strapi.entityService.findOne(
"api::evaluation.evaluation",
response.data.id,
{
populate: "report.user",
}
);
if (email) {
await sendMailToUserWhenEvaluationIsFinished(email, {
content: mailHtml,
content: mailHtml, // TODO: legacy
EVALUATION_RESULTS: mailHtml,
ONG_NAME: evaluation?.report?.user?.ongName,
});
}
} catch (err) {
console.log(err);
}
Expand Down

1 comment on commit f2eb0dd

@vercel
Copy link

@vercel vercel bot commented on f2eb0dd May 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.