return days
@classmethod
- def by_date(cls, db_conn: DatabaseConnection, date: str):
+ def by_date(cls, db_conn: DatabaseConnection,
+ date: str, create: bool = False):
"""Retrieve Day by date if in DB, else return None."""
for row in db_conn.exec('SELECT * FROM days WHERE date = ?', (date,)):
return cls.from_table_row(row)
+ if create:
+ return cls(date)
return None
@property