parent
7d6a2e0a78
commit
65b925f90d
@ -151,15 +151,16 @@ def cycle_math():
|
|||||||
for num, cycle in enumerate(all_cycles):
|
for num, cycle in enumerate(all_cycles):
|
||||||
# http://127.0.0.1:5000/cycle_math
|
# http://127.0.0.1:5000/cycle_math
|
||||||
# cycle length = next start - this start
|
# cycle length = next start - this start
|
||||||
this_start = pendulum.parse(cycle['start_time'])
|
if num > 0:
|
||||||
next_start = pendulum.parse(all_cycles[num-1]['start_time'])
|
this_start = pendulum.parse(cycle['start_time'])
|
||||||
cycle_length = (next_start - this_start).days
|
next_start = pendulum.parse(all_cycles[num-1]['start_time'])
|
||||||
db.execute(
|
cycle_length = (next_start - this_start).days
|
||||||
'UPDATE cycle SET cycle_length = ?'
|
db.execute(
|
||||||
' WHERE id = ?',
|
'UPDATE cycle SET cycle_length = ?'
|
||||||
(cycle_length, cycle['id'])
|
' WHERE id = ?',
|
||||||
)
|
(cycle_length, cycle['id'])
|
||||||
db.commit()
|
)
|
||||||
|
db.commit()
|
||||||
|
|
||||||
|
|
||||||
return redirect(url_for('cycles.index'))
|
return redirect(url_for('cycles.index'))
|
Loading…
Reference in New Issue
Block a user