Sort by rating and another column is inconsistent when a value is rated and then unrated
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 214
- Forks
- 52
- Avg merge
- 1d 10h
- Merged PRs (30d)
- 82
Description
Steps to reproduce
- Create a table with at least two columns; one of them is a rating column, the other is some other sortable field
- Add a few items in the table. Rate one of the items, and then clear the rating. In the db (
oc_tables_row_cells_number), this is now a value of 0. Make sure that some of the items are not rated - Sort the ratings in descending order, then sort another column.
Let's give a simple example
| number | rating |
|---|---|
| 2 | 5 |
| 3 | 0 (previously rated) |
| 1 | unrated (null) |
Sort by rating DESC, then NUMBER ASC
Expected behavior
The item that was rated and then unrated is treated equivalently to an item that is unrated. Secondary sort takes over
| number | rating |
|---|---|
| 2 | 5 |
| 1 | unrated (null) |
| 3 | 0 (previously rated) |
Actual behavior
The item that was rated and then unrated is treated above null
| number | rating |
|---|---|
| 2 | 5 |
| 3 | 0 (previously rated) |
| 1 | unrated (null) |
Attached, see a snippet of a real example I observed. Column 1 is a number, column 2 is a rating column. Sort is by priority (column 2), then duration. Fields that are 0 were rated then unrated.
26-09-03_04-44_Pending items.csv
Tables app version
2.3.0
Browser
Firefox 1.54.1
Client operating system
Linux
Operating system
Linux (Docker)
Web server
Apache
PHP engine version
Other
Database
PostgreSQL
Additional info
PHP 8.5.10. Image https://hub.docker.com/_/nextcloud.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue in the Tables app using PostgreSQL with a rating value that is cleared and becomes 0, alongside an unrated null value. Start by tracing the table sorting behavior for rating DESC followed by the secondary column; done means previously rated and never-rated rows are treated equivalently so the secondary sort determines their order.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, php, postgresql
- Domain
- backend, databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 65/100