Skip to content

Commit

Permalink
[BUG] Website carbon sidebar always shows the OLDEST carbon result in…
Browse files Browse the repository at this point in the history
…stead of the NEWEST
  • Loading branch information
Numkil committed Sep 6, 2024
1 parent 973ba8b commit 7eda930
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/services/StatsService.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@ class StatsService extends Component
{
public function getDataForEntry(Entry $entry): SiteStatisticsModel|bool
{
$record = SiteStatisticsRecord::findOne(['entryId' => $entry->id, 'siteId' => $entry->siteId]);

/** @var SiteStatisticsRecord $record */
$record = SiteStatisticsRecord::find()->where(['entryId' => $entry->id])->andWhere(['siteId' => $entry->siteId])->orderBy('id DESC')->one();

if (!$record) {

Check failure on line 19 in src/services/StatsService.php

View workflow job for this annotation

GitHub Actions / ci / Code Quality / PHPStan / PHPStan

Negated boolean expression is always false.
// Search again without the siteId
$record = SiteStatisticsRecord::findOne(['entryId' => $entry->id]);
$record = SiteStatisticsRecord::find()->where(['entryId' => $entry->id])->orderBy('id DESC')->one();
if (!$record) {
return false;
}
Expand Down

0 comments on commit 7eda930

Please sign in to comment.