mirror of
https://github.com/YGGverse/YGGtracker.git
synced 2025-09-12 14:22:55 +00:00
fix stars counter
This commit is contained in:
parent
38b855779b
commit
74e7035123
@ -1382,13 +1382,15 @@ class Database {
|
|||||||
return $query->fetch()->result;
|
return $query->fetch()->result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function findMagnetStarsTotalByMagnetId(int $magnetId) : int {
|
public function findMagnetStarsTotalByMagnetId(int $magnetId, bool $value) : int {
|
||||||
|
|
||||||
$this->_debug->query->select->total++;
|
$this->_debug->query->select->total++;
|
||||||
|
|
||||||
$query = $this->_db->prepare('SELECT COUNT(DISTINCT `userId`) AS `result` FROM `magnetStar` WHERE `magnetId` = ?');
|
$total = 0;
|
||||||
|
|
||||||
$query->execute([$magnetId]);
|
$query = $this->_db->prepare('SELECT COUNT(DISTINCT `userId`) AS `result` FROM `magnetStar` WHERE `magnetId` = ? AND `value` = ?');
|
||||||
|
|
||||||
|
$query->execute([$magnetId, (int) $value]);
|
||||||
|
|
||||||
return $query->fetch()->result;
|
return $query->fetch()->result;
|
||||||
}
|
}
|
||||||
|
@ -143,7 +143,7 @@ else
|
|||||||
],
|
],
|
||||||
'star' => (object)
|
'star' => (object)
|
||||||
[
|
[
|
||||||
'total' => $db->findMagnetStarsTotalByMagnetId($magnet->magnetId),
|
'total' => $db->findMagnetStarsTotalByMagnetId($magnet->magnetId, true),
|
||||||
'status' => $db->findLastMagnetStarValue($magnet->magnetId, $userId),
|
'status' => $db->findLastMagnetStarValue($magnet->magnetId, $userId),
|
||||||
],
|
],
|
||||||
'access' => (object)
|
'access' => (object)
|
||||||
|
@ -131,7 +131,7 @@ else
|
|||||||
],
|
],
|
||||||
'star' => (object)
|
'star' => (object)
|
||||||
[
|
[
|
||||||
'total' => $db->findMagnetStarsTotalByMagnetId($magnet->magnetId),
|
'total' => $db->findMagnetStarsTotalByMagnetId($magnet->magnetId, true),
|
||||||
'status' => $db->findLastMagnetStarValue($magnet->magnetId, $userId),
|
'status' => $db->findLastMagnetStarValue($magnet->magnetId, $userId),
|
||||||
],
|
],
|
||||||
'access' => (object)
|
'access' => (object)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user