Compare commits

..

1 Commits

5 changed files with 32 additions and 29 deletions

View File

@@ -1,6 +0,0 @@
kind: Feature
body: Add columns for comments linked to an activity in the activity list export
time: 2025-10-29T15:25:10.493968528+01:00
custom:
Issue: "404"
SchemaChange: No schema change

View File

@@ -0,0 +1,6 @@
kind: Fixed
body: 'Fix: export actions and their results in csv even when action does not have any goals attached to it.'
time: 2025-10-29T14:38:36.195220844+01:00
custom:
Issue: "453"
SchemaChange: No schema change

View File

@@ -66,9 +66,6 @@ class ListActivityHelper
->leftJoin('activity.location', 'location')
->addSelect('location.name AS locationName')
->addSelect('activity.sentReceived')
->addSelect('activity.comment.comment AS commentText')
->addSelect('activity.comment.date AS commentDate')
->addSelect('JSON_BUILD_OBJECT(\'uid\', activity.comment.userId, \'d\', activity.comment.date) AS commentUser')
->addSelect('JSON_BUILD_OBJECT(\'uid\', IDENTITY(activity.createdBy), \'d\', activity.createdAt) AS createdBy')
->addSelect('activity.createdAt')
->addSelect('JSON_BUILD_OBJECT(\'uid\', IDENTITY(activity.updatedBy), \'d\', activity.updatedAt) AS updatedBy')
@@ -90,8 +87,6 @@ class ListActivityHelper
'createdAt', 'updatedAt' => $this->dateTimeHelper->getLabel($key),
'createdBy', 'updatedBy' => $this->userHelper->getLabel($key, $values, $key),
'date' => $this->dateTimeHelper->getLabel(self::MSG_KEY.$key),
'commentDate' => $this->dateTimeHelper->getLabel(self::MSG_KEY.'comment_date'),
'commentUser' => $this->userHelper->getLabel($key, $values, self::MSG_KEY.'comment_user'),
'attendeeName' => function ($value) {
if ('_header' === $value) {
return 'Attendee';
@@ -181,9 +176,6 @@ class ListActivityHelper
'usersNames',
'thirdPartiesIds',
'thirdPartiesNames',
'commentText',
'commentDate',
'commentUser',
'createdBy',
'createdAt',
'updatedBy',

View File

@@ -404,9 +404,7 @@ export:
id: Identifiant
List activities linked to an accompanying course: Liste les échanges liés à un parcours en fonction de différents filtres.
List activity linked to a course: Liste des échanges liés à un parcours
commentText: Commentaire
comment_date: Date de la dernière édition du commentaire
comment_user: Dernière édition par
filter:
activity:

View File

@@ -42,28 +42,41 @@ final readonly class SocialActionCSVExportService
$csv->insertOne($headers);
foreach ($actions as $action) {
if ($action->getGoals()->isEmpty() && $action->getResults()->isEmpty() && $action->getEvaluations()->isEmpty()) {
$hasGoals = !$action->getGoals()->isEmpty();
$hasResults = !$action->getResults()->isEmpty();
$hasEvaluations = !$action->getEvaluations()->isEmpty();
// If action has no goals, results, or evaluations, insert a single row
if (!$hasGoals && !$hasResults && !$hasEvaluations) {
$csv->insertOne($this->formatRow($action));
continue;
}
foreach ($action->getGoals() as $goal) {
if ($goal->getResults()->isEmpty()) {
$csv->insertOne($this->formatRow($action, $goal));
}
foreach ($goal->getResults() as $goalResult) {
$csv->insertOne($this->formatRow($action, $goal, $goalResult));
// Process goals and their results
if ($hasGoals) {
foreach ($action->getGoals() as $goal) {
if ($goal->getResults()->isEmpty()) {
$csv->insertOne($this->formatRow($action, $goal));
} else {
foreach ($goal->getResults() as $goalResult) {
$csv->insertOne($this->formatRow($action, $goal, $goalResult));
}
}
}
}
foreach ($action->getResults() as $result) {
if ($result->getGoals()->isEmpty()) {
// Process results that are linked to this action (regardless of whether they have goals elsewhere)
if ($hasResults && !$hasGoals) {
foreach ($action->getResults() as $result) {
$csv->insertOne($this->formatRow($action, null, null, $result));
}
}
foreach ($action->getEvaluations() as $evaluation) {
$csv->insertOne($this->formatRow($action, evaluation: $evaluation));
// Process evaluations
if ($hasEvaluations) {
foreach ($action->getEvaluations() as $evaluation) {
$csv->insertOne($this->formatRow($action, evaluation: $evaluation));
}
}
}