Fixed crash on profiles.

This commit is contained in:
flash 2023-10-06 21:24:24 +00:00
parent bd17a0feb5
commit 1750e5693f
2 changed files with 11 additions and 3 deletions

View file

@ -33,7 +33,16 @@ class ProfileRoutes extends RouteHandler {
return 404;
}
$submissions = $torrents->getTorrents(approved: true, userInfo: $userInfo, take: 3);
$submissions = [];
$torrentInfos = $torrents->getTorrents(approved: true, userInfo: $userInfo, take: 3);
foreach($torrentInfos as $torrentInfo) {
$submissions[] = [
'info' => $torrentInfo,
'complete_peers' => $peers->countCompletePeers($torrentInfo),
'incomplete_peers' => $peers->countIncompletePeers($torrentInfo),
];
}
$uploading = $peers->countUserUploading($userInfo);
$downloading = $peers->countUserDownloading($userInfo);

View file

@ -1,6 +1,6 @@
{% macro torrent_listing_entry(torrent, class_name) %}
{% set torrent_info = torrent.info %}
{% set submitter_info = torrent.user %}
{% set submitter_info = torrent.user|default(null) %}
<div class="tdl {{ class_name }}" id="tdl{{ torrent_info.id }}">
<div class="tdl-details">
@ -14,7 +14,6 @@
{% endif %}
</div>
<div class="tdl-stats">
<div class="tdl-stats-uploading" title="Uploading"><div class="arrow">&#8593;</div><div class="number">{{ torrent.complete_peers|number_format }}</div></div>
<div class="tdl-stats-downloading" title="Downloading"><div class="arrow">&#8595;</div><div class="number">{{ torrent.incomplete_peers|number_format }}</div></div>