Skip to content

Commit

Permalink
Fix 401k calculator
Browse files Browse the repository at this point in the history
- Accounts had : and . in it, so replaced all of the : with .'s.
- Field daysOfYear was wrong, should be dayOfYear
  • Loading branch information
rerobins committed Jan 8, 2018
1 parent e0315af commit fd49d63
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions gnucash_reports/reports/retirement_401k.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ def retirement_401k_report(definition):
today = date.today()
beginning_of_year = date(today.year, 1, 1)

retirement_accounts = [account_name.replace(':', '.') for account_name in retirement_accounts]

for account_name in income_accounts:
account = get_account(account_name)

Expand All @@ -31,11 +33,13 @@ def retirement_401k_report(definition):

for income_split in parent.splits:

if income_split.account.fullname in retirement_accounts:
account_full_name = income_split.account.fullname.replace(':', '.')

if account_full_name in retirement_accounts:
contribution_total += income_split.value

return dict(contributionLimit=contribution_limit, contribution=contribution_total,
daysOfYear=(today - beginning_of_year).days + 1,
dayOfYear=(today - beginning_of_year).days + 1,
daysInYear=(date(today.year, 12, 31) - beginning_of_year).days + 1)


Expand Down

0 comments on commit fd49d63

Please sign in to comment.