Skip to content

Commit

Permalink
Fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
nikhilwoodruff committed Oct 5, 2023
1 parent 12470f0 commit c1f29e4
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])

Check warning on line 477 in policyengine_core/simulations/simulation.py

View check run for this annotation

Codecov / codecov/patch

policyengine_core/simulations/simulation.py#L477

Added line #L477 was not covered by tests
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)

Check warning on line 482 in policyengine_core/simulations/simulation.py

View check run for this annotation

Codecov / codecov/patch

policyengine_core/simulations/simulation.py#L482

Added line #L482 was not covered by tests
else:
return self.calculate_divide(variable_name, period)

Expand Down

0 comments on commit c1f29e4

Please sign in to comment.