Commit Graph

2337 Commits

Author SHA1 Message Date
Rebecca Law
adaadefed5 Merge pull request #1408 from alphagov/remove-unused-code
Remove unused code
2017-11-21 10:38:41 +00:00
Athanasios Voutsadakis
73dfc67400 Merge branch 'master' into bump_utils_2301 2017-11-20 17:40:45 +00:00
Rebecca Law
d5a1ec0fe3 Remove unused methods 2017-11-20 14:45:11 +00:00
Rebecca Law
577463b0ac Remove create_or_update_email_reply_to and create_or_update_letter_contact - no longer needed.
Remove Services.reply_to_email_address and Services.letter_contact_block
2017-11-20 14:33:15 +00:00
Richard Chapman
f3f8225dfe Merge pull request #1406 from alphagov/rc-monthly-template-usage-endpoint
Template usage stats updates for FY usage and bug fix
2017-11-20 11:45:30 +00:00
Athanasios Voutsadakis
a0beb190f3 Merge branch 'master' into bump_utils_2301 2017-11-20 11:16:29 +00:00
Richard Chapman
58b0658a13 Return financial year not calendar and ensure double precision values
are not returned from queries

- Updated stats_template_usage_by_month_dao.py to return the results for
financial year not calendar, as the report os for FY only and hence
only the FY data is required
- Updated services_dao.py to ensure double precision values are converted
to an int as the 'exact' function returns double precision from the
database query, as the admin code requires the value for month to be an
int
2017-11-20 10:01:45 +00:00
Venus Bailey
10f3bc24f0 Merge pull request #1404 from alphagov/vb-test-token
Inbound sms pre-implementation test 1
2017-11-20 09:30:50 +00:00
Athanasios Voutsadakis
b0546f4886 Remove unused variable 2017-11-17 16:22:36 +00:00
Chris Hill-Scott
32e19b6552 Bump utils to 23.0.0
Changes arguments to `SMSMessageTemplate` to better describe what they
do.
2017-11-17 16:20:48 +00:00
venusbb
d70fdbb5c2 no auth check 2017-11-17 15:57:41 +00:00
venusbb
12a99f9a7f Verify authorisation header being send 2017-11-17 14:36:28 +00:00
Leo Hemsted
04e3218087 ensure sample SES callbacks and SNS subscription payloads are accurate in research mode and unit tests 2017-11-17 14:34:16 +00:00
Leo Hemsted
d2154451e5 update research mode email callbacks to add process-ses-response task to queue
this involved:
* moving that task to callback_tasks to prevent circular imports
* updating the dummy research mode callbacks (with actual SNS messages from the
  ses simulator emails)
* refactoring tests
2017-11-17 13:41:45 +00:00
Leo Hemsted
0e477b7715 Merge pull request #1401 from alphagov/ses-logging
Ses logging
2017-11-17 10:42:17 +00:00
Sakis
9d2cecd001 Merge pull request #1391 from alphagov/add_proxy_header_check
Add proxy header check
2017-11-17 10:35:43 +00:00
Leo Hemsted
890604990d remove unneccessary ses endpoint tests 2017-11-17 10:31:34 +00:00
Leo Hemsted
5855adf826 removed unused HTTP ses callback handler 2017-11-16 17:53:19 +00:00
Leo Hemsted
1f317b6717 log the bounce message from SES 2017-11-16 17:46:58 +00:00
Leo Hemsted
ff449735e4 make sure fns aren't named the same 2017-11-16 17:46:41 +00:00
kentsanggds
6d36a65b65 Merge pull request #1400 from alphagov/ken-allow-include_jobs-arg-get_all_notis
Allow include jobs request param on v2 get all notifications
2017-11-16 16:41:10 +00:00
Athanasios Voutsadakis
0886f6d9f9 Merge branch 'master' into add_proxy_header_check 2017-11-16 16:36:02 +00:00
Richard Chapman
2ee91cd629 Merge pull request #1399 from alphagov/rc-monthly-template-usage-endpoint
Added a template_type to the rest call and Aggregation Bug Fix
2017-11-16 15:55:55 +00:00
Rebecca Law
35f1704a9d Merge pull request #1395 from alphagov/catch-inbound-sms-push-exception
Retry unknown exceptions for send_inbound_sms_to_service task
2017-11-16 15:47:14 +00:00
Richard Chapman
fd89a252e0 Code Style Updates
Updated the to conform with the line ends expected by the code style in
tests rather than PyCharm.
2017-11-16 15:17:27 +00:00
Richard Chapman
e7de0c0900 Added a template_type to the rest call
Added a template type which is required for the admin UI and updated the
tests. The rest tests needed updated because of the bug fix for
aggregation.
2017-11-16 15:17:27 +00:00
Richard Chapman
5ba58031b1 Fixed Bug in stats aggregation
The check for aggregation was too broad and hence was adding together
totals based on template_id and not the unqiue combination of
template id, month and year.

