mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-04 02:11:11 -05:00
When we get complaints we'd like to know how many we get in a day or other date range, so if there is a spike in complaints we can act on it.
Add new endpoint to return the number of complaints in a date range. Unit tests to follow in the next commit.
This commit is contained in:
@@ -10,3 +10,7 @@ def save_complaint(complaint):
|
||||
|
||||
def fetch_complaints_by_service(service_id):
|
||||
return Complaint.query.filter_by(service_id=service_id).all()
|
||||
|
||||
|
||||
def fetch_count_of_complaints(start_date, end_date):
|
||||
return Complaint.count.filter(Complaint.created_at >= start_date, Complaint.created_at < end_date)
|
||||
|
||||
Reference in New Issue
Block a user