From 65468b9e712e77feb972b785328110a4e375d16b Mon Sep 17 00:00:00 2001 From: dam Date: Thu, 6 Apr 2023 15:58:16 +0100 Subject: Fixed bug: add times when importing CSV data. --- ttt.jai | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/ttt.jai b/ttt.jai index 9c2dcb9..d16efce 100644 --- a/ttt.jai +++ b/ttt.jai @@ -831,16 +831,18 @@ import_from_csv :: (db: *Database, path: string) -> bool { if success == false break; task: Task; - values := split(line, ","); // TODO Temporary memory... if file is too big this may break. + csv_values := split(line, ","); // TODO Temporary memory... if file is too big this may break. // Import task name. - name_length := min(task.name.count, values[0].count); - memcpy(task.name.data, values[0].data, name_length); + name_length := min(task.name.count, csv_values[0].count); + memcpy(task.name.data, csv_values[0].data, name_length); truncate_string(xx task.name, name_length); - advance(*values); - for values { - task.times[it_index] = string_to_int(it); + advance(*csv_values); + for csv_values { + parsed_value := string_to_int(it); + task.times[it_index] = parsed_value; + db.total_times[it_index] = add_int64(db.total_times[it_index], parsed_value); } add_task(db, *task); -- cgit v1.2.3