Simplified the constructors of the period choosers.

This commit is contained in:
依瑪貓 2023-03-05 22:58:08 +08:00
parent eca91d32ed
commit be100ce7ec

View File

@ -109,8 +109,7 @@ class JournalPeriodChooser(PeriodChooser):
"""Constructs the journal period chooser."""
first: Transaction | None \
= Transaction.query.order_by(Transaction.date).first()
super(JournalPeriodChooser, self).__init__(
None if first is None else first.date)
super().__init__(None if first is None else first.date)
def _url_for(self, period: Period) -> str:
if period.is_default:
@ -129,8 +128,7 @@ class LedgerPeriodChooser(PeriodChooser):
"""The account."""
first: Transaction | None \
= Transaction.query.order_by(Transaction.date).first()
super(LedgerPeriodChooser, self).__init__(
None if first is None else first.date)
super().__init__(None if first is None else first.date)
def _url_for(self, period: Period) -> str:
if period.is_default:
@ -152,8 +150,7 @@ class IncomeExpensesPeriodChooser(PeriodChooser):
"""The account."""
first: Transaction | None \
= Transaction.query.order_by(Transaction.date).first()
super(IncomeExpensesPeriodChooser, self).__init__(
None if first is None else first.date)
super().__init__(None if first is None else first.date)
def _url_for(self, period: Period) -> str:
if period.is_default: