Skip to content

Commit

Permalink
Fix sorting using random direction (#2135)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrcasual committed Sep 25, 2024
1 parent 8ede5a5 commit 07e22eb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions future/includes/class-gv-view.php
Original file line number Diff line number Diff line change
Expand Up @@ -1141,6 +1141,12 @@ public function get_entries( $request = null ) {
continue;
}

if ( 'RAND' === strtoupper( $field['direction'] ) ) {
$query->order( \GF_Query_Call::RAND() );

continue;
}

$order = new \GF_Query_Column( $field['id'], $this->form->ID );

if ( 'id' !== $field['id'] && (int) $field['is_numeric'] ) {
Expand Down
1 change: 1 addition & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Beautifully display your Gravity Forms entries. Learn more on [gravitykit.com](h
* Fixed: PHP 8.2 deprecation notice related to dynamic property creation.
* Fixed: Entries not displaying when a DataTables View is embedded in a Single Entry page using the List layout.
* Fixed: PHP warning when deactivating the Gravity Forms Event Fields add-on when displaying a View with an Event field.
* Fixed: Sorting entries in random order not working.

= 2.28.0 on August 29, 2024 =

Expand Down

0 comments on commit 07e22eb

Please sign in to comment.