Skip to content

Commit 96c0dbf

Browse files
committed
Inject formatted result field
1 parent 81b640c commit 96c0dbf

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

src/senaite/jsonapi/api.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,14 @@ def get_info(brain_or_object, endpoint=None, complete=False):
370370
# add the snapshot version of this content
371371
info["version"] = snapshot.get_version(obj)
372372

373+
# Inject formatted result for analysis objects.
374+
# getFormattedResult() handles detection limits, result options,
375+
# scientific notation, etc. html=False gives plain text output
376+
# (e.g. "< 0.1" instead of "&lt; 0.1").
377+
get_formatted = getattr(obj, "getFormattedResult", None)
378+
if callable(get_formatted):
379+
info["getFormattedResult"] = get_formatted(html=False)
380+
373381
# update the data set with the workflow information
374382
# -> only possible if `?complete=yes&workflow=yes`
375383
if req.get_workflow(False):

0 commit comments

Comments
 (0)