Skip to content

Consolidate the calcualtion and handling of the sorting timestamp column values #611

@lemonboston

Description

@lemonboston

The calculation and handling of the INSTANCE_START_SORTING and INSTANCE_DUE_SORTING values are not clearly defined and unified yet in the code base. To remove the chance of errors around that and help maintain it more easily, consolidate the solution with the steps below.

  1. Define the calculation from DateTime to long at a single place in the code base,
    possibly with a TimeSorting implements Single<Long> class that takes the start/due DateTime. (Or TimeSortingValue, TimeSortingKey).

    Current implementation in org.dmfs.provider.tasks.processors.tasks.instancedata.Dated is this:

    dateTime.isAllDay() ? dateTime.getInstance() : dateTime.shiftTimeZone(TimeZone.getDefault()).getInstance()
    

    Consider using getTimestamp() instead and consider and test different scenarios (all-day, floating, etc.)

  2. Replace every usage of the sorting value calculation in the code base with the new class.

  3. Add DB upgrade migration procedure to update all existing values using the new calculation.

  4. Revisit org.dmfs.opentaskstestpal.InstanceTestData class and its usage in the provider tests. If possible move the sorting value calculation inside.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions