Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __load_income_in_period_query(
book: Book, account_ids: List[hex], in_model) -> List[Split]:
""" Load all data by using the query directly """
date_from = in_model.date_from
date_to = in_model.date_to
log(DEBUG, "fetching data for period %s - %s", date_from, date_to)
query = (book.query(Split)
.join(Transaction)
.join(Account)
.filter(Transaction.post_date >= date_from, Transaction.post_date <= date_to,
Account.guid.in_(account_ids))
.order_by(Transaction.post_date)
)
if in_model.currency:
query = (query
.join(Commodity)
.filter(Commodity.mnemonic == in_model.currency)
)
return query.all()
def get_list(self, ids: List[str]) -> List[Account]:
""" Loads accounts by the ids passed as an argument """
query = (
self.query
.filter(Account.guid.in_(ids))
)
return query.all()