Menu

#37 Support for todo.txt priorities

2.0.0
pending
False
Feature
2024-05-06
2018-12-01
No
Feature: Support todo.txt priorities
  In order to be able to use priorities
  As a todo.txt user
  I want GTD Sync to preserve all possible todo.txt priorities

# In previous GTD Sync versions priority (A) is already mapped to an icon in the
# GTD mind map. As a bonus feature priorities (B) and (C) are also mapped to
# icons. Priorities (D) to (Z) are stored at the beginning of the next action
# name.
# According to todo.txt rules completed actions do not have priorities, so
# priorities as an icon or in the next action name are removed when function
# complete action is used.
# To prevent inconsistencies, like actions having more than one priority, some
# rules are applied when creating next actions and during synchronisation:
# - if a next action has a priority icon and a priority in name, the priority
#   in the name is removed
# - if a next action has more than one priority icon, all priority icons are
#   removed except the one with the highest priority
# - if a next action has priority (A), (B) or (C) in its name, it will be
#   removed and the corresponding icon will be added

  @import
  Scenario Outline: (A), (B) and (C) are imported as icons (*) , (2) and (3)
    Given I added a new next action to todo.txt
      And the next action has priority <priority>
      And I have not defined a custom icon for this priority
     When I run the Synchronise function
     Then the next action should be created under node 'New' in the GTD mind map
      And the next action node should have icon <icon>
      And the next action name should not start with <priority>

     Examples:
       | priority | icon       |
       | (A)      | 'bookmark' |
       | (B)      | 'full-2'   |
       | (C)      | 'full-3'   |

  @import
  Scenario Outline: (A), (B) and (C) are imported as custom icons
    Given I added a new next action to todo.txt
      And the next action has priority <priority>
      And I have defined a custom icon under node <node>
     When I run the Synchronise function
     Then the next action should be created under node 'New' in the GTD mind map
      And the next action node should have the custom icon added to node <node>
      And the next action name should not start with <priority>

     Examples:
       | priority | node                 |
       | (A)      | 'Icon: Today'        |
       | (B)      | 'Icon: Priority (B)' |
       | (C)      | 'Icon: Priority (C)' |

  @import
  Scenario: (D) to (Z) are imported in next action name
    Given I added a new next action to todo.txt
      And the next action has a priority in the range from (D) to (Z)
     When I run the Synchronise function
     Then the next action should be created under node 'New' in the GTD mind map
      And the next action name should start with the priority from todo.txt

  @import
  Scenario Outline: A change to (A), (B) or (C) is imported
    Given an existing next action in todo.txt
      And I have changed its priority to <priority> since last synchronisation
      And its priority uses a <icon> icon
      And in the mind map it has <old-priority>
     When I run the Synchronise function
     Then the next action in the mind map should have the associated <icon> icon
      And the next action name should not start with a priority
      And the change in priority should be logged

     Examples:
       | priority | icon    | old-priority                            |
       | (A)      | default | priority (B) or (C)                     |
       | (B)      | default | a priority in the range from (D) to (Z) |
       | (C)      | default | no priority                             |
       | (A)      | custom  | a priority in the range from (D) to (Z) |
       | (B)      | custom  | no priority                             |
       | (C)      | custom  | priority (A) or (B)                     |

  @import
  Scenario Outline: A change to range (D) to (Z) is imported
    Given an existing next action in todo.txt
      And I have changed its priority to one in the range from (D) to (Z)
      And in the mind map it has <old-priority>
     When I run the Synchronise function
     Then the next action name in the mind map should start with the priority
      And the next action should not have an icon associated to a priority
      And the change in priority should be logged

     Examples:
       | old-priority                            |
       | priority (A), (B) or (C)                |
       | a priority in the range from (D) to (Z) |
       | no priority                             |

  @import
  Scenario Outline: A removal of the priority is imported
    Given an existing next action in todo.txt
      And I have removed its priority since last synchronisation
      And in the mind map it has <old-priority>
     When I run the Synchronise function
     Then the next action in the mind map should not have a priority icon
      And the next action name should not start with a priority
      And the change in priority should be logged

     Examples:
       | old-priority                            |
       | priority (A), (B) or (C)                |
       | a priority in the range from (D) to (Z) |

  @import
  Scenario: Priority changed in both files to a different value, (A), (B) or (C)
    Given an existing next action in todo.txt
      And I have changed its priority to one in the range from (D) to (Z)
      And it had no priority at last synchronisation
      And in the mind map I have added one of the three priority icons to it
     When I run the Synchronise function
     Then the priority icon in the mind map should be unchanged
      And the next action name should not start with a priority
      And the change in priority should be logged
      And a warning of conflicting changes in priority should be logged

  @import
  Scenario: Priority changed in both files to the same value, (A), (B) or (C)
    Given an existing next action in todo.txt
      And I have changed its priority to (A), (B) or (C)
      And it had priority in the range from (D) to (Z) at last synchronisation
      And in the mind map I have removed the priority from its name
      And I have added the icon corresponding to the new priority in todo.txt
     When I run the Synchronise function
     Then the priority icon in the mind map should be unchanged
      And the next action name should not start with a priority
      And the change in priority should be logged

  @import
  Scenario: Priority changed in both files to a different value, (D) to (Z)
    Given an existing next action in todo.txt
      And I have removed its priority
      And it had priority (A), (B) or (C) at last synchronisation
      And in the mind map I have added a priority in the range from (D) to (Z)
      And I have removed the priority icon
     When I run the Synchronise function
     Then the next action in the mind map should not have a priority icon
      And the next action name should still start with the added priority
      And the change in priority should be logged
      And a warning of conflicting changes in priority should be logged

  @import
  Scenario: Priority changed in both files to the same value, (D) to (Z)
    Given an existing next action in todo.txt
      And I have changed its priority to one in the range from (D) to (Z)
      And it had no priority at last synchronisation
      And in the mind map I have added the same priority as in todo.txt
     When I run the Synchronise function
     Then the next action in the mind map should not have a priority icon
      And the next action name should still start with the added priority
      And the change in priority should be logged

  @import
  Scenario: Priority changed in both files to a different value, removed
    Given an existing next action in todo.txt
      And I have changed its priority to (A), (B) or (C)
      And it had priority in the range from (D) to (Z) at last synchronisation
      And in the mind map I have removed the priority from the name
     When I run the Synchronise function
     Then the next action in the mind map should not have a priority icon
      And the next action name should still not start with a priority
      And the change in priority should be logged
      And a warning of conflicting changes in priority should be logged

  @import
  Scenario: Priority removed in both files
    Given an existing next action in todo.txt
      And I have removed its priority
      And it had priority (A), (B) or (C) at last synchronisation
      And in the mind map I have removed the priority icon
     When I run the Synchronise function
     Then the next action in the mind map should still not have a priority icon
      And the next action name should not start with a priority
      And the change in priority should be logged