- Added test to test for the failure
- Added check and a test to for template_id, mon and year matches
- Celery process name did not match the task
2017-11-16 15:17:27 +00:00
Ken Tsang
0e473cace5 Update rest endpoint to handle include_jobs arg 2017-11-16 14:45:02 +00:00
Ken Tsang
df98f0dec1 Update schema to allow include_jobs on get_notis 2017-11-16 14:44:28 +00:00
Athanasios Voutsadakis
5d687d87e7 Enable header checking on preview and staging, add test 2017-11-16 12:02:09 +00:00
Athanasios Voutsadakis
819c1a2dc5 Merge branch 'master' into add_proxy_header_check 2017-11-16 11:41:50 +00:00
Richard Chapman
38e8451627 Merge pull request #1390 from alphagov/rc-monthly-template-usage-endpoint
Added new endpoint to get the new template stats
2017-11-15 16:20:04 +00:00
Richard Chapman
424f87cb68 Removed unused import
Removed an import which is no longer required.
2017-11-15 16:12:03 +00:00
Richard Chapman
17d1cfe758 Reverted Config on SQLALCHEMY_ECHO
Used for debugging not needed for production so reverted.
2017-11-15 16:00:13 +00:00
Richard Chapman
1e4850b70f Add Template name to response and filter by year
The template name should be returned for the response and the user will
pick a year, so ths adds those two features to the
notifications/templates_usage/monthly endpoint and added some tests to
test the functionality.
2017-11-15 15:55:00 +00:00
Richard Chapman
c27edf5e3c Added new endpoint to get the new template stats
Added a new endpoint which combines the usage of the stats table and the
data from the notifications tables, instead of using all the data from
the notification_history table. This should speed up the query times
and improve the page performance.

- Updated to make the stats create and update function transactional as
it actually wasn't committing the data to the table
- Added the get from the stats table
- Add a a method to combine the two results
- Added the endpoint
2017-11-15 12:58:39 +00:00
Rebecca Law
fd217e67f5 Merge branch 'master' into remove-initial-update-sms-sender 2017-11-15 12:33:38 +00:00
Rebecca Law
d905099962 If the post to a url for the inbound sms message to the service throwns an unknown exception - or RequestException, the base exception for request, the error will be logged and retried. 2017-11-15 11:43:52 +00:00
Alexey Bezhan
bc54d34a22 Merge pull request #1384 from alphagov/notifications-template-history
Fix notifications template history relationship
2017-11-15 10:51:56 +00:00
Rebecca Law
e3f9dab884 Merge branch 'master' into remove-initial-update-sms-sender 2017-11-14 16:27:10 +00:00
venusbb
c111458168 Bridging API to update annual_billing table 2017-11-14 16:15:36 +00:00
Leo Hemsted
27bf927f43 Merge pull request #1383 from alphagov/user-mobile-optional
User mobile optional
2017-11-14 15:59:31 +00:00
Athanasios Voutsadakis
5f1146208d Remove unused import 2017-11-14 14:37:42 +00:00
Athanasios Voutsadakis
0f696aa3e8 Use function from utils to check secret header value
This adds a before_request handler to check whether all incoming
requests have the proxy header configured.
2017-11-14 14:26:00 +00:00
Alexey Bezhan
db1c647873 Remove NotificationHistory.template relationship
Relationship attribute is not used by the application code, so we
can remove it without replacing it with a TemplateHistory one.

This also updates the foreign key constraint to refer to the composite
primary key for the TemplateHistory records.
2017-11-10 15:13:55 +00:00
Alexey Bezhan
bdcc89b403 Add TemplateHistory.redact_personalisation attribute
TemplateHistory objects need to be connected to the template's
TemplateRedacted record. This requires setting up a new SQLAlchemy
relationship to allow accessing redact_personalisation from
TemplateHistory instances.

We can avoid creating a foreign key in this case by setting up an
explicit `primaryjoin` expression. Since TemplateHistory.id is
created from Template.id and TemplateRedacted.template_id is
already a foreign key to Template.id the foreign key should always
be valid even without a DB constraint.
2017-11-10 15:13:55 +00:00
Alexey Bezhan
79d417f13b Add TemplateHistory.get_link method
Notifications.serialize calls `Notifications.template.get_link`, so
we need TemplateHistory objects to generate their API URLs.

This generates a link to the `/v2/` version of the endpoint.
2017-11-10 15:13:55 +00:00
Rebecca Law
62629e4eae Merge pull request #1387 from alphagov/fix-post-notification-response
Update the from number in the response of post notification.
2017-11-10 15:12:16 +00:00
Alexey Bezhan
e73513f519 Update Notification schema to preserve template_history attribute
`Notification.template_history` relationship has been removed but
we want to keep the `template_history` key in existing notification
serializations, so we serialize it from `Notifications.template`.

This keeps the data format the same, but both `template` and
`template_history` keys will now contain data from the `TemplateHistory`
instance.
2017-11-10 15:12:07 +00:00
Alexey Bezhan
a5ca66a01b Update notification queries with new TemplateHistory join
Changes the queries to use `Notification.template` relationship instead
of `.template_history` and TemplateHistory model insteaad of Template.
2017-11-10 15:12:07 +00:00