Updates after review

- Modified the services_dao to return an int instead of a datetime to
make usage easier and removed the BST function on year as it is not
relevant for year
- Improved tests do there is less logic by ordering the result so there
is less reliance on the template id
- Renamed variable in stats_template_usage_by_month_dao.py to make it
consistent with the method
This commit is contained in:
Richard Chapman
2017-11-09 14:13:42 +00:00
parent 59df6bdbb6
commit b78d989d4e
14 changed files with 76 additions and 148 deletions

View File

@@ -31,20 +31,6 @@ def upgrade():
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('notification_statistics',
sa.Column('id', postgresql.UUID(), autoincrement=False, nullable=False),
sa.Column('service_id', postgresql.UUID(), autoincrement=False, nullable=False),
sa.Column('emails_requested', sa.BIGINT(), autoincrement=False, nullable=False),
sa.Column('emails_delivered', sa.BIGINT(), autoincrement=False, nullable=False),
sa.Column('emails_failed', sa.BIGINT(), autoincrement=False, nullable=False),
sa.Column('sms_requested', sa.BIGINT(), autoincrement=False, nullable=False),
sa.Column('sms_delivered', sa.BIGINT(), autoincrement=False, nullable=False),
sa.Column('sms_failed', sa.BIGINT(), autoincrement=False, nullable=False),
sa.Column('day', sa.DATE(), autoincrement=False, nullable=False),
sa.ForeignKeyConstraint(['service_id'], ['services.id'], name='notification_statistics_service_id_fkey'),
sa.PrimaryKeyConstraint('id', name='notification_statistics_pkey'),
sa.UniqueConstraint('service_id', 'day', name='uix_service_to_day')
)
op.drop_index(op.f('ix_stats_template_usage_by_month_year'), table_name='stats_template_usage_by_month')
op.drop_index(op.f('ix_stats_template_usage_by_month_template_id'), table_name='stats_template_usage_by_month')
op.drop_index(op.f('ix_stats_template_usage_by_month_month'), table_name='stats_template_usage_by_month')