mirror of
https://github.com/HDInnovations/UNIT3D-Community-Edition.git
synced 2026-04-22 01:38:49 -05:00
refactor: don't use unnecessary orderByRaw
Null values are always ordered last anyways. Additionally, count(*) returns 0, not null. Also fixes issue on mariadb with value being a reserved keyword.
This commit is contained in:
@@ -139,7 +139,7 @@ class TopUsers extends Component
|
||||
->where('user_id', '!=', User::SYSTEM_USER_ID)
|
||||
->where('anon', '=', false)
|
||||
->groupBy('user_id')
|
||||
->orderByRaw('COALESCE(value, 0) DESC')
|
||||
->orderByDesc('value')
|
||||
->take(8)
|
||||
->get();
|
||||
}
|
||||
@@ -154,7 +154,7 @@ class TopUsers extends Component
|
||||
->select(DB::raw('user_id, COUNT(user_id) as value'))
|
||||
->where('user_id', '!=', User::SYSTEM_USER_ID)
|
||||
->groupBy('user_id')
|
||||
->orderByRaw('COALESCE(value, 0) DESC')
|
||||
->orderByDesc('value')
|
||||
->take(8)
|
||||
->get();
|
||||
}
|
||||
@@ -169,7 +169,7 @@ class TopUsers extends Component
|
||||
->select(DB::raw('user_id, COUNT(user_id) as value'))
|
||||
->where('user_id', '!=', User::SYSTEM_USER_ID)
|
||||
->groupBy('user_id')
|
||||
->orderByRaw('COALESCE(value, 0) DESC')
|
||||
->orderByDesc('value')
|
||||
->take(8)
|
||||
->get();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user