bitsofchris Claude Opus 4.7 (1M context) commited on
Commit
8949df4
Β·
1 Parent(s): 616bb9e

Fix scoreboard table rendering: build each table as one chunk

Browse files

Markdown tables break if there's a blank line between the header and
the data rows. The previous code passed each header / divider / row as
a separate list element and then '\\n\\n'.join'd them, inserting a
blank line between every pair. Header rendered as a table; rows
rendered as plain paragraphs with literal pipes.

Build each metric's table as one '\\n'-joined string, then '\\n\\n'-join
the per-metric tables so they stay visually separated.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

Files changed (1) hide show
  1. app.py +13 -3
app.py CHANGED
@@ -330,9 +330,19 @@ def render_scoreboard(conn) -> str:
330
  d_cell = "β€”"
331
  rows.append(f"| **{lag_h} h-ahead** | {t_cell} | {n_cell} | {d_cell} |")
332
  if rows:
333
- lines.append(f"**{label}**")
334
- lines.append("| Lookahead | πŸ€– Toto MAE | 🌎 NWS MAE | Ξ” |\n|---|---|---|---|")
335
- lines.extend(rows)
 
 
 
 
 
 
 
 
 
 
336
  if not any_data:
337
  lines.append(
338
  "_No scored forecasts yet. The scoreboard fills in once forecasts have target hours that have already passed and matching Ecowitt actuals β€” typically within an hour or two of running._"
 
330
  d_cell = "β€”"
331
  rows.append(f"| **{lag_h} h-ahead** | {t_cell} | {n_cell} | {d_cell} |")
332
  if rows:
333
+ # Build the whole table as one chunk β€” Markdown breaks the
334
+ # table if there's a blank line between the header and rows,
335
+ # and "\n\n".join below would insert exactly that.
336
+ table = "\n".join(
337
+ [
338
+ f"**{label}**",
339
+ "",
340
+ "| Lookahead | πŸ€– Toto MAE | 🌎 NWS MAE | Ξ” |",
341
+ "|---|---|---|---|",
342
+ *rows,
343
+ ]
344
+ )
345
+ lines.append(table)
346
  if not any_data:
347
  lines.append(
348
  "_No scored forecasts yet. The scoreboard fills in once forecasts have target hours that have already passed and matching Ecowitt actuals β€” typically within an hour or two of running._"