Skip to content

feat: Reorderable Task Definitions

Add the ability for users to define/modify order of ChecklistTaskDefinitions. This was achieved by introducing a generic OrderedModel abstract class that can be inherited by models that want user defined ordering functionality.

This change contains 2 migrations:

  • A migration introducing the new field order in ChecklistTaskDefinition from the new abstract class OrderedModel, and changes the ordering in various Meta classes that depended on the created_on field
  • A migration that populates the new field in existing ChecklistTaskDefinition based on the created_on field to maintain the same ordering when migrating over to the new ordering system

Supporting information

  • Jira ticket: url
  • GitLab issue: url

Visual Changes

drag-n-drop

Dependencies

None

Merge deadline

None

Testing instructions

To try it out:

  1. Go to the admin page of a ChecklistDefinition
  2. Scroll down to the inline ChecklistDefinitionTasks
  3. Notice the new Order field
  4. Change the number to match your desired ordering, smaller number is ranked/listed higher
  5. Save
  6. Refresh the Listaflow app to see the reflected changes on ordering

Author notes and concerns

There may seem to be arbitrary tests added in this merge request. The reason for that is, a big part of the new code is in a migration and django admin code, and hence there are no accompanied tests, so the coverage drops below the 95% limit (even though the I added tests for the new functionality). So I added a few more tests to go back above the limit. I'm open to suggestions for better ways to achieve this.

Edited by Yusuf Musleh

Merge request reports