Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix user defined range operators are omitted in results report #143

Merged
merged 4 commits into from
Oct 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/Changelog.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
2.5.0 (unreleased)
------------------

- #143 Fix user defined range operators are omitted in results report
- #142 Display custom comment for out of range results
- #141 Display reportable interim fields as result variables in results report
- #140 Refactor report sections into separate components
Expand Down
17 changes: 14 additions & 3 deletions src/senaite/impress/analysisrequest/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@

import itertools

from bika.lims import api
from bika.lims.config import MAX_OPERATORS
from bika.lims.config import MIN_OPERATORS
from bika.lims.utils import format_supsub
from bika.lims.utils import formatDecimalMark
from bika.lims.utils import to_utf8
from bika.lims.utils.analysis import format_uncertainty
from bika.lims import api
from senaite.app.supermodel import SuperModel as BaseModel
from senaite.impress import logger
from senaite.impress.decorators import returns_super_model
Expand Down Expand Up @@ -146,13 +148,22 @@ def get_formatted_uncertainty(self, analysis):

def get_formatted_specs(self, analysis):
specs = analysis.getResultsRange()

# get the min operator
min_operator = specs.get("min_operator")
min_operator = MIN_OPERATORS.getValue(min_operator, default=">")

# get the max operator
max_operator = specs.get("max_operator")
max_operator = MAX_OPERATORS.getValue(max_operator, default="<")

fs = ''
if specs.get('min', None) and specs.get('max', None):
fs = '%s - %s' % (specs['min'], specs['max'])
elif specs.get('min', None):
fs = '> %s' % specs['min']
fs = '%s %s' % (min_operator, specs['min'])
elif specs.get('max', None):
fs = '< %s' % specs['max']
fs = '%s %s' % (max_operator, specs['max'])
return formatDecimalMark(fs, self.decimal_mark)

def get_resultsinterpretation(self):
Expand Down