mirror of
https://github.com/MadsLorentzen/ai-job-search.git
synced 2026-09-17 00:26:26 +00:00
fix(salary): print the privacy footnote only when a row rendered N/A* (#475)
format_entry appended "* N/A = Too few employees to publish (privacy)" under every category table, including one where every row has an index, so the output asserted a suppression that never happened - the residual noted on #470. Set a flag in the N/A* branch and print the footnote only when it fired; a table with a suppressed row renders exactly as before. Two FormatEntryTests cases pin both directions; the "omitted" case fails on master.
This commit is contained in:
+7
-1
@@ -319,6 +319,7 @@ def format_entry(entry, metadata):
|
||||
lines.append(f" {'Category':<22} {'Count':>6} {index_label:>8} {'vs Baseline':>10}")
|
||||
lines.append(f" {'-'*50}")
|
||||
|
||||
suppressed = False # did any row render its index as N/A*?
|
||||
for label, data in categories.items():
|
||||
display_label = label.replace("_", " ").title()
|
||||
count = data.get("count")
|
||||
@@ -339,9 +340,14 @@ def format_entry(entry, metadata):
|
||||
else:
|
||||
index_str = "N/A*"
|
||||
diff_str = ""
|
||||
suppressed = True
|
||||
lines.append(f" {display_label:<22} {count_str:>6} {index_str:>8} {diff_str:>10}")
|
||||
|
||||
lines.append(f"\n * N/A = Too few employees to publish (privacy)")
|
||||
# The footnote explains the N/A* marker; printing it under a table with
|
||||
# no such row asserts a privacy suppression that did not happen.
|
||||
lines.append("")
|
||||
if suppressed:
|
||||
lines.append(" * N/A = Too few employees to publish (privacy)")
|
||||
if metadata.get("baseline_description"):
|
||||
lines.append(f" {metadata['baseline_description']}")
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user