Skip to content

Commit

Permalink
Trigger recalculation of dependants if uncertainty changes (#2673)
Browse files Browse the repository at this point in the history
* Trigger recalculation of dependants if uncertainty changes

* Changelog updated

---------

Co-authored-by: Jordi Puiggené <[email protected]>
  • Loading branch information
ramonski and xispa authored Feb 12, 2025
1 parent a7a4bc2 commit 8a8be50
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Changelog
2.6.0 (unreleased)
------------------

- #2673 Trigger recalculation of dependants if uncertainty changes
- #2674 Fix partitions not displayed correctly in batch samples listing
- #2672 Fix rejected sample analyses are re-added on profile removal
- #2670 Flush calculated result if dependency is flushed
Expand Down
6 changes: 5 additions & 1 deletion src/senaite/core/datamanagers/content/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@
from zope.component import adapter


# Fields that cause a recalculation of dependants
TRIGGER_RECALCULATE_FIELDS = ["Result", "Uncertainty"]


@adapter(IRoutineAnalysis)
class RoutineAnalysisDataManager(DataManager):
"""Data Manager for Routine Analyses
Expand Down Expand Up @@ -107,7 +111,7 @@ def set(self, name, value):
self.context.setInterimValue(name, value)

# recalculate dependent results for result and interim fields
if name == "Result" or name in interim_keys:
if name in TRIGGER_RECALCULATE_FIELDS or name in interim_keys:
updated_objects.add(self.context)
updated_objects.update(self.recalculate_results(self.context))

Expand Down

0 comments on commit 8a8be50

Please sign in to comment.