revert: group histories and uploads by month

Reverted because the implementation only allows sorting by date. Sorting using another column was broken.
This commit is contained in:
Roardom
2024-05-03 06:32:11 +00:00
parent 4c5cfc2a46
commit 4bf6f4c95e
4 changed files with 376 additions and 426 deletions
+1 -3
View File
@@ -91,7 +91,7 @@ class UserTorrents extends Component
#[Computed]
final public function history(): \Illuminate\Contracts\Pagination\LengthAwarePaginator
{
$histories = History::query()
return History::query()
->join(
'torrents',
fn ($join) => $join
@@ -166,8 +166,6 @@ class UserTorrents extends Component
->when(!empty($this->status), fn ($query) => $query->whereIntegerInRaw('status', $this->status))
->orderBy($this->sortField, $this->sortDirection)
->paginate($this->perPage);
return $histories->setCollection($histories->getCollection()->groupBy(fn ($history) => $history->created_at->format('Y-m')));
}
final public function render(): \Illuminate\Contracts\View\Factory|\Illuminate\Contracts\View\View|\Illuminate\Contracts\Foundation\Application