Skip to content

Sort by rating and another column is inconsistent when a value is rated and then unrated #2947

Description

@kgarner7

Steps to reproduce

  1. Create a table with at least two columns; one of them is a rating column, the other is some other sortable field
  2. 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
  3. 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.

Activity

  1. added
    bugSomething isn't working
    0. Needs triagePending approval or rejection. This issue is pending approval.
    on Sep 3, 2026
  2. taiebot commented on Sep 3, 2026

    @taiebot
    Contributor

    From my understanding does not look like a bug to me. 0 is a number so is lower than no number at all ? Maybe the real bug is by default you would expect that a value was set to 0 instead of null.

  3. kgarner7 commented on Sep 4, 2026

    @kgarner7
    Author

    It's a problem because from the UI perspective, 0 and NULL (stored internally) look the same. So, it would either be that clearing the rating sets it to NULL (although this won't fix existing entries), or a rating column is sorted where NULL is coalesced to 0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    0. Needs triagePending approval or rejection. This issue is pending approval.bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions