Skip to content

Commit

Permalink
Tweak talk sort
Browse files Browse the repository at this point in the history
  • Loading branch information
iansltx committed Aug 10, 2021
1 parent 3791648 commit 318cf7e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
8 changes: 4 additions & 4 deletions app/src/Event/EventScheduler.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,11 @@ public function getEventDays($talks)
protected function organiseTalksByDayAndTime($talks)
{
$talksByDay = [];

usort($talks, function (TalkEntity $a, TalkEntity $b) {
return $a->getTracks() && $b->getTracks()
? strcasecmp($b->getTracks()[0]->track_uri, $a->getTracks()[0]->track_uri)
: $b['id'] <=> $a['id'];
return $b->getStartDateTime() <=> $a->getStartDateTime() ?:
($a->getTracks() && $b->getTracks()
? strcasecmp($a->getTracks()[0]->track_uri, $b->getTracks()[0]->track_uri)
: $a['id'] <=> $b['id']);
});

foreach ($talks as $talk) {
Expand Down
6 changes: 6 additions & 0 deletions app/src/Talk/TalkApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,12 @@ public function getAgenda($talksUri)

$agenda = [];

usort($talks, function (TalkEntity $a, TalkEntity $b) {
return $b->getStartDateTime() <=> $a->getStartDateTime() ?:
($a->getTracks() && $b->getTracks()
? strcasecmp($a->getTracks()[0]->track_uri, $b->getTracks()[0]->track_uri)
: $a['id'] <=> $b['id']);
});
foreach ($talks as $talk) {
$date = $talk->getStartDateTime()->format("Y-m-d");
$startTime = $talk->getStartDateTime()->format("H:i");
Expand Down

0 comments on commit 318cf7e

Please sign in to comment.