fix(kattis): fix nil display_name in contest picker (#332)

## Problem

`ContestSummary.display_name` defaults to `None`, which serializes to
JSON `null` → Lua `vim.NIL`. The contest picker displayed "vim.NIL" for
every entry. Additionally, `start_time` was always stored even when
null, because `vim.NIL` is truthy in Lua.

## Solution

Pass `display_name=name` explicitly in `_parse_contests_page` so JSON
never emits `null`. In `cache.lua` `set_contest_summaries`, coerce
`display_name` via a `~= vim.NIL` guard and apply the same guard before
storing `start_time`.
This commit is contained in:
Barrett Ruth 2026-03-06 13:25:17 -05:00 committed by GitHub
parent b6d3df03e3
commit ba5ae8df69
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 7 additions and 3 deletions

View file

@ -123,7 +123,9 @@ def _parse_contests_page(html: str) -> list[ContestSummary]:
start_time = int(dt.timestamp())
except Exception:
pass
results.append(ContestSummary(id=cid, name=name, start_time=start_time))
results.append(
ContestSummary(id=cid, name=name, display_name=name, start_time=start_time)
)
return results