Skip to content

Commit

Permalink
Merge pull request #120 from PolicyEngine/apa-bugfix
Browse files Browse the repository at this point in the history
Fix bug in automatic period adjustment feature
  • Loading branch information
nikhilwoodruff authored Oct 5, 2023
2 parents 12470f0 + c1f29e4 commit 995677f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions changelog_entry.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- bump: patch
changes:
fixed:
- Fix bug affecting microsimulation runs in countries which use automatic period adjustments.
4 changes: 2 additions & 2 deletions policyengine_core/simulations/simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -474,12 +474,12 @@ def _calculate(
if variable.definition_period == MONTH and period.unit == YEAR:
if variable.quantity_type == QuantityType.STOCK:
contained_months = period.get_subperiods(MONTH)
return self.calculate(variable_name, contained_months[-1])
return self._calculate(variable_name, contained_months[-1])
else:
return self.calculate_add(variable_name, period)
elif variable.definition_period == YEAR and period.unit == MONTH:
if variable.quantity_type == QuantityType.STOCK:
return self.calculate(variable_name, period.this_year)
return self._calculate(variable_name, period.this_year)
else:
return self.calculate_divide(variable_name, period)

Expand Down

0 comments on commit 995677f

Please sign in to comment.