spacecowboy/NotePad

Notes disappear when sorting by date

Closed this issue · 6 comments

Describe the bug

Notes disappear when sorting by due date and don't show up. They aren't lost and return when sorting via another method, but the only thing that shoes up when sorting by due date is the day headers and not the actual items.

how To Reproduce

Open left hand menu
Long click on a list
Sort by Due Date

If applicable

  • add the stacktrace
  • add logcat output as explained here

Technical information

  • Device: Pixel 6 Pro
  • OS: GrapheneOS 2024020500
  • app version: 7.1.7
  • app commit id (only for nightly builds):

Sorting via the 3 dots menu on the upper right also doesn't change the sorting method.
Tried backing up and restoring, didn't change anything.

i tried making a list and sorting by date, but i can't replicate. This happens in the app, not in the widget, correct ?

i will try it on other devices in the future, to see if i can replicate.

Sorting via the 3 dots menu on the upper right also doesn't change the sorting method

that menu is a placeholder, the feature is still a work in progress

I can't replicate.
I will publish an update in a few days.
Can you try uninstalling the app, installing that update, and rewriting the notes to see if it still happens ?

@JJ840 update 7.1.8 is now available. Can you verify if the bug is still present ?

I can now replicate this on a Google Pixel 8a with the stock rom on Android 14.
Updates:

  1. It does not affect how data is saved in the DB, because the app exports the notes correctly
  2. It does not happen on the android emulator for API 34
  3. It happens as far back as in version 6.0.0-beta5
  4. It happens both on a physical google pixel 8a and on the API 35 AVD image of the SDK
  5. The code to present the GUI already receives incorrect data, so it's not a GUI issue
  6. SQLite version
    • on the Google Pixel 8a: 3.32.2 ; bug is present
    • on the API 34 emulator: 3.39.2 2022-07-21 ; bug is NOT present
    • on the API 35 emulator: 3.44.3 2024-03-24 ; bug is present
  7. The problem is in query() in MyContentProvider.java where the line .query(Task.getSECTION_DATE_VIEW_NAME(listId) runs this sql
SELECT _id, title, note, completed, due, updated, lft, rgt, dblist, locked FROM sectioned_date_view_1 WHERE dblist IS '1' ORDER BY secret_typeid,due,secret_typeid2

The query says WHERE dblist IS '1' but some records are saved with dblist = '1' and some with dblist = 1. Android versions up to API 34 did not care about this difference, but on the Google Pixel 8a and on the API 35 AVD image of the SDK, '1' is not equal to 1 in SQLite queries, so the notes are not taken from the database, leading to only the headers being shown.

Also, on the API 34 emulator, on the view sectioned_date_view_1 column dblist is created as INTEGER type, while on the API 35 emulator, it's a BLOB type.

@JJ840 update 7.1.9 is now available on f-droid and the play store. The bug with the dates should be fixed. Can you try the app and tell me if it works ?