Compare commits
No commits in common. "219c080bf5a51680e8a22190c4c977f3bab06ec2" and "5c0a2b588644b4d8ad6148c2582a551d770f4261" have entirely different histories.
219c080bf5
...
5c0a2b5886
@ -76,34 +76,6 @@ class Habit:
|
|||||||
datetime.strptime(rawTracking[2], "%Y-%m-%dT%H:%M:%S.%f")))
|
datetime.strptime(rawTracking[2], "%Y-%m-%dT%H:%M:%S.%f")))
|
||||||
return trackings
|
return trackings
|
||||||
|
|
||||||
def getStreak(self):
|
|
||||||
streak = 0
|
|
||||||
trackings = []
|
|
||||||
for rawTracking in get_habitTrackings_by_habit_id(self.id):
|
|
||||||
trackings.append(HabitTrackings(datetime.strptime(rawTracking[2], "%Y-%m-%d")))
|
|
||||||
|
|
||||||
trackings.sort(reverse=True)
|
|
||||||
if current_date == tracking[0]:
|
|
||||||
streak += 1
|
|
||||||
for habitdate in trackings[1:]:
|
|
||||||
future_date = habitdate - relativedelta(day=1)
|
|
||||||
if future_date - habitdate == 0-0-1:
|
|
||||||
streak + 1
|
|
||||||
|
|
||||||
|
|
||||||
future_date = habitdate - relativedelta(day=1)
|
|
||||||
|
|
||||||
for habitdate in trackings:
|
|
||||||
current_date = date.today()
|
|
||||||
if current_date == habitdate or current_date == habitdate - relativedelta(day=1):
|
|
||||||
streak += 1
|
|
||||||
|
|
||||||
future_date = habitdate - relativedelta(day=1)
|
|
||||||
|
|
||||||
return streak
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def fill_statistics(self):
|
def fill_statistics(self):
|
||||||
count = 0
|
count = 0
|
||||||
self.checked = False
|
self.checked = False
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user