RotherOSS / otobo

OTOBO is one of the most flexible web-based ticketing systems used for Customer Service, Help Desk, IT Service Management. https://otobo.io/
GNU General Public License v3.0
250 stars 72 forks source link

Have a look at the sorting of articles together with the article edit/delete feature. #3424

Closed svenoe closed 3 months ago

svenoe commented 4 months ago

I'm wondering whether in that SQL an ORDER BY clause is missing: https://github.com/RotherOSS/otobo/blob/5de8569a76ab70a3ba842738eec67a766710e370/Kernel/System/Ticket/Article.pm#L1225-L1233 This could be related to some failures in the test suite.

Originally posted by @bschmalhofer in https://github.com/RotherOSS/otobo/issues/3157#issuecomment-2036377073

stefanhaerter commented 3 months ago

According to https://forums.mysql.com/read.php?21,239471,239688#msg-239688, I would strongly suggest to add an order clause in the above sql.

Do not depend on order when ORDER BY is missing.

Also, the ORDER BY a.id ASC in

https://github.com/RotherOSS/otobo/blob/2972ad1ab92a9aaa1db49c30f197b6edf2957f0b/Kernel/System/Ticket/Article.pm#L1221

and the ORDER BY at.create_time ASC in

https://github.com/RotherOSS/otobo/blob/2972ad1ab92a9aaa1db49c30f197b6edf2957f0b/Kernel/System/Ticket/Article.pm#L1245

are contradictory as the first will give something like

* ---------- * ----------- *
| article_id | create_time |
* ---------- * ----------- *
| 1          | 2024-01-01  |
| 2          | 2024-01-02  |
| 3          | 2024-01-03  |
* ---------- * ----------- *

while the second will produce something like

* ---------- * ----------- *
| article_id | create_time |
* ---------- * ----------- *
| 3          | 2024-01-03  |
| 2          | 2024-01-02  |
| 1          | 2024-01-01  |
* ---------- * ----------- *

if I understand the following source correctly:

Same rules apply for the letters of the alphabet. When arranging them in ascending order they are arranged from A to Z – or beginning to end.

When it comes to dates, ascending order would mean that the oldest ones come first and the most recent ones last.

https://www.freecodecamp.org/news/descending-order-vs-ascending-order-what-does-it-mean/

stefanhaerter commented 3 months ago

Should be done with merged #3457