From c3af38e0f97e72779facc31d39131d98ffa7346a Mon Sep 17 00:00:00 2001 From: Christian Nennemann Date: Fri, 22 May 2026 11:41:02 +0200 Subject: [PATCH] =?UTF-8?q?fix(webui):=20timeline=20embedding=20landscape?= =?UTF-8?q?=20=E2=80=94=20sort=20points=20chronologically?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The animated t-SNE landscape delivered points in embedding-dict order, not chronological order. The front-end cumulative filter (p.month <= frame) then inserted new points mid-array between frames, so Plotly's index-based frame transition animated existing markers flying to other drafts' coordinates. Visible symptom: a couple of points jumping around instead of a growing map. Sorting points by (month, name) makes each frame's per-category marker list an append-only prefix of the next, so transitions only add markers. Verified on the live DB: 188 non-append-only frame transitions before, 0 after. --- src/webui/data/analysis.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/webui/data/analysis.py b/src/webui/data/analysis.py index 155ece0..71c30cd 100644 --- a/src/webui/data/analysis.py +++ b/src/webui/data/analysis.py @@ -559,6 +559,12 @@ def _compute_timeline_animation_data(db: Database) -> dict: "month": month, }) + # Deliver points in chronological order so the front-end's cumulative + # filter (p.month <= frame) is append-only. Otherwise new points get + # inserted mid-array and Plotly's index-based frame transition animates + # existing markers flying to other drafts' coordinates ("jumping points"). + points.sort(key=lambda p: (p["month"], p["name"])) + months = sorted(month_set) # Convert defaultdict to plain dict for JSON cat_monthly_plain = {m: dict(cats) for m, cats in category_monthly.items()}