diff options
| author | dam <dam@gudinoff> | 2023-04-19 00:08:32 +0100 |
|---|---|---|
| committer | dam <dam@gudinoff> | 2023-04-19 00:08:32 +0100 |
| commit | adff8aaceb63d3e679f0f5cd4c5f93146ad8f012 (patch) | |
| tree | a7fd702df9bc4585de3aeb960d056aecdfade815 /ttt.jai | |
| parent | fde8632915efd5c0f3233c65ea4e1d9191023b0f (diff) | |
| download | task-time-tracker-adff8aaceb63d3e679f0f5cd4c5f93146ad8f012.tar.zst task-time-tracker-adff8aaceb63d3e679f0f5cd4c5f93146ad8f012.zip | |
Fixed bugs on import_from_csv.
Diffstat (limited to 'ttt.jai')
| -rw-r--r-- | ttt.jai | 11 |
1 files changed, 4 insertions, 7 deletions
@@ -241,7 +241,7 @@ is_empty_string :: (str: string) -> bool { // Prints, on row y and column x, the time using 5 characters centered on space. // Returns the result of a call to mvprintw. -mvprintw_time :: (y: s32, x: s32, time: s64, space: s32) -> int { // BUG Setting a timer to 99.9y shows 100y. +mvprintw_time :: (y: s32, x: s32, time: s64, space: s32) -> int { TIME_CHARS :: 5; assert(space >= TIME_CHARS); @@ -730,11 +730,8 @@ import_from_csv :: (db: *Database, path: string) -> bool { truncate_string(xx task.name, name_length); 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); - } + for csv_values + task.times[it_index] = string_to_int(it); add_task(db, *task); // TODO Check this old code and remove it if not necessary. @@ -746,7 +743,7 @@ import_from_csv :: (db: *Database, path: string) -> bool { } // Adjust selected task. - if (db.selected_idx < 0) db.selected_idx = 0; + if (db.selected_idx < 0 && db.tasks.count > 0) db.selected_idx = 0; return true; } |
