fix: correct date calculation logic in update_database
Some checks are pending
Docker / build (push) Waiting to run
Some checks are pending
Docker / build (push) Waiting to run
Ensure proper date subtraction by converting `date_zero` to a date object before calculating the `amount`. This prevents potential errors in date operations and ensures accurate date range handling.
This commit is contained in:
parent
003fa03811
commit
e7864eeaa1
1 changed files with 2 additions and 2 deletions
|
@ -521,12 +521,12 @@ def update_database(date_from=None, date_to=None):
|
||||||
if not (date_from) or not (date_to):
|
if not (date_from) or not (date_to):
|
||||||
date_to = date.today()
|
date_to = date.today()
|
||||||
date_from = date_to - timedelta(5)
|
date_from = date_to - timedelta(5)
|
||||||
amount = date_from - datetime.datetime.strptime(date_zero, "%Y-%m-%d")
|
amount = date_from - datetime.datetime.strptime(date_zero, "%Y-%m-%d").date()
|
||||||
else:
|
else:
|
||||||
print(str(date_from) + " to " + str(date_to))
|
print(str(date_from) + " to " + str(date_to))
|
||||||
date_from = datetime.datetime.strptime(date_from, "%Y-%m-%d")
|
date_from = datetime.datetime.strptime(date_from, "%Y-%m-%d")
|
||||||
date_to = datetime.datetime.strptime(date_to, "%Y-%m-%d")
|
date_to = datetime.datetime.strptime(date_to, "%Y-%m-%d")
|
||||||
amount = date_from - datetime.datetime.strptime(date_zero, "%Y-%m-%d")
|
amount = date_from - datetime.datetime.strptime(date_zero, "%Y-%m-%d").date()
|
||||||
|
|
||||||
count = 0
|
count = 0
|
||||||
date_aux = date_from
|
date_aux = date_from
|
||||||
|
|
Loading…
Reference in a new issue