Skip to content

Commit

Permalink
reverse the budget name search: look for a budget version with the na…
Browse files Browse the repository at this point in the history
…me, ce_budget_versions contain all the budget versions, ce_budget contain only the original budget name if there is a renaming
  • Loading branch information
rienafairefr committed Jan 21, 2017
1 parent f9fb65b commit 59b0961
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions pynYNAB/Client.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,10 @@ def sync(self):
self.first = False

self.sync_obj(self.catalog, 'syncCatalogData', extra=dict(user_id=self.connection.user_id))
for catalogbudget in self.catalog.ce_budgets:
if catalogbudget.budget_name == self.budget_name:
for budget_version in self.catalog.ce_budget_versions:
if budget_version.budget_id == catalogbudget.id:
self.budget_version_id = budget_version.id

for budget_version in self.catalog.ce_budget_versions:
if budget_version.version_name == self.budget_name:
self.budget_version_id = budget_version.id
if self.budget_version_id is None:
raise BudgetNotFound()
self.sync_obj(self.budget, 'syncBudgetData',
Expand Down

0 comments on commit 59b0961

Please sign in to comment.