Skip to content

Commit

Permalink
db: no longer order by items.last_modified
Browse files Browse the repository at this point in the history
Signed-off-by: Sean Molenaar <sean@seanmolenaar.eu>
  • Loading branch information
SMillerDev authored and Grotax committed May 26, 2021
1 parent 3eb8b07 commit 5ba75f4
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 13 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ The format is almost based on [Keep a Changelog](https://keepachangelog.com/en/1
### Changed

### Fixed
- newestId does not return newest ID but last updated

# Releases
## [15.4.4] - 2021-05-21
Expand Down
4 changes: 0 additions & 4 deletions lib/Db/ItemMapperV2.php
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,6 @@ public function newest(string $userId): Entity
->innerJoin('items', FeedMapperV2::TABLE_NAME, 'feeds', 'items.feed_id = feeds.id')
->where('feeds.user_id = :userId')
->setParameter('userId', $userId)
->orderBy('items.last_modified', 'DESC')
->addOrderBy('items.id', 'DESC')
->setMaxResults(1);

Expand Down Expand Up @@ -337,7 +336,6 @@ public function findAllInFeedAfter(
'feedId' => $feedId,
'userId'=> $userId,
])
->orderBy('items.last_modified', 'DESC')
->addOrderBy('items.id', 'DESC');

if ($hideRead === true) {
Expand Down Expand Up @@ -377,7 +375,6 @@ public function findAllInFolderAfter(
'folderId' => $folderId,
'userId' => $userId,
])
->orderBy('items.last_modified', 'DESC')
->addOrderBy('items.id', 'DESC');

if ($hideRead === true) {
Expand Down Expand Up @@ -410,7 +407,6 @@ public function findAllAfter(string $userId, int $feedType, float $updatedSince)
'updatedSince' => number_format($updatedSince, 0, '.', ''),
'userId' => $userId,
])
->orderBy('items.last_modified', 'DESC')
->addOrderBy('items.id', 'DESC');

switch ($feedType) {
Expand Down
16 changes: 8 additions & 8 deletions tests/Unit/Db/ItemMapperAfterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public function testFindAllInFeedAfter()
])
->will($this->returnSelf());

$this->builder->expects($this->once())
$this->builder->expects($this->never())
->method('orderBy')
->with('items.last_modified', 'DESC')
->will($this->returnSelf());
Expand Down Expand Up @@ -152,7 +152,7 @@ public function testFindAllInFeedAfterHideRead()
->with('unread', true)
->will($this->returnSelf());

$this->builder->expects($this->once())
$this->builder->expects($this->never())
->method('orderBy')
->with('items.last_modified', 'DESC')
->will($this->returnSelf());
Expand Down Expand Up @@ -220,7 +220,7 @@ public function testFindAllInFolderAfter()
])
->will($this->returnSelf());

$this->builder->expects($this->once())
$this->builder->expects($this->never())
->method('orderBy')
->with('items.last_modified', 'DESC')
->will($this->returnSelf());
Expand Down Expand Up @@ -294,7 +294,7 @@ public function testFindAllInFolderAfterHideRead()
->with('unread', true)
->will($this->returnSelf());

$this->builder->expects($this->once())
$this->builder->expects($this->never())
->method('orderBy')
->with('items.last_modified', 'DESC')
->will($this->returnSelf());
Expand Down Expand Up @@ -363,7 +363,7 @@ public function testFindAllAfterUnread()
->with('unread', true)
->will($this->returnSelf());

$this->builder->expects($this->once())
$this->builder->expects($this->never())
->method('orderBy')
->with('items.last_modified', 'DESC')
->will($this->returnSelf());
Expand Down Expand Up @@ -432,7 +432,7 @@ public function testFindAllAfterStarred()
->with('starred', true)
->will($this->returnSelf());

$this->builder->expects($this->once())
$this->builder->expects($this->never())
->method('orderBy')
->with('items.last_modified', 'DESC')
->will($this->returnSelf());
Expand Down Expand Up @@ -495,7 +495,7 @@ public function testFindAllAfterAll()
])
->will($this->returnSelf());

$this->builder->expects($this->once())
$this->builder->expects($this->never())
->method('orderBy')
->with('items.last_modified', 'DESC')
->will($this->returnSelf());
Expand Down Expand Up @@ -561,7 +561,7 @@ public function testFindAllAfterInvalid()
])
->will($this->returnSelf());

$this->builder->expects($this->once())
$this->builder->expects($this->never())
->method('orderBy')
->with('items.last_modified', 'DESC')
->will($this->returnSelf());
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Db/ItemMapperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ public function testNewest()
->with('items', 'news_feeds', 'feeds', 'items.feed_id = feeds.id')
->will($this->returnSelf());

$this->builder->expects($this->once())
$this->builder->expects($this->never())
->method('orderBy')
->with('items.last_modified', 'DESC')
->will($this->returnSelf());
Expand Down

0 comments on commit 5ba75f4

Please sign in to comment.