Skip to content

Commit

Permalink
[Trainings] adds event dates in presences
Browse files Browse the repository at this point in the history
  • Loading branch information
Elorfin committed Feb 28, 2024
1 parent 313b495 commit d3414b0
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 5 deletions.
23 changes: 20 additions & 3 deletions src/plugin/cursus/Finder/EventPresenceFinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,22 +111,39 @@ public function configureQueryBuilder(QueryBuilder $qb, array $searches = [], ar
break;

case 'session':
if (!$eventJoin) {
$qb->join('obj.event', 'e');
}
if (!$sessionJoin) {
$qb->join('e.session', 's');
}
$qb->orderBy('s.name', $sortByDirection);
break;

case 'event':
if (!$sessionJoin) {
$qb->join('e.session', 's');
}

$qb->orderBy('e.name', $sortByDirection);
break;

case 'startDate':
if (!$eventJoin) {
$qb->join('obj.event', 'e');
}

if (!$sessionJoin) {
$qb->join('e.session', 's');
$qb->join('e.plannedObject', 'po');
$qb->orderBy('po.startDate', $sortByDirection);
break;

case 'endDate':
if (!$eventJoin) {
$qb->join('obj.event', 'e');
}

$qb->orderBy('e.name', $sortByDirection);
$qb->join('e.plannedObject', 'po');
$qb->orderBy('po.endDate', $sortByDirection);
break;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,28 @@ const EventsPresences = (props) =>
type: 'training_event',
label: trans('session_event', {}, 'cursus'),
displayed: true
}, {
name: 'event.start',
alias: 'startDate',
type: 'date',
label: trans('start_date'),
displayed: true,
options: {
time: true
}
}, {
name: 'event.end',
alias: 'endDate',
type: 'date',
label: trans('end_date'),
options: {
time: true
},
displayed: true
}, {
name: 'session',
type: 'training_session',
label: trans('session', {}, 'cursus'),
displayed: true
label: trans('session', {}, 'cursus')
}
]}
/>
Expand Down

0 comments on commit d3414b0

Please sign in to comment.