Skip to content

Commit

Permalink
Fixed participant export title for instructor export
Browse files Browse the repository at this point in the history
  • Loading branch information
marekdedic committed Sep 29, 2023
1 parent 6fbe317 commit 5298ad3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
13 changes: 9 additions & 4 deletions app/model/Export/ExportService.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ public function getNewPage(): string

public function getParticipants(int $aid, string $type = EventType::GENERAL, string $participantType = ParticipatingPerson::PARTICIPANT): string
{
$title = 'Seznam účastníků';
if ($type === EventType::CAMP) {
$templateFile = __DIR__ . '/templates/participantCamp.latte';
$camp = $this->queryBus->handle(new CampQuery(new SkautisCampId($aid)));
Expand All @@ -92,14 +93,17 @@ public function getParticipants(int $aid, string $type = EventType::GENERAL, str
assert($education instanceof Education);
$displayName = $education->getDisplayName();
$unitId = $education->getUnitId();
$list = $participantType === ParticipatingPerson::INSTRUCTOR
? array_map(
if ($participantType === ParticipatingPerson::INSTRUCTOR) {
$title = 'Seznam členů týmu';
$list = array_map(
function (Instructor $instructor): InstructorEnriched {
return $this->queryBus->handle(new EducationInstructorEnrichmentQuery($instructor));
},
$this->queryBus->handle(new EducationInstructorListQuery($education->getId())),
)
: $this->queryBus->handle(new EducationParticipantListQuery($education->getId()));
);
} else {
$list = $this->queryBus->handle(new EducationParticipantListQuery($education->getId()));
}
} else {
$templateFile = __DIR__ . '/templates/participant.latte';
$event = $this->queryBus->handle(new EventQuery(new SkautisEventId($aid)));
Expand All @@ -110,6 +114,7 @@ function (Instructor $instructor): InstructorEnriched {
}

return $this->templateFactory->create($templateFile, [
'title' => $title,
'list' => $list,
'displayName' => $displayName,
'unitFullNameWithAddress' => $this->units->getOfficialUnit($unitId->toInt())->getFullDisplayNameWithAddress(),
Expand Down
2 changes: 1 addition & 1 deletion app/model/Export/templates/participantEducation.latte
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ td {
<div class="smaller">
{$unitFullNameWithAddress}
</div>
<h2>Seznam účastníků - {$displayName}</h2>
<h2>{$title} - {$displayName}</h2>

<table class="all" border="1">
<tr>
Expand Down

0 comments on commit 5298ad3

Please sign in to comment.