Skip to content

Commit 652cd38

Browse files
authored
Update PDF report text (#31)
1 parent b0cac74 commit 652cd38

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/scaup/crud/pdf.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,16 @@ def _add_unit(key: str, val: str | bool | int | float):
5656
return new_val
5757

5858

59+
def _rewrite_title(text: str):
60+
if text == "useTomoEpu":
61+
return "Use Tomo EPU"
62+
63+
if text == "gridCrossGrating":
64+
return "Cross Grating/Carbon Grid"
65+
66+
return pascal_to_title(text)
67+
68+
5969
class ConsigneeAddress(object):
6070
"""This is a class to provide a global cache for the consignee address, to prevent hitting the shipping service
6171
with too many redundant requests."""
@@ -483,7 +493,7 @@ def generate_report(shipment_id: int, token: str):
483493
)
484494

485495
# TODO: rethink this once we're using user-provided templates
486-
pre_session_table = [(pascal_to_title(key), _add_unit(key, value)) for key, value in pre_session.details.items()]
496+
pre_session_table = [(_rewrite_title(key), _add_unit(key, value)) for key, value in pre_session.details.items()]
487497

488498
pdf = ReportPDF(shipment)
489499
pdf.add_page()
@@ -499,7 +509,7 @@ def generate_report(shipment_id: int, token: str):
499509
pdf.add_table(session_table, width=100, caption="Session")
500510

501511
pdf.set_xy(x=140, y=20)
502-
pdf.add_table(pre_session_table, width=100, caption="Data Collection Parameters")
512+
pdf.add_table(pre_session_table, width=100, caption="Requested Data Collection Parameters")
503513

504514
headers = {
505515
"Content-Disposition": (

0 commit comments

Comments
 (0)