Skip to content

Commit

Permalink
Merge pull request #95 from topas-rec/recurring_tasks_threshold_no_in…
Browse files Browse the repository at this point in the history
…crement_on_first_completition

Make threshold date recur correctly the first time
  • Loading branch information
oroulet authored May 15, 2018
2 parents 32bb7f3 + 0946528 commit 547e63e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 3 additions & 2 deletions examples/todo.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
(A) Make peace between Cylons and humans +PeaceProject
(A) Review NCMR Log +Admin @work t:2017-12-22 rec:+1b due:2017-12-22
(B) Report to <i>Admiral Adama</i> about FTL @CIC +GalacticaRepairs due:2013-05-24
(C) 2016-12-08 Feed Schrodinger's Cat rec:+1d due:2014-02-23
(C) Upgrade jump drives with Cylon technology +GalacticaRepairs
2016-12-12 +GalacticaRepairs Check hull integrity rec:+7b due:2016-12-12
Check for <b>DRADIS</b> contact @CIC
Check if http://google.com is available
Download code from <br/> https://github.com/QTodoTxt/QTodoTxt/archive/master.zip <br/>and give it a try!
Find the question due:2017-06-10 rec:6d t:2017-06-09
Think about <u>future</u> t:2099-12-31
x 2016-02-21 (B) Seal ship's cracks with biomatter +GalacticaRepairs
h:1 @CIC +GalacticaRepairs @work
Find the question due:2017-06-10 rec:6d t:2017-06-09
x 2016-02-21 (B) Seal ship's cracks with biomatter +GalacticaRepairs
3 changes: 2 additions & 1 deletion qtodotxt2/lib/tasklib.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,13 +367,14 @@ def _incrWorkDays(startDate, daysToIncrement):

def _recurWorkDays(task):
if task.recursion.mode == RecursiveMode.originalDueDate:
next_due_date = _incrWorkDays(date.today(), int(task.recursion.increment))
next_due_date = _incrWorkDays(task.due, int(task.recursion.increment))
else:
next_due_date = _incrWorkDays(date.today(), int(task.recursion.increment))
new = Task(task.text)
new.due = next_due_date
if new.threshold:
delta2 = task.due - task.threshold #FIXME: this might be wrong, maybe we should add weekends...
new.threshold = new.due
new.threshold += delta2
return new

Expand Down

0 comments on commit 547e63e

Please sign in to comment.