Browse Source

Sort by name correctly in user searches

spaghetti 7 years ago
parent
commit
9966e5923a
1 changed files with 4 additions and 3 deletions
  1. 4
    3
      sections/torrents/user.php

+ 4
- 3
sections/torrents/user.php View File

@@ -1,8 +1,8 @@
1 1
 <?php
2 2
 
3 3
 
4
-$Orders = array('Time', 'Name', 'Seeders', 'Leechers', 'Snatched', 'Size');
5
-$Ways = array('DESC' => 'Descending', 'ASC' => 'Ascending');
4
+$Orders = ['Time', 'Name', 'Seeders', 'Leechers', 'Snatched', 'Size'];
5
+$Ways = ['DESC' => 'Descending', 'ASC' => 'Ascending'];
6 6
 
7 7
 // The "order by x" links on columns headers
8 8
 function header_link($SortKey, $DefaultWay = 'DESC') {
@@ -251,6 +251,7 @@ if ((empty($_GET['search']) || trim($_GET['search']) === '')) {//&& $Order != 'N
251 251
       t.GroupID,
252 252
       t.ID AS TorrentID,
253 253
       $Time AS Time,
254
+      COALESCE(NULLIF(tg.Name, ''), NULLIF(tg.NameRJ, ''), tg.NameJP) AS Name,
254 255
       tg.CategoryID
255 256
     FROM $From
256 257
       JOIN torrents_group AS tg ON tg.ID = t.GroupID
@@ -283,7 +284,7 @@ if ((empty($_GET['search']) || trim($_GET['search']) === '')) {//&& $Order != 'N
283 284
         t.Seeders,
284 285
         t.Leechers,
285 286
         t.Snatched,
286
-        CONCAT_WS(' ', GROUP_CONCAT(ag.Name SEPARATOR ' '), ' ', tg.Name, ' ', tg.Year, ' ') AS Name,
287
+        CONCAT_WS(' ', GROUP_CONCAT(ag.Name SEPARATOR ' '), ' ', COALESCE(NULLIF(tg.Name,''), NULLIF(tg.NameRJ,''), tg.NameJP), ' ', tg.Year, ' ') AS Name,
287 288
         t.Size
288 289
       FROM $From
289 290
         JOIN torrents_group AS tg ON tg.ID = t.GroupID

Loading…
Cancel
Save