Edgewall Software

Ticket #4715: default_reports011.diff

File default_reports011.diff, 3.3 KB (added by vnaum@…, 4 years ago)

patch for default reports to use CAST p.value AS INT for sorting

  • db_default.py

     
    180180  FROM ticket t 
    181181  LEFT JOIN enum p ON p.name = t.priority AND p.type = 'priority' 
    182182  WHERE status <> 'closed' 
    183   ORDER BY p.value, milestone, t.type, time 
     183  ORDER BY """ + db.cast('p.value', 'int') + """, milestone, t.type, time 
    184184"""), 
    185185#---------------------------------------------------------------------------- 
    186186 ('Active Tickets by Version', 
     
    202202  FROM ticket t 
    203203  LEFT JOIN enum p ON p.name = t.priority AND p.type = 'priority' 
    204204  WHERE status <> 'closed' 
    205   ORDER BY (version IS NULL),version, p.value, t.type, time 
     205  ORDER BY (version IS NULL),version, """ + db.cast('p.value', 'int') + """, t.type, time 
    206206"""), 
    207207#---------------------------------------------------------------------------- 
    208208('Active Tickets by Milestone', 
     
    224224  FROM ticket t 
    225225  LEFT JOIN enum p ON p.name = t.priority AND p.type = 'priority' 
    226226  WHERE status <> 'closed'  
    227   ORDER BY (milestone IS NULL),milestone, p.value, t.type, time 
    228 """ % db.concat("'Milestone '", 'milestone')), 
     227  ORDER BY (milestone IS NULL),milestone, %s, t.type, time 
     228""" % (db.concat("'Milestone '", 'milestone'), db.cast('p.value', 'int'))), 
    229229#---------------------------------------------------------------------------- 
    230230('Accepted, Active Tickets by Owner', 
    231231""" 
     
    241241  FROM ticket t 
    242242  LEFT JOIN enum p ON p.name = t.priority AND p.type = 'priority' 
    243243  WHERE status = 'accepted' 
    244   ORDER BY owner, p.value, t.type, time 
     244  ORDER BY owner, """ + db.cast('p.value', 'int') + """, t.type, time 
    245245"""), 
    246246#---------------------------------------------------------------------------- 
    247247('Accepted, Active Tickets by Owner (Full Description)', 
     
    258258  FROM ticket t 
    259259  LEFT JOIN enum p ON p.name = t.priority AND p.type = 'priority' 
    260260  WHERE status = 'accepted' 
    261   ORDER BY owner, p.value, t.type, time 
     261  ORDER BY owner, """ + db.cast('p.value', 'int') + """, t.type, time 
    262262"""), 
    263263#---------------------------------------------------------------------------- 
    264264('All Tickets By Milestone  (Including closed)', 
     
    280280  FROM ticket t 
    281281  LEFT JOIN enum p ON p.name = t.priority AND p.type = 'priority' 
    282282  ORDER BY (milestone IS NULL), milestone DESC, (status = 'closed'),  
    283         (CASE status WHEN 'closed' THEN modified ELSE (-1)*p.value END) DESC 
     283        (CASE status WHEN 'closed' THEN changetime ELSE (-1)*""" + db.cast('p.value', 'int') + """ END) DESC 
    284284"""), 
    285285#---------------------------------------------------------------------------- 
    286286('My Tickets', 
     
    299299  FROM ticket t 
    300300  LEFT JOIN enum p ON p.name = t.priority AND p.type = 'priority' 
    301301  WHERE t.status <> 'closed' AND owner = $USER 
    302   ORDER BY (status = 'accepted') DESC, p.value, milestone, t.type, time 
     302  ORDER BY (status = 'accepted') DESC, """ + db.cast('p.value', 'int') + """, milestone, t.type, time 
    303303"""), 
    304304#---------------------------------------------------------------------------- 
    305305('Active Tickets, Mine first', 
     
    321321  FROM ticket t 
    322322  LEFT JOIN enum p ON p.name = t.priority AND p.type = 'priority' 
    323323  WHERE status <> 'closed'  
    324   ORDER BY (owner = $USER) DESC, p.value, milestone, t.type, time 
     324  ORDER BY (owner = $USER) DESC, """ + db.cast('p.value', 'int') + """, milestone, t.type, time 
    325325""")) 
    326326 
    327327