Skip to content

Commit

Permalink
Initialize data file when empty
Browse files Browse the repository at this point in the history
  • Loading branch information
jake158 committed Mar 17, 2024
1 parent 39627bb commit e5d4964
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions pomodorodiscord/src/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ def load_file(filename, on_no_file=None):


def load_data():
return load_file(DATA_FILE, None)
return load_file(DATA_FILE, {'total_seconds_studied': 0,
'total_pomodoro_sessions': 0,
'seconds_by_date': {},
'sessions_by_date': {}
})


def save_data(data):
Expand All @@ -37,7 +41,9 @@ def save_data(data):


def load_config():
return load_file(CONFIG_FILE, {'theme': 'Default', 'sound': 'beep.mp3'})
return load_file(CONFIG_FILE, {'theme': 'Default',
'sound': 'beep.mp3'
})


def save_config(config):
Expand Down

0 comments on commit e5d4964

Please sign in to comment.