update: history table

This commit is contained in:
Roardom
2022-12-22 23:56:10 -06:00
parent aa064cc840
commit 9e606315ec
5 changed files with 47 additions and 9 deletions
@@ -42,7 +42,7 @@ class TorrentDownloadController extends Controller
$user = User::where('rsskey', '=', $rsskey)->firstOrFail();
}
$torrent = Torrent::withAnyStatus()->findOrFail($id);
$hasHistory = $user->history()->where([['info_hash', '=', $torrent->info_hash], ['seeder', '=', 1]])->count();
$hasHistory = $user->history()->where([['torrent_id', '=', $torrent->id], ['seeder', '=', 1]])->count();
// User's ratio is too low
if ($user->getRatio() < \config('other.ratio') && ! ($torrent->user_id === $user->id || $hasHistory)) {
return \to_route('torrent', ['id' => $torrent->id])