summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarcinzelent <marcin@zelent.net>2017-08-01 16:59:14 +0200
committermarcinzelent <marcin@zelent.net>2017-08-01 16:59:14 +0200
commite99a6affae723cd4735f7504f892739508e9345b (patch)
tree47c73ab5d7426f4b628b99493b8ac28d4bfd15a2 /timetracker.c
parent411d68964f18a5481c67d82da71dfde123d83ee2 (diff)
Save to file after stopping new activity.
Diffstat (limited to 'timetracker.c')
-rw-r--r--timetracker.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/timetracker.c b/timetracker.c
index e99f950..dc9a922 100644
--- a/timetracker.c
+++ b/timetracker.c
@@ -86,8 +86,8 @@ void print_new_activity(WINDOW *win)
mvwprintw(win, 1, 1, "Current activity: %s", new_activity.description);
mvwprintw(win, 2, 1, "Start time: %s", start_time);
mvwprintw(win, 3, 1, "Duration: %ld", (time_now - new_activity.start_time)/60);
-
- wrefresh(win);
+
+ wrefresh(win);
}
void print_activities(WINDOW *win)
@@ -127,6 +127,8 @@ void stop_new_activity()
break;
}
}
+
+ save_to_file(create_data_files());
}
void edit_new_activity()
@@ -188,4 +190,5 @@ void load_file(char *filepath)
fp = fopen(filepath, "r");
while (EOF != fscanf(fp, "%ld;%ld;%s", &activities_list[i].start_time, &activities_list[i].end_time,
activities_list[i].description)) i++;
+ fclose(fp);
}