From 0354b540cae563ee4ec1f69e4d788a010c503cb8 Mon Sep 17 00:00:00 2001 From: igor Date: Tue, 3 Mar 2026 19:12:06 -0800 Subject: [PATCH] Fixed timeline displaying aggregate activity info. --- timetracker.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/timetracker.c b/timetracker.c index 597c838..69b98be 100644 --- a/timetracker.c +++ b/timetracker.c @@ -437,7 +437,7 @@ int main(int argc, char *argv[]) DrawTextEx(state.font, index_buf, (Vector2){ rect.x + 10.0f, rect.y + 10.0f }, state.font_size - 5.0f, 2, BLACK); } - // NOTE: This is rendered last because a popup has to flow above everything else. + // NOTE: This is rendered last because the popups have to float above everything else. for(U32 i = 0; i <= current_activity; i++) { F32 start_x = floor((F32)(activities[i].began - lower_bound_s) / (F32)(upper_bound_s - lower_bound_s) * (F32)(state.window_w)); F32 end_x = floor(((F32)(activities[i].ended - lower_bound_s) / (F32)(upper_bound_s - lower_bound_s)) * (F32)(state.window_w)); @@ -454,10 +454,14 @@ int main(int argc, char *argv[]) DrawRectangleRounded((Rectangle){ start_x, 40, rect_w, (F32)(activity_time_d.y + activity_type_d.y) }, 0.3f, 100, BLACK); DrawRectangleRoundedLinesEx((Rectangle){ start_x, 40, rect_w, (F32)(activity_time_d.y + activity_type_d.y) }, 0.3f, 100, 2.0f, DARKGRAY); + local_persist char buffer[24]; + Hours time = break_time(activities[i].ended - activities[i].began); + snprintf(buffer, sizeof(buffer), "%02llu:%02llu:%02llu", time.hours, time.minutes, time.seconds); + // FIXME: We are pulling the aggregate seconds here from the activity statisctics. This is wrong. // FIXME: The moreover DrawTextEx(state.font, str_activity_type, (Vector2){ start_x, 40.0f }, state.font_size - 5.0f, 2, WHITE); - DrawTextEx(state.font, activities_stats[activities[i].type].seconds_str, (Vector2){ start_x, 40.0f + (F32)(activity_type_d.y) }, state.font_size - 10.0f, 2, WHITE); + DrawTextEx(state.font, buffer, (Vector2){ start_x, 40.0f + (F32)(activity_type_d.y) }, state.font_size - 10.0f, 2, WHITE); } } EndDrawing();