Skip to content

Commit e820e26

Browse files
committed
change time ago for ticket only titles
1 parent e9b0c34 commit e820e26

4 files changed

Lines changed: 10 additions & 6 deletions

File tree

public_html/lib/module/rpcn/games.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4085,7 +4085,7 @@
40854085
},
40864086
"NPWR01625_00": {
40874087
"title": ["Puzzle Dimension"],
4088-
"id": []
4088+
"id": ["NPUB30525"]
40894089
},
40904090
"NPWR01626_00": {
40914091
"title": ["Zumba"],
@@ -4811,7 +4811,7 @@
48114811
},
48124812
"NPWR01868_00": {
48134813
"title": ["GoldenEye 007: Reloaded"],
4814-
"id": ["BLES01292", "BLUS30755"]
4814+
"id": ["BLES01292", "BLUS30755", "NPUB30752"]
48154815
},
48164816
"NPWR01869_00": {
48174817
"title": ["Wipeout 2"],
@@ -8659,7 +8659,7 @@
86598659
},
86608660
"NPWR05543_00": {
86618661
"title": ["Blood Knights"],
8662-
"id": ["NPUB31394"]
8662+
"id": ["NPUB31394", "NPEB01901"]
86638663
},
86648664
"NPWR05555_00": {
86658665
"title": ["Treasures of Montezuma Arena"],

public_html/lib/module/rpcn/inc-rpcn-game.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,9 +462,11 @@ private function loadDbStats(mysqli $db, string $commId, RPCNStats $stats): void
462462
$placeholders = implode(',', array_fill(0, count($titleIds), '?'));
463463
$types = str_repeat('s', count($titleIds));
464464
$stmt = $db->prepare("
465-
SELECT MAX(players) AS peak, MAX(timestamp) AS peak_date
465+
SELECT players AS peak, timestamp AS peak_date
466466
FROM np_ticket_games
467467
WHERE SUBSTRING_INDEX(SUBSTRING_INDEX(content_id, '-', -1), '_', 1) IN ($placeholders)
468+
ORDER BY players DESC, timestamp ASC
469+
LIMIT 1
468470
");
469471
if ($stmt)
470472
{

public_html/lib/module/rpcn/inc-rpcn-stats.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,7 @@ private function fetchDatabaseStatsFromDb(mysqli $db): void
529529
$res_all_tkt = $db->query("
530530
SELECT SUBSTRING_INDEX(SUBSTRING_INDEX(content_id, '-', -1), '_', 1) AS title_id,
531531
MAX(players) AS peak,
532-
MAX(timestamp) AS peak_date
532+
SUBSTRING_INDEX(GROUP_CONCAT(timestamp ORDER BY players DESC, timestamp ASC), ',', 1) AS peak_date
533533
FROM np_ticket_games
534534
GROUP BY title_id
535535
");
@@ -556,7 +556,7 @@ private function fetchDatabaseStatsFromDb(mysqli $db): void
556556
'comm_id' => $comm_id,
557557
'game_title' => $this->app_title[$comm_id] ?? 'Unknown Game',
558558
'peak' => $data['peak'],
559-
'time_ago' => $this->time_ago($data['date']),
559+
'time_ago' => !empty($data['date']) ? $this->time_ago($data['date']) : '',
560560
'icon' => $this->resolveIcon($comm_id),
561561
];
562562
}

public_html/rpcn.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,9 @@ class="rpcn-game-icon"
469469
</td>
470470
<td style="padding: 8px 0; text-align: right; white-space: nowrap;">
471471
<strong><?php echo $game['peak']; ?></strong> peak
472+
<?php if (!empty($game['time_ago'])): ?>
472473
<span style="display:block; font-size:11px; opacity:0.6;"><?php echo $game['time_ago']; ?></span>
474+
<?php endif; ?>
473475
</td>
474476
</tr>
475477
<?php endforeach; ?>

0 commit comments

Comments
 (0)