Skip to content

Commit

Permalink
Fixed json overwrite issue
Browse files Browse the repository at this point in the history
  • Loading branch information
kalle hålldén committed Aug 22, 2019
1 parent 0139e0a commit 33a3a56
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"python.pythonPath": "env/bin/python2.7"
}
9 changes: 4 additions & 5 deletions activity.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def get_activities_from_json(self, data):
return_list.append(
Activity(
name = activity['name'],
time_entries = get_time_entires_from_json(activity['time_entires']),
time_entries = self.get_time_entires_from_json(activity),
)
)
self.activities = return_list
Expand All @@ -34,9 +34,8 @@ def get_time_entires_from_json(self, data):
for entry in data['time_entries']:
return_list.append(
TimeEntry(
start_time = parser.parse(entry['post_date']),
start_time = parser.parse(entry['start_time']),
end_time = parser.parse(entry['end_time']),
total_time = parser.parse(entry['total_time']),
days = entry['days'],
hours = entry['hours'],
minutes = entry['minutes'],
Expand All @@ -60,9 +59,9 @@ def activities_to_json(self):


class Activity:
def __init__(self, name, time):
def __init__(self, name, time_entries):
self.name = name
self.time_entries = time
self.time_entries = time_entries

def serialize(self):
return {
Expand Down
Binary file modified activity.pyc
Binary file not shown.
8 changes: 4 additions & 4 deletions autotimer.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ def url_to_name(url):
string_list = url.split('/')
return string_list[2]

try:
activeList.initialize_me()
except Exception:
print('No json')
# try:
activeList.initialize_me()
# except Exception:
# print('No json')


try:
Expand Down

0 comments on commit 33a3a56

Please sign in to comment.