mirror of
https://github.com/HDInnovations/UNIT3D-Community-Edition.git
synced 2026-04-21 17:28:31 -05:00
refactor: split tmdb into movie_id and tv_id
Step 2 in cleaner meta fetching code.
This commit is contained in:
@@ -55,7 +55,7 @@ class YearlyOverviewController extends Controller
|
||||
'yearly-overview:'.$year.':top-movies',
|
||||
fn () => Torrent::with('movie')
|
||||
->select([
|
||||
'tmdb',
|
||||
'movie_id',
|
||||
DB::raw('COUNT(h.user_id) as download_count'),
|
||||
DB::raw('MIN(category_id) as category_id'),
|
||||
])
|
||||
@@ -67,9 +67,10 @@ class YearlyOverviewController extends Controller
|
||||
'h',
|
||||
fn ($join) => $join->on('torrents.id', '=', 'h.torrent_id')
|
||||
)
|
||||
->where('tmdb', '!=', 0)
|
||||
->where('movie_id', '!=', 0)
|
||||
->whereNotNull('movie_id')
|
||||
->whereRelation('category', 'movie_meta', '=', true)
|
||||
->groupBy('tmdb')
|
||||
->groupBy('movie_id')
|
||||
->orderByDesc('download_count')
|
||||
->take(10)
|
||||
->get()
|
||||
@@ -78,7 +79,7 @@ class YearlyOverviewController extends Controller
|
||||
'yearly-overview:'.$year.':bottom-movies',
|
||||
fn () => Torrent::with('movie')
|
||||
->select([
|
||||
'tmdb',
|
||||
'movie_id',
|
||||
DB::raw('COUNT(h.user_id) as download_count'),
|
||||
DB::raw('MIN(category_id) as category_id'),
|
||||
])
|
||||
@@ -90,9 +91,10 @@ class YearlyOverviewController extends Controller
|
||||
'h',
|
||||
fn ($join) => $join->on('torrents.id', '=', 'h.torrent_id')
|
||||
)
|
||||
->where('tmdb', '!=', 0)
|
||||
->where('movie_id', '!=', 0)
|
||||
->whereNotNull('movie_id')
|
||||
->whereRelation('category', 'movie_meta', '=', true)
|
||||
->groupBy('tmdb')
|
||||
->groupBy('movie_id')
|
||||
->orderBy('download_count')
|
||||
->take(5)
|
||||
->get()
|
||||
@@ -101,7 +103,7 @@ class YearlyOverviewController extends Controller
|
||||
'yearly-overview:'.$year.':top-tv',
|
||||
fn () => Torrent::with('tv')
|
||||
->select([
|
||||
'tmdb',
|
||||
'tv_id',
|
||||
DB::raw('COUNT(h.user_id) as download_count'),
|
||||
DB::raw('MIN(category_id) as category_id'),
|
||||
])
|
||||
@@ -113,9 +115,10 @@ class YearlyOverviewController extends Controller
|
||||
'h',
|
||||
fn ($join) => $join->on('torrents.id', '=', 'h.torrent_id')
|
||||
)
|
||||
->where('tmdb', '!=', 0)
|
||||
->where('tv_id', '!=', 0)
|
||||
->whereNotNull('tv_id')
|
||||
->whereRelation('category', 'tv_meta', '=', true)
|
||||
->groupBy('tmdb')
|
||||
->groupBy('tv_id')
|
||||
->orderByDesc('download_count')
|
||||
->take(10)
|
||||
->get()
|
||||
@@ -124,7 +127,7 @@ class YearlyOverviewController extends Controller
|
||||
'yearly-overview:'.$year.':bottom-tv',
|
||||
fn () => Torrent::with('tv')
|
||||
->select([
|
||||
'tmdb',
|
||||
'tv_id',
|
||||
DB::raw('COUNT(h.user_id) as download_count'),
|
||||
DB::raw('MIN(category_id) as category_id'),
|
||||
])
|
||||
@@ -136,9 +139,10 @@ class YearlyOverviewController extends Controller
|
||||
'h',
|
||||
fn ($join) => $join->on('torrents.id', '=', 'h.torrent_id')
|
||||
)
|
||||
->where('tmdb', '!=', 0)
|
||||
->where('tv_id', '!=', 0)
|
||||
->whereNotNull('tv_id')
|
||||
->whereRelation('category', 'tv_meta', '=', true)
|
||||
->groupBy('tmdb')
|
||||
->groupBy('tv_id')
|
||||
->orderBy('download_count')
|
||||
->take(5)
|
||||
->get()
|
||||
|
||||
Reference in New Issue
Block a user