-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sorting by "Nearest Due Date" puts all issues without a due date first. #8383
Comments
I'm going to try and do a PR for this.. never used GO before, but looking at the code this might be quite simple? ;) |
Not quite as simple as fist thought :/ Going with the first option, "filter out any issues without a due date", the above commit works, however it does not update the counts on the "open/closed" buttons. I guess the result set is counted before it's sorted? This raises the question of should I be mixing filters into the sort function? If its cool to do that, where should I be adapting to get the correct count? |
OK, I've found what looks like a much better place to put the code; in |
OK, so a bit of debugging shows So where are these counts coming from? Wherever it is it can't be using |
I think the counts come from I think I'm beat :( |
Perhaps you can try a different route. I'm not entirely sure if this is possible, given the compatibility constraints, but for example, this kind of usage is valid:
I imagine that something like this can be done (note: it's wrong SQL, it's just to convey the idea):
This at least will send all the issues without due date to the back of the query. The problems this may pose (if you're interested in following it) are:
|
Thanks for the input :) This seems to work for:
I'm not sure if using ORDER BY CASE WHEN THEN would be more efficient? I'm sure either way will mean the deadline index cant be used for the ordering - if it even exists and was used in the first place I'm not sure. Are there any tests I can run to ensure compatibility? |
Yes, there are the integration tests. Currently the example in the Hacking Gitea page points out only to sqlite (which is embedded in the code, so always available), but to test other databases you'd have to install them yourself. But for a single statement like this I suggest try using one of the online pages like SQL Fiddle, db-fiddle, sqltest, etc. The list of engines to test is currently: MSSQL, Postgres, MySQL/MariaDB and SQLite. |
When doing tests, consider when end-user install distro version of Postgres or MySQL/MariaDB instead of latest upstream version and ensure that your SQL statement works correctly. |
I would really like to see this fixed in 1.11 |
I can submit my one-liner fix as a PR if you like? But I haven't had any time to run all the tests against all the DB's. |
This was fixed in #8871 I believe. |
Fantastic! Yep, I can confirm the fix is working :) Thanks |
[x]
):Description
When sorting by nearest due date you'd expect the overdue/imminent issues to be first in the list. If on a repo with lots of issues you can find that the issues you are looking for are actually on the last page.
https://try.gitea.io/bobemoe/test/issues?q=&type=all&sort=nearduedate&state=open&labels=0&milestone=0&assignee=0
This leaves no way to actually sort them to the top of the list.
When sorting like this, should we:
The text was updated successfully, but these errors were encountered: