diff --git a/src/flask_covid19/blueprints/data_who/who_model_import.py b/src/flask_covid19/blueprints/data_who/who_model_import.py index 30c3045b86273d4a74f7437366cd3e3ff96d596f..920b796baec767b8ff5b67cecd5a5383826dd507 100644 --- a/src/flask_covid19/blueprints/data_who/who_model_import.py +++ b/src/flask_covid19/blueprints/data_who/who_model_import.py @@ -7,6 +7,9 @@ class WhoImport(AllImport): __tablename__ = 'who_import' __mapper_args__ = {'concrete': True} + def __str__(self): + return self.datum.isoformat() + " " + self.country_code + " " + self.country + " " + str(self.row_imported) + id = db.Column(db.Integer, primary_key=True) datum = db.Column(db.Date, nullable=False) processed_update = db.Column(db.Boolean, nullable=False) @@ -21,30 +24,6 @@ class WhoImport(AllImport): who_region = db.Column(db.String(255), nullable=False) date_reported = db.Column(db.String(255), nullable=False) - def __str__(self): - return self.datum.isoformat() + " " + self.country_code + " " + self.country + " " + str(self.row_imported) - - @classmethod - def remove_all(cls): - for one in cls.get_all(): - db.session.delete(one) - db.session.commit() - return None - - @classmethod - def get_all_as_page(cls, page): - return db.session.query(cls).order_by( - cls.date_reported.desc(), - cls.country.asc() - ).paginate(page, per_page=ITEMS_PER_PAGE) - - @classmethod - def get_all(cls): - return db.session.query(cls).order_by( - cls.date_reported.desc(), - cls.country.asc() - ).all() - @classmethod def get_regions(cls): return db.session.query(cls.who_region)\ @@ -173,6 +152,9 @@ class WhoFlat(AllFlat): __tablename__ = 'who_import_flat' __mapper_args__ = {'concrete': True} + def __str__(self): + return self.datum.isoformat() + " " + self.location_code + " " + self.location + " " + str(self.location_group) + id = db.Column(db.Integer, primary_key=True) # date_reported_import_str = db.Column(db.String(255), nullable=False) @@ -202,13 +184,3 @@ class WhoFlat(AllFlat): country = db.Column(db.String(255), nullable=False) who_region = db.Column(db.String(255), nullable=False) date_reported = db.Column(db.String(255), nullable=False) - - def __str__(self): - return self.datum.isoformat() + " " + self.location_code + " " + self.location + " " + str(self.location_group) - - @classmethod - def remove_all(cls): - for one in cls.get_all(): - db.session.delete(one) - db.session.commit() - return None diff --git a/src/mq.py b/src/mq.py index b3a34d96c5ec213dcead87c70b82c4cff02c243d..56d3de0ff2fa37d308b2a6cf22dbfbd0485d69f1 100644 --- a/src/mq.py +++ b/src/mq.py @@ -11,4 +11,4 @@ from flask_covid19_mq import run_mq # --------------------------------------------------------------------------------- if __name__ == '__main__': - run_mq(celery) + run_mq()