# The following checks and corrections take place during synchronisation, after
# import and before export. In addition the functions Create next action and
# Complete action trigger the same checks and corrections.

  @checks
  Scenario Outline: Remove priority when completing a next action
    Given I have selected a next action in the mind map
      And the next action has a <priority>
     When I run the Complete action function
     Then the next action node should have the 'Done' icon
      And the next action node should have attribute Done with current date
      And the <priority> should have been removed

     Examples:
       | priority                          |
       | priority icon                     |
       | priority at the start of its name |

  @checks
  Scenario Outline: Remove priority from done task during synchronisation
    Given a next action with the 'Done' icon
      And it has attribute Done with a date
      And it has a <priority>
     When I run the Synchronise function
     Then the next action node should still have the 'Done' icon
      And it should still have attribute Done with a unchanged date
      And the <priority> should have been removed
      And a warning should be logged that the priority has been removed

     Examples:
       | priority                          |
       | priority icon                     |
       | priority at the start of its name |

  @checks
  Scenario: Remove priorities when completing a next action
    Given I have selected a next action in the mind map
      And it has multiple priority icons
      And it has a priority at the start of its name
     When I run the Complete action function
     Then the next action node should have the 'Done' icon
      And the next action node should have attribute Done with current date
      And its priority icons should have been removed
      And its priority at the start of its name should have been removed

  @checks
  Scenario: Remove priorities from done task during synchronisation
    Given a next action with the 'Done' icon
      And it has attribute Done with a date
      And it has multiple priority icons
      And it has a priority at the start of its name
     When I run the Synchronise function
     Then the next action node should still have the 'Done' icon
      And it should still have attribute Done with a unchanged date
      And its priority icons should have been removed
      And its priority at the start of its name should have been removed
      And a warning should be logged that the priorities have been removed

  @checks
  Scenario: Remove priorities when completing a done action
    Given I have selected a done action in the mind map
      And it has multiple priority icons
      And it has a priority at the start of its name
     When I run the Complete action function
     Then the next action node should still have the 'Done' icon
      And it should still have attribute Done with a unchanged date
      And its priority icons should have been removed
      And its priority at the start of its name should have been removed
      And a warning should be displayed that the priorities have been removed

  @checks
  Scenario Outline: Priority icon and in name when creating a next action
    Given I have selected a <status> action in the mind map
      And it has a priority icon
      And it has a priority at the start of its name
     When I run the Create next action function
     Then the next action node should have the 'Next action' icon
      And it should have no attribute Done
      And its priority icon should have remained
      And its priority at the start of its name should have been removed
      And a warning should be displayed that priority has been removed from name

     Examples:
       | status    |
       | completed |
       | next      |

  @checks
  Scenario Outline: Multiple priority icons when creating a next action
    Given I have selected a <status> action in the mind map
      And it has multiple priority icons
     When I run the Create next action function
     Then the next action node should have the 'Next action' icon
      And it should have no attribute Done
      And it should only have the icon with the highest priority
      And a warning should be displayed that a priority icon has been removed

     Examples:
       | status    |
       | completed |
       | next      |

  @checks
  Scenario Outline: Priority from text to icon when creating a next action
    Given I have selected a <status> action in the mind map
      And it has a name starting with (A), (B) or (C)
     When I run the Create next action function
     Then the next action node should have the 'Next action' icon
      And it should have no attribute Done
      And its priority should have been removed from the name 
      And an icon of the same priority should have been added to the node

     Examples:
       | status    |
       | completed |
       | next      |

  @checks
  Scenario: Priority icon and in name when synchronising
    Given a next action in the mind map
      And it has a priority icon
      And it has a priority at the start of its name
     When I run the Synchronise function
     Then the next action node should have the 'Next action' icon
      And it should have no attribute Done
      And its priority icon should have remained
      And its priority at the start of its name should have been removed
      And a warning should be logged that priority has been removed from name

  @checks
  Scenario: Multiple priority icons when synchronising
    Given a next action in the mind map
      And it has multiple priority icons
     When I run the Synchronise function
     Then the next action node should have the 'Next action' icon
      And it should have no attribute Done
      And it should only have the icon with the highest priority
      And a warning should be logged that a priority icon has been removed

  @checks
  Scenario: Priority from text to icon when synchronising
    Given a next action in the mind map
      And it has a name starting with (A), (B) or (C)
     When I run the Synchronise function
     Then the next action node should have the 'Next action' icon
      And it should have no attribute Done
      And its priority should have been removed from the name 
      And an icon of the same priority should have been added to the node

