mirror of
https://github.com/OPSnet/Gazelle.git
synced 2026-01-16 18:04:34 -05:00
Ignore bookmarked empty groups for total count
This commit is contained in:
@@ -249,9 +249,10 @@ class Bookmark extends \Gazelle\BaseUser {
|
||||
|
||||
public function tgroupTotal(): int {
|
||||
return (int)self::$db->scalar("
|
||||
SELECT count(*)
|
||||
FROM bookmarks_torrents
|
||||
WHERE UserID = ?
|
||||
SELECT count(DISTINCT b.GroupID)
|
||||
FROM bookmarks_torrents b
|
||||
INNER JOIN torrents t USING (GroupID)
|
||||
WHERE b.UserID = ?
|
||||
", $this->id
|
||||
);
|
||||
}
|
||||
|
||||
@@ -34,12 +34,13 @@ $reportMan = new Manager\Report($userMan);
|
||||
$tgMan = new Manager\TGroup();
|
||||
$torMan = new Manager\Torrent();
|
||||
$collMan = new Manager\Collage()->setImageProxy(new Util\ImageProxy($Viewer));
|
||||
$NumGroups = $bookmark->tgroupTotal();
|
||||
$totalGroups = $bookmark->tgroupTotal();
|
||||
|
||||
$paginator = new Util\Paginator(200, (int)($_GET['page'] ?? 1));
|
||||
$paginator->setTotal($NumGroups);
|
||||
$paginator->setTotal($totalGroups);
|
||||
|
||||
$bookmarkList = $bookmark->tgroupList($paginator->limit(), $paginator->offset());
|
||||
$NumGroups = count($bookmarkList);
|
||||
$artistLeaderboard = $bookmark->tgroupArtistLeaderboard();
|
||||
$tagLeaderboard = $bookmark->tgroupTagLeaderboard();
|
||||
$CollageCovers = (int)($Viewer->option('CollageCovers') ?? 25);
|
||||
@@ -89,7 +90,7 @@ if (count($bookmarkList) === 0) { ?>
|
||||
<div class="box box_info box_statistics_bookmarked_torrents">
|
||||
<div class="head"><strong>Stats</strong></div>
|
||||
<ul class="stats nobullet">
|
||||
<li>Torrent groups: <?=$NumGroups?></li>
|
||||
<li>Torrent groups: <?= $totalGroups ?></li>
|
||||
<li>Artists: <?= $bookmark->tgroupArtistTotal() ?></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@@ -599,6 +599,7 @@ class TGroupTest extends TestCase {
|
||||
$bookmarker->isBookmarked($this->tgroup),
|
||||
'tgroup-merge-bookmark',
|
||||
);
|
||||
$this->assertEquals(1, $bookmarker->tgroupTotal(), 'tgroup-bookmark-tgroupTotal');
|
||||
$list = $bookmarker->tgroupBookmarkList();
|
||||
$this->assertCount(1, $list, 'tgroup-bookmark-user-total');
|
||||
$this->assertEquals(
|
||||
|
||||
Reference in New Issue
Block a user