Skip to content

Commit 0689549

Browse files
committed
fix: prevent crash in data export when error counts are None
Export endpoint now shows '-' for channels without error data instead of crashing on format(None, ",").
1 parent 2022ac1 commit 0689549

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

app/blueprints/data_bp.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,14 @@ def api_export():
133133
"|----|-----------|-------------|----------|------------|-------------|---------------|--------|--------|",
134134
]
135135
for ch in ds:
136+
corr = ch.get("correctable_errors")
137+
uncorr = ch.get("uncorrectable_errors")
138+
err_corr = f"{corr:,}" if corr is not None else "-"
139+
err_uncorr = f"{uncorr:,}" if uncorr is not None else "-"
136140
lines.append(
137141
f"| {ch.get('channel_id','')} | {ch.get('frequency','')} | {ch.get('power','')} "
138142
f"| {ch.get('snr', '-')} | {ch.get('modulation','')} "
139-
f"| {ch.get('correctable_errors', 0):,} | {ch.get('uncorrectable_errors', 0):,} "
143+
f"| {err_corr} | {err_uncorr} "
140144
f"| {ch.get('docsis_version','')} | {ch.get('health','')} |"
141145
)
142146
lines += [

0 commit comments

Comments
 (0)