mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-24 17:31:34 -05:00
fix
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
from sqlalchemy import select
|
||||
from sqlalchemy.dialects.postgresql import insert
|
||||
from sqlalchemy.sql.expression import case
|
||||
|
||||
@@ -33,8 +34,8 @@ def insert_update_processing_time(processing_time):
|
||||
|
||||
|
||||
def get_processing_time_percentage_for_date_range(start_date, end_date):
|
||||
query = (
|
||||
db.session.query(
|
||||
stmt = (
|
||||
select(
|
||||
FactProcessingTime.local_date.cast(db.Text).label("date"),
|
||||
FactProcessingTime.messages_total,
|
||||
FactProcessingTime.messages_within_10_secs,
|
||||
@@ -52,11 +53,11 @@ def get_processing_time_percentage_for_date_range(start_date, end_date):
|
||||
(FactProcessingTime.messages_total == 0, 100.0),
|
||||
).label("percentage"),
|
||||
)
|
||||
.filter(
|
||||
.where(
|
||||
FactProcessingTime.local_date >= start_date,
|
||||
FactProcessingTime.local_date <= end_date,
|
||||
)
|
||||
.order_by(FactProcessingTime.local_date)
|
||||
)
|
||||
|
||||
return db.session.execute(query).scalars().all()
|
||||
return db.session.execute(stmt).scalars().all()
|
||||
|
||||
@@ -320,9 +320,7 @@ def test_dao_get_paginated_inbound_sms_for_service_for_public_api_older_than_ret
|
||||
)
|
||||
|
||||
expected_inbound_sms = reversed_inbound_sms[2:]
|
||||
print(f"EXPECTED {expected_inbound_sms}")
|
||||
print(f"ACTUAL {inbound_from_db.items}")
|
||||
assert expected_inbound_sms == inbound_from_db
|
||||
assert expected_inbound_sms == inbound_from_db.items
|
||||
|
||||
|
||||
def test_dao_get_paginated_inbound_sms_for_service_for_public_api_older_than_end_returns_empty_list(
|
||||
@@ -339,8 +337,7 @@ def test_dao_get_paginated_inbound_sms_for_service_for_public_api_older_than_end
|
||||
inbound_from_db = dao_get_paginated_inbound_sms_for_service_for_public_api(
|
||||
sample_service.id, older_than=reversed_inbound_sms[1].id, page_size=2
|
||||
)
|
||||
print(f"HERE IS INBOUND FROM DB {inbound_from_db.items}")
|
||||
assert inbound_from_db.has_next is False
|
||||
assert inbound_from_db.items == []
|
||||
|
||||
|
||||
def test_most_recent_inbound_sms_only_returns_most_recent_for_each_number(
|
||||
|
||||
Reference in New Issue
Block a user