# In the synchronisation process the export scenarios follow after the import
# and checks scenarios. The export generates a new todo.txt file from the
# current mind map and overwritest the old todo.txt file. The export is the same
# for all next actions, whether they are unchanged, changed in the mind map,
# changed by the import from todo.txt or changed by the executed checks. So for
# simplicity the import and checks scenarios describe how the situation should
# be in the mind map before export and not what should be in the todo.txt file
# after synchronisation. If the following export scenarios are OK, then it
# automatically means the export to todo.txt for all previous scenarios is also
# OK. There is also an export of completed action to done.txt. There will be no
# priorities in this export and it will be according to feature #20.

  @export
  Scenario Outline: icons (*) , (2) and (3) are exported as (A), (B) and (C)
    Given a next action in the mind map
      And the next action has icon <icon>
      And I have not defined a custom icon for this priority
     When I run the Synchronise function
     Then the next action should be exported to todo.txt
      And it should start with priority <priority>
      And its creation date should follow its priority 

     Examples:
       | icon       | priority |
       | 'bookmark' | (A)      |
       | 'full-2'   | (B)      |
       | 'full-3'   | (C)      |

  @export
  Scenario Outline: custom icons are exported as (A), (B) and (C)
    Given a next action in the mind map
      And the next action has the icon defined under node <node>
     When I run the Synchronise function
     Then the next action should be exported to todo.txt
      And it should start with priority <priority>
      And its creation date should follow its priority 

     Examples:
       | node                 | priority |
       | 'Icon: Today'        | (A)      |
       | 'Icon: Priority (B)' | (B)      |
       | 'Icon: Priority (C)' | (C)      |

  @export
  Scenario: (D) to (Z) in next action name are exported
    Given a next action in the mind map
      And its name starts with a priority in the range from (D) to (Z)
     When I run the Synchronise function
     Then the next action should be exported to todo.txt
      And it should start with the priority in the range from (D) to (Z)
      And its creation date should follow its priority 

Related

Tickets: #36

Discussion

  • Henk van den Akker

    Though assigning priorities is not part of GTD, it is part of the todo.txt format. Visualising (A), (B) and (C) meets the user request with regard to urgency and importance in these posts: [159f5d25#606f] and [717ceb59#6d21]. According to several time management methods you organize your tasks as follows, in categories A, B, C and D or quadrants 1, 2, 3 and 4:

    1. A – Tasks that are urgent and important,
    2. B – Tasks that are important but not urgent,
    3. C – Tasks that are unimportant but urgent,
    4. D – Tasks that are unimportant and not urgent.
     

    Related

    Discussion: link to projects when re-arranging
    Discussion: today icon

  • Henk van den Akker

    • labels: priorities --> priorities, todo.txt
     
  • Henk van den Akker

    • labels: priorities, todo.txt --> incompatible, todo.txt, priorities
     
  • Henk van den Akker

    • Milestone: 1.0.0 --> 2.0.0
     
  • Henk van den Akker

    • labels: incompatible, todo.txt, priorities --> incompatible, todo.txt, priorities, gherkin
     
  • Henk van den Akker

    • Closed: --> False
     

Log in to post a comment.