Commit Β·
8949df4
1
Parent(s): 616bb9e
Fix scoreboard table rendering: build each table as one chunk
Browse filesMarkdown 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>
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 |
-
|
| 334 |
-
|
| 335 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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._"
|