From fa7d46623e94f52db33ffcea4888880319436d1b Mon Sep 17 00:00:00 2001 From: Alexander Hosking Date: Fri, 12 Aug 2022 00:20:19 -0400 Subject: [PATCH] Update Math on Cycle Length --- period/cycles.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/period/cycles.py b/period/cycles.py index 596ce39..63dbd2c 100644 --- a/period/cycles.py +++ b/period/cycles.py @@ -17,7 +17,7 @@ def index(): db = get_db() current_cycle = db.execute('SELECT * from cycle ORDER BY id DESC LIMIT 1').fetchone() start_time = pendulum.parse(current_cycle['start_time']) - cycle_length = ((pendulum.now() - start_time ).days)+1 + cycle_length = ((pendulum.now() - start_time ).days) +1 db.execute( 'UPDATE cycle SET cycle_length = ?' @@ -49,7 +49,7 @@ def create(): error = "You must provide a start date" if end_time > start_time: - cycle_length = (end_time - start_time).days + cycle_length = (end_time - start_time).days +1 else: cycle_length = (pendulum.now() - start_time).days @@ -105,7 +105,7 @@ def update(id): error = "You must provide a start date" if end_time > start_time: - cycle_length = (end_time - start_time).days + cycle_length = (end_time - start_time).days + 1 else: cycle_length = (pendulum.now() - start_time).days @@ -154,7 +154,7 @@ def cycle_math(): if num > 0: this_start = pendulum.parse(cycle['start_time']) next_start = pendulum.parse(all_cycles[num-1]['start_time']) - cycle_length = (next_start - this_start).days + cycle_length = (next_start - this_start).days +1 db.execute( 'UPDATE cycle SET cycle_length = ?' ' WHERE id = ?',