Sep-12-2022, 08:52 AM
(Sep-11-2022, 10:10 PM)deanhystad Wrote: What is your thinking here? What is this function supposed to do?
def longest_streak(db, name): cur = db.cursor() cur.execute('SELECT streak FROM count WHERE name=?', (name,)) long = cur.fetchall() for row in long: print("Here is your longest streak ") print(row[0])
This function suppose to find the longest streak of given habit.
the user enter the name of the habit name of the habit than
command line interface
if long == "Longest Streak Of Specific Habit":
lon_streak = questionary.text("Enter the name of habit for which you want to see the longest streak").ask()
get_longest_streak(db, lon_streak)
analytic.py file
def get_longest_streak(db, name):
"""
:param db: an initiated habit data
:param streak:number of days of continuity
:return:number of days in integer
"""
list = longest_streak(db, name)
return list