Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TMS-1010: Fix events-lift component sorting with recurring events #490

Merged
merged 3 commits into from
Jan 31, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.MD
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

- TMS-1010: Fix events-lift component sorting with recurring events

## [1.54.3] - 2023-12-04

- TMS-939:
Expand Down
13 changes: 6 additions & 7 deletions lib/Formatters/EventzFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,13 @@ public function format( array $layout ) : array {
return $layout;
}

if ( ! empty( $layout['manual_event_categories'] ) ) {
// Sort events by start datetime objects.
usort( $events, function( $a, $b ) {
return $a['start_date_raw'] <=> $b['start_date_raw'];
} );
// Sort events by start datetime objects.
usort( $events, function( $a, $b ) {
return $a['start_date_raw'] <=> $b['start_date_raw'];
} );

$events = array_slice( $events, 0, $layout['page_size'] );
}
// Show selected amount of events
$events = array_slice( $events, 0, $layout['page_size'] );
Copy link
Contributor

@Liblastic Liblastic Jan 25, 2024

Choose a reason for hiding this comment

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

Mietin iha arkkitehtuurisesti et querytetaanko jotain turhaan kun nämä tehdään tässä kohdassa, mutta eiköhän tämä ole mietitty silloin kun on tehty. 🤔
Sitä voi tutkia jos tämä toiminto on esim. erityisen hidas.


$layout['events'] = $this->format_events( $events, $layout['show_images'] );
$layout['classes'] = [
Expand Down
Loading