Skip to content

Commit

Permalink
fix: allow more than one allocate in a given month
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Ryall committed Jun 28, 2024
1 parent 6c8099e commit d5574aa
Showing 1 changed file with 25 additions and 10 deletions.
35 changes: 25 additions & 10 deletions src/fava_envelope/modules/beancount_envelope.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,22 +348,37 @@ def _calculate_budget_activity(self):
temp
)
else:
self.envelope_df.loc[
account, (month_str, "budgeted")
] = Decimal(0.00)
self.envelope_df.loc[
account, (month_str, "activity")
] = Decimal(temp)
self.envelope_df.loc[
account, (month_str, "available")
] = Decimal(0.00)
self.envelope_df.loc[account, (month_str, "budgeted")] = (
Decimal(0.00)
)
self.envelope_df.loc[account, (month_str, "activity")] = (
Decimal(temp)
)
self.envelope_df.loc[account, (month_str, "available")] = (
Decimal(0.00)
)

def _calc_budget_budgeted(self):
# rows = {}
for e in self.entries:
if isinstance(e, Custom) and e.type == self.etype:
if e.values[0].value == "allocate":
month = f"{e.date.year}-{e.date.month:02}"
try:
_ = self.envelope_df.loc[
e.values[1].value, (month, "budgeted")
]
except KeyError:
self.envelope_df.loc[
e.values[1].value, (month, "budgeted")
] = Decimal(0.00)

self.envelope_df.loc[
e.values[1].value, (month, "budgeted")
] = Decimal(e.values[2].value)
] = Decimal(
self.envelope_df.loc[
e.values[1].value, (month, "budgeted")
]
) + Decimal(
e.values[2].value
)

0 comments on commit d5574aa

Please sign in to comment.