Ticket #7512 (closed defect: fixed)
report 8 (active tickets, mine first) sorts owner wrong
| Reported by: | mailmaix@… | Owned by: | rblank |
|---|---|---|---|
| Priority: | low | Milestone: | 0.11.3 |
| Component: | report system | Version: | |
| Severity: | normal | Keywords: | |
| Cc: | mailmaix@…, rrosauro@… |
Description
Report 8 (active tickets, mine first) is sorting wrong. It first shows my tickets, then tickets owned by others, and then those with no owner. This might be useful, but it is not the intended behavior.
(And, additionally, some of the tickets have '' as owner, some have None, though they both have no owner. So some of the no-owner tickets are within the tickets with owner.)
This is caused by this line:
ORDER BY (owner = $USER) DESC, …
If owner is $USER, this returns 1, if it is something else, it returns 0. But if owner is NULL, it returns NULL.
It must be replaced by the following:
ORDER BY (CASE (owner = $USER) WHEN 1 THEN 1 ELSE 0 END) DESC,


