if milestone:
# get milestone date range
cur = db.cursor() cur.execute('SELECT due_date FROM milestones WHERE name = ?', (milestone,))
date_end = cur.fetchone()[0] cur.execute('SELECT MAX(due_date), MAX(due_date) < date(CURRENT_TIMESTAMP) FROM milestones WHERE due_date < ?', (date_end,)) (date_start, in_milestone) = cur.fetchone()
# if we are already within the milestone, start at the previous
# milestone's end date; if we are before, start at the beginning of the
# entire cycle, to allow planning
if in_milestone:
ms_sql = "AND w.milestone='%s' AND date >= '%s' AND date <= '%s'" % ( escape_sql(milestone), date_start, date_end)
else:
ms_sql = "AND w.milestone='%s' AND date <= '%s'" % ( escape_sql(milestone), date_end)
Found the auto-reset:
if milestone:
cur.execute( 'SELECT due_date FROM milestones WHERE name = ?', (milestone,))
cur.execute( 'SELECT MAX(due_date), MAX(due_date) < date(CURRENT_ TIMESTAMP) FROM milestones WHERE due_date < ?', (date_end,))
(date_ start, in_milestone) = cur.fetchone()
# get milestone date range
cur = db.cursor()
date_end = cur.fetchone()[0]
# if we are already within the milestone, start at the previous
escape_ sql(milestone) , date_start, date_end)
escape_ sql(milestone) , date_end)
# milestone's end date; if we are before, start at the beginning of the
# entire cycle, to allow planning
if in_milestone:
ms_sql = "AND w.milestone='%s' AND date >= '%s' AND date <= '%s'" % (
else:
ms_sql = "AND w.milestone='%s' AND date <= '%s'" % (
I'll have to think about that a bit.
Thanks,
James