days.sort()
return days
+ @classmethod
+ def by_date(cls, db_conn: DatabaseConnection, date: str):
+ """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)
+ return None
+
@property
def weekday(self):
"""Return what weekday matches self.date."""