def load_file(self) -> None: all_entries = self.ledger.all_entries self.links = getters.get_all_links(all_entries) self.tags = getters.get_all_tags(all_entries) self.years = get_active_years( all_entries, self.ledger.fava_options["fiscal-year-end"] ) account_ranker = ExponentialDecayRanker( sorted(self.ledger.accounts.keys()) ) currency_ranker = ExponentialDecayRanker() payee_ranker = ExponentialDecayRanker() transactions = self.ledger.all_entries_by_type[Transaction] for txn in transactions: if txn.payee: payee_ranker.update(txn.payee, txn.date) for posting in txn.postings: account_ranker.update(posting.account, txn.date) currency_ranker.update(posting.units.currency, txn.date) if posting.cost: currency_ranker.update(posting.cost.currency, txn.date) self.accounts = account_ranker.sort() self.currencies = currency_ranker.sort() self.payees = payee_ranker.sort()
def load_file(self): all_entries = self.ledger.all_entries self.links = getters.get_all_links(all_entries) self.tags = getters.get_all_tags(all_entries) self.years = list(getters.get_active_years(all_entries))[::-1] account_ranker = ExponentialDecayRanker( sorted(self.ledger.accounts.keys())) currency_ranker = ExponentialDecayRanker( self.ledger.options['commodities']) payee_ranker = ExponentialDecayRanker() transactions = self.ledger.all_entries_by_type[Transaction] for txn in transactions: if txn.payee: payee_ranker.update(txn.payee, txn.date) for posting in txn.postings: account_ranker.update(posting.account, txn.date) currency_ranker.update(posting.units.currency, txn.date) if posting.cost: currency_ranker.update(posting.cost.currency, txn.date) self.accounts = account_ranker.sort() self.currencies = currency_ranker.sort() self.payees = payee_ranker.sort()
def test_get_all_links(self): entries = loader.load_string(TEST_INPUT)[0] links = getters.get_all_links(entries) self.assertEqual(['ee89ada94a39'], links)