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
 <?php
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
 // The "order by x" links on columns headers
7
 // The "order by x" links on columns headers
8
 function header_link($SortKey, $DefaultWay = 'DESC') {
8
 function header_link($SortKey, $DefaultWay = 'DESC') {
251
       t.GroupID,
251
       t.GroupID,
252
       t.ID AS TorrentID,
252
       t.ID AS TorrentID,
253
       $Time AS Time,
253
       $Time AS Time,
254
+      COALESCE(NULLIF(tg.Name, ''), NULLIF(tg.NameRJ, ''), tg.NameJP) AS Name,
254
       tg.CategoryID
255
       tg.CategoryID
255
     FROM $From
256
     FROM $From
256
       JOIN torrents_group AS tg ON tg.ID = t.GroupID
257
       JOIN torrents_group AS tg ON tg.ID = t.GroupID
283
         t.Seeders,
284
         t.Seeders,
284
         t.Leechers,
285
         t.Leechers,
285
         t.Snatched,
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
         t.Size
288
         t.Size
288
       FROM $From
289
       FROM $From
289
         JOIN torrents_group AS tg ON tg.ID = t.GroupID
290
         JOIN torrents_group AS tg ON tg.ID = t.GroupID

Loading…
Cancel
Save