File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -100,7 +100,7 @@ def __init__(
100100 impact_computation_strategy or ImpactCalcComputation ()
101101 )
102102 LOGGER .debug ("Computing risk periods" )
103- self ._risk_periods_calculators = self . _calc_risk_periods ( snapshots_list )
103+ self ._risk_periods_calculators = None
104104
105105 def _reset_metrics (self ):
106106 for metric in POSSIBLE_METRICS :
@@ -168,7 +168,7 @@ def risk_transf_attach(self, value):
168168 @property
169169 def risk_periods (self ) -> list :
170170 """The computed risk periods from the snapshots."""
171- if not self ._risk_period_up_to_date :
171+ if self . _risk_period_up_to_date is None or not self ._risk_period_up_to_date :
172172 self ._risk_periods_calculators = self ._calc_risk_periods (self ._snapshots )
173173 self ._risk_period_up_to_date = True
174174
@@ -211,7 +211,9 @@ def pairwise(container: list):
211211 risk_transf_attach = self .risk_transf_attach ,
212212 calc_residual = self ._calc_residual ,
213213 )
214- for start_snapshot , end_snapshot in pairwise (snapshots )
214+ for start_snapshot , end_snapshot in pairwise (
215+ sorted (snapshots , key = lambda snap : snap .date )
216+ )
215217 ]
216218
217219 @classmethod
You can’t perform that action at this time.
0 commit comments