Leo Hemsted
28d5f9b87f
flake8 - remove unused imports and ensure they're always at the top of the file
2017-11-28 14:28:01 +00:00
Rebecca Law
bf6e671e96
The logs kept reporting a data error from the redis client. This would happen any time we set the cache with empty cache values.
...
Added a check for values before setting the cache
2017-08-22 14:59:50 +01:00
Imdad Ahad
f5e38a896c
Update the last template usage query to check Notification table:
...
* Don't check the NotificationHistory table (this can cause a timeout)
* Check template actually exists first
2017-08-07 10:19:21 +01:00
Rebecca Law
53b7ad0961
Moved the cache key to the utils module.
...
Renamed the dao method.
2017-02-14 14:22:52 +00:00
Rebecca Law
681f52b691
Missed some print statements and unused imports.
2017-02-14 09:59:33 +00:00
Rebecca Law
2346634fec
Some code clean up, removed print statements.
2017-02-14 09:54:37 +00:00
Rebecca Law
458adefcb8
Added a redis cache for the template usage stats.
...
Cache expires every 10 minutes, but will help with the every 2 second query, especially when a job is running.
There is some clean up and qa to do for this yet
2017-02-13 18:47:29 +00:00
Martyn Inglis
4e6da1ba55
Changed template stats for template id
...
- now returns the most recent notification history row for that template ID.
- contains all the required data for the use cases for that template
2016-08-22 14:35:04 +01:00
Martyn Inglis
b7476a1975
Removed the group by day aspects of template stats. Not needed. Grouped by template only.
2016-08-22 10:38:44 +01:00
Martyn Inglis
9eb559d4b2
Renamed the param to avoid shadowing
2016-08-18 15:29:56 +01:00
Martyn Inglis
ede7d0cbea
Removed old endpoint.
...
Going to handle the migration in the clients.
2016-08-18 14:06:12 +01:00
Martyn Inglis
7a5acea71b
New endpoint for template stats to use new query. Breaking change to the returned JSON, so adding on a different url.
2016-08-18 14:01:31 +01:00
Adam Shimali
b33312b855
Change endpoint responses where there are marshalling, unmarshalling
...
or param errors to raise invalid data exception. That will cause
those responses to be handled in by errors.py, which will log
the errors.
Set most of schemas to strict mode so that marshmallow will raise
exception rather than checking for errors in return tuple from load.
Added handler to errors.py for marshmallow validation errors.
2016-06-15 14:37:51 +01:00
Adam Shimali
3d55c47d1e
Rest methods that explicitly return errors by pass the error handlers as
...
they do not raise exceptions.
Introduced a simple exception that contains error messages and status
code that can be used rather than return json + status code from rest
methods directly.
The handler in errors for this exception can then log the error before
returning json.
2016-06-13 13:50:35 +01:00
Leo Hemsted
e3d9dfad6e
add template_statistics endpoint for specific template
...
`/service/<service_id>/template-statistics/<template_id>`
still requires service-id just to try and keep api tree cleaner
2016-06-07 14:18:42 +01:00
Adam Shimali
e4a5e3890a
Corrected error message format
2016-04-04 14:51:56 +01:00
Adam Shimali
0d06be05e1
[WIP] Added dao method and rest endpoint for getting template
...
statistics by service.
Some cosmetic changes to imports.
Added fix for job rest not correctly returning errors.
2016-04-04 14:38:54 +01:00