Updated the Provider stats and rates DAO objects to query based on the identifier in the ProviderDetails object.

- updated all tests
- changed teardown to leave provider details rows on end of individual tests
This commit is contained in:
Martyn Inglis
2016-05-06 09:09:47 +01:00
parent fedbb27ffd
commit 57e05feafb
15 changed files with 149 additions and 135 deletions

View File

@@ -193,13 +193,16 @@ PROVIDERS = SMS_PROVIDERS + EMAIL_PROVIDERS
NOTIFICATION_TYPE = ['email', 'sms', 'letter']
class ProviderStatistics(db.Model):
__tablename__ = 'provider_statistics'
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('ProviderDetails', backref=db.backref('provider_stats', lazy='dynamic'))
provider_stats_to_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)
service = db.relationship('Service', backref=db.backref('service_provider_stats', lazy='dynamic'))
unit_count = db.Column(db.BigInteger, nullable=False)