Skip to content

Commit

Permalink
change the default sort (#874)
Browse files Browse the repository at this point in the history
  • Loading branch information
jbraswell authored Feb 15, 2023
1 parent 441c667 commit d312e65
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## 3.0.3 (TBD)
* Fixed an issue with the `GetServerInfo` API that caused the `versionInt` to be calculated incorrectly for beta versions.
* We'd forgotten to migrate the `GetSearchResults` API's `sort_key` parameter, so some old plugins were not working correctly. It has now been migrated.
* Changed `GetSearchResults` API's default sort order to `weekday_tinyint, start_time, duration_time`.

## 3.0.2 (January 23, 2023)
* Fixed an issue that could cause the "History" tab in the Meeting Editor to hang on some meetings.
Expand Down
2 changes: 1 addition & 1 deletion src/app/Http/Controllers/Query/SwitcherController.php
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ private function getSearchResults(Request $request): BaseJsonResponse
}
}
if (is_null($sortKeys)) {
$sortKeys = ['lang_enum', 'weekday_tinyint', 'start_time', 'id_bigint'];
$sortKeys = ['weekday_tinyint', 'start_time', 'duration_time'];
}
}

Expand Down
16 changes: 8 additions & 8 deletions src/tests/Feature/GetSearchResultsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1365,8 +1365,8 @@ public function testSortKeyWeekdayState()

public function testSortKeyInvalid()
{
$meeting1 = $this->createMeeting(['lang_enum' => 'a', 'weekday_tinyint' => 3, 'start_time' => '01:00:00'], ['location_province' => 'a']);
$meeting2 = $this->createMeeting(['lang_enum' => 'b', 'weekday_tinyint' => 3, 'start_time' => '01:00:00'], ['location_province' => 'd']);
$meeting1 = $this->createMeeting(['lang_enum' => 'a', 'weekday_tinyint' => 3, 'start_time' => '01:00:00', 'duration_time' => '01:30:00'], ['location_province' => 'a']);
$meeting2 = $this->createMeeting(['lang_enum' => 'b', 'weekday_tinyint' => 3, 'start_time' => '01:00:00', 'duration_time' => '01:00:00'], ['location_province' => 'd']);
$meeting3 = $this->createMeeting(['lang_enum' => 'c', 'weekday_tinyint' => 1, 'start_time' => '19:00:00'], ['location_province' => 'f']);
$meeting4 = $this->createMeeting(['lang_enum' => 'd', 'weekday_tinyint' => 1, 'start_time' => '09:00:00'], ['location_province' => 'e']);
$meeting5 = $this->createMeeting(['lang_enum' => 'e', 'weekday_tinyint' => 2, 'start_time' => '23:59:59'], ['location_province' => 'b']);
Expand All @@ -1378,12 +1378,12 @@ public function testSortKeyInvalid()
->assertJsonCount(6)
->json());

$this->assertEquals(strval($meeting1->id_bigint), $data[0]['id_bigint']);
$this->assertEquals(strval($meeting2->id_bigint), $data[1]['id_bigint']);
$this->assertEquals(strval($meeting3->id_bigint), $data[2]['id_bigint']);
$this->assertEquals(strval($meeting4->id_bigint), $data[3]['id_bigint']);
$this->assertEquals(strval($meeting5->id_bigint), $data[4]['id_bigint']);
$this->assertEquals(strval($meeting6->id_bigint), $data[5]['id_bigint']);
$this->assertEquals(strval($meeting4->id_bigint), $data[0]['id_bigint']);
$this->assertEquals(strval($meeting3->id_bigint), $data[1]['id_bigint']);
$this->assertEquals(strval($meeting6->id_bigint), $data[2]['id_bigint']);
$this->assertEquals(strval($meeting5->id_bigint), $data[3]['id_bigint']);
$this->assertEquals(strval($meeting2->id_bigint), $data[4]['id_bigint']);
$this->assertEquals(strval($meeting1->id_bigint), $data[5]['id_bigint']);
}

// sort_keys
Expand Down

0 comments on commit d312e65

Please sign in to comment.