Skip to content

Commit

Permalink
Fix mixed sorted PoC groups depending on the sample analyses (senaite…
Browse files Browse the repository at this point in the history
…#124)

* Fix mixed PoC sorting depending on analyses set

* Changelog updated
  • Loading branch information
ramonski authored Jul 25, 2022
1 parent 5bb3988 commit fc40ca3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/Changelog.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
2.3.0 (unreleased)
------------------

- no changes yet
- #124 Fix mixed sorted PoC groups depending on the sample analyses


2.2.0 (2022-06-10)
Expand Down
7 changes: 6 additions & 1 deletion src/senaite/impress/analysisrequest/reportview.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,12 @@ def get_analyses_by_poc(self, model_or_collection):
"""Groups the given analyses by their point of capture
"""
analyses = self.get_analyses(model_or_collection)
return self.group_items_by("PointOfCapture", analyses)
groups = self.group_items_by("PointOfCapture", analyses)
# Ensure always alphabetic sorting of PoC
by_poc = OrderedDict()
for key in sorted(groups):
by_poc[key] = groups[key]
return by_poc

def get_analyses_by_category(self, model_or_collection):
"""Groups the Analyses by their Category
Expand Down

0 comments on commit fc40ca3

Please sign in to comment.