diff --git a/org/woehlke/covid19/vaccination/vaccination_model.py b/org/woehlke/covid19/vaccination/vaccination_model.py index 8ed2f354f086e15b5a14ec3dd020fd55239c706d..9dfbbc38f6bc4f3594edc60223aba25eec88335d 100644 --- a/org/woehlke/covid19/vaccination/vaccination_model.py +++ b/org/woehlke/covid19/vaccination/vaccination_model.py @@ -35,13 +35,31 @@ class VaccinationGermanyTimeline(db.Model): @classmethod def get_all_as_page(cls, page): - return db.session.query(cls).paginate(page, per_page=ITEMS_PER_PAGE) + return db.session.query(cls)\ + .order_by(cls.datum.desc())\ + .paginate(page, per_page=ITEMS_PER_PAGE) @classmethod def get_all(cls): - return db.session.query(cls).all() + return db.session.query(cls)\ + .order_by(cls.datum.desc())\ + .all() @classmethod def get_by_id(cls, other_id): - return db.session.query(cls).filter(cls.id == other_id).one() + return db.session.query(cls)\ + .filter(cls.id == other_id)\ + .one() + + @classmethod + def find_by_id(cls, other_id): + return db.session.query(cls) \ + .filter(cls.id == other_id) \ + .one_or_none() + + @classmethod + def find_by_datum(cls, other_datum): + return db.session.query(cls) \ + .filter(cls.datum == other_datum) \ + .one_or_none() diff --git a/templates/vaccination/fragment_vaccination_timeline_germany_table.html b/templates/vaccination/fragment_vaccination_timeline_germany_table.html index 6319490e5092ae6b1361ad5595675245fc5c1142..5e8f355128976503761a3dceead3ab976de52e84 100644 --- a/templates/vaccination/fragment_vaccination_timeline_germany_table.html +++ b/templates/vaccination/fragment_vaccination_timeline_germany_table.html @@ -2,26 +2,26 @@ <thead> <tr> <th scope="col">datum</th> - <th scope="col">dosen_kumulativ</th> - <th scope="col">dosen_differenz_zum_vortag</th> - <th scope="col">dosen_biontech_kumulativ</th> - <th scope="col">dosen_moderna_kumulativ</th> - <th scope="col">personen_erst_kumulativ</th> - <th scope="col">personen_voll_kumulativ</th> - <th scope="col">impf_quote_erst</th> - <th scope="col">impf_quote_voll</th> - <th scope="col">indikation_alter_dosen</th> - <th scope="col">indikation_beruf_dosen</th> - <th scope="col">indikation_medizinisch_dosen</th> - <th scope="col">indikation_pflegeheim_dosen</th> - <th scope="col">indikation_alter_erst</th> - <th scope="col">indikation_beruf_erst</th> - <th scope="col">indikation_medizinisch_erst</th> - <th scope="col">indikation_pflegeheim_erst</th> - <th scope="col">indikation_alter_voll</th> - <th scope="col">indikation_beruf_voll</th> - <th scope="col">indikation_medizinisch_voll</th> - <th scope="col">indikation_pflegeheim_voll</th> + <th scope="col">dosen kumulativ</th> + <th scope="col">dosen differenz zum vortag</th> + <th scope="col">dosen biontech kumulativ</th> + <th scope="col">dosen moderna kumulativ</th> + <th scope="col">personen erst kumulativ</th> + <th scope="col">personen voll kumulativ</th> + <th scope="col">impf quote erst</th> + <th scope="col">impf quote voll</th> + <th scope="col">indikation alter dosen</th> + <th scope="col">indikation beruf dosen</th> + <th scope="col">indikation medizinisch dosen</th> + <th scope="col">indikation pflegeheim dosen</th> + <th scope="col">indikation alter erst</th> + <th scope="col">indikation beruf erst</th> + <th scope="col">indikation medizinisch erst</th> + <th scope="col">indikation pflegeheim erst</th> + <th scope="col">indikation alter voll</th> + <th scope="col">indikation beruf voll</th> + <th scope="col">indikation medizinisch voll</th> + <th scope="col">indikation pflegeheim voll</th> </tr> </thead> <tbody>