From b22c52131d112b79d55674cc64f9ec115ca5148f Mon Sep 17 00:00:00 2001 From: Martyn Inglis Date: Wed, 11 May 2016 15:36:17 +0100 Subject: [PATCH] Fixing up a couple of pull request comments - python style if - renamed the relationships --- app/celery/tasks.py | 2 +- app/models.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/celery/tasks.py b/app/celery/tasks.py index 4653adab3..ffe614f77 100644 --- a/app/celery/tasks.py +++ b/app/celery/tasks.py @@ -467,7 +467,7 @@ def provider_to_use(notification_type, notification_id): provider for provider in get_provider_details_by_notification_type(notification_type) if provider.active ] - if len(active_providers_in_order) == 0: + if not active_providers_in_order: current_app.logger.error( "{} {} failed as no active providers".format(notification_type, notification_id) ) diff --git a/app/models.py b/app/models.py index 7def85f51..0ae60db04 100644 --- a/app/models.py +++ b/app/models.py @@ -200,7 +200,7 @@ class ProviderStatistics(db.Model): id = db.Column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4) day = db.Column(db.Date, nullable=False) provider_id = db.Column(UUID(as_uuid=True), db.ForeignKey('provider_details.id'), index=True, nullable=False) - provider_stats_to_provider = db.relationship( + provider = db.relationship( 'ProviderDetails', backref=db.backref('provider_stats', lazy='dynamic') ) service_id = db.Column(UUID(as_uuid=True), db.ForeignKey('services.id'), index=True, nullable=False) @@ -215,7 +215,7 @@ class ProviderRates(db.Model): valid_from = db.Column(db.DateTime, nullable=False) rate = db.Column(db.Numeric(), nullable=False) provider_id = db.Column(UUID(as_uuid=True), db.ForeignKey('provider_details.id'), index=True, nullable=False) - provider_rate_to_provider = db.relationship('ProviderDetails', backref=db.backref('provider_rates', lazy='dynamic')) + provider = db.relationship('ProviderDetails', backref=db.backref('provider_rates', lazy='dynamic')) class ProviderDetails(db.Model):