Commit Graph

297 Commits

Author SHA1 Message Date
Ken Tsang
f7a18f77cf Update model to cascade permissions assoc proxy 2017-05-25 17:48:09 +01:00
Rebecca Law
b745e13a28 Merge branch 'master' into schedule-api-notification 2017-05-25 13:37:04 +01:00
Leo Hemsted
57b7cb8d24 Merge pull request #986 from alphagov/create-service-bug
separate service deserialization from validation
2017-05-25 10:52:38 +01:00
Leo Hemsted
4b8b6ca91e add test to ensure that updating other things doesnt affect sms sender 2017-05-25 10:37:17 +01:00
Rebecca Law
9f6c037530 Use iso8601 to validate scheduled_for datetime.
Added a validation method that always fails for scheduled notifications.
Comment out config for scheduled task.
The schedule notifications will be turned on once we can invite services to use it.
Waiting for the service permission story, must commit this in order to keep things from going stale.
2017-05-24 16:27:15 +01:00
Leo Hemsted
554a193cff separate service deserialization from validation
Marshmallow validates and deserialises - BUT, when it deserialises,
it explicitly sets `sms_sender=None`, even when you haven't passed
sms_sender in. This is problematic, because we wanted to take advantage
of sqlalchemy's default value to set sms_sender to `GOVUK` when the
actual DB commit happens.

Instead, still use marshmallow for validating, but manually carry out
the json deserialisation in the model class.

This fixes a bug that only manifested when the database was upgraded,
but the code hadn't updated. 🎉
2017-05-24 16:27:12 +01:00
Imdad Ahad
c986b88e21 Merge pull request #979 from alphagov/imdad-migration-add-normalised-to-notification
Add normalised_to field to notification
2017-05-24 16:21:15 +01:00
Rebecca Law
383dee3bb2 Updated the serialization of Notification.scheduled_for to include minutes. 2017-05-24 14:52:32 +01:00
Martyn Inglis
511e143ace toString on the rates object 2017-05-24 08:57:11 +01:00
Leo Hemsted
e9b1fd4dde Revert "Non null sender" 2017-05-23 16:32:03 +01:00
Rebecca Law
53efb4e033 Merge branch 'master' into schedule-api-notification
Conflicts:
	tests/app/v2/notifications/test_post_notifications.py
2017-05-23 13:58:50 +01:00
Martyn Inglis
e987668b0c Merge branch 'master' into remove-nasty-query-from-dashboard 2017-05-23 13:55:30 +01:00
Leo Hemsted
47560515dc add upgrade script to remove non-null values from the sender column 2017-05-23 11:33:43 +01:00
Leo Hemsted
f899d74325 Merge pull request #973 from alphagov/40604-or-govuk
treat 40604 and GOVUK as not having a sender ID
2017-05-23 11:29:33 +01:00
Leo Hemsted
86c9600b04 use config to get default sender rather than hardcoding
this means that on non-prod envs, it reflects that environment.

it needs to be a lamdba, because the column object is created at import
time, when current_app.config won't have been loaded - this means that
when you create a Service object, that lambda executes and grabs the
correct default value
2017-05-23 11:12:37 +01:00
Imdad Ahad
24dfcd2128 Add normalised_to field to notification 2017-05-23 10:44:39 +01:00
Ken Tsang
de7ad6fb95 Refactored service_permissions data model 2017-05-22 17:25:58 +01:00
Leo Hemsted
2535a7fe98 set sms_sender to be 'GOVUK' if not otherwise specified
this is a precursor to making the column non-nullable
2017-05-22 17:13:35 +01:00
kentsanggds
f5d3eed7e0 Revert "Refactored service permissisons data model" 2017-05-22 16:05:31 +01:00
Rebecca Law
9bfba52f53 Add pending flag to scheduled_notifications.
Set pending flag to false when the notification has been sent to provider task.
2017-05-22 15:07:16 +01:00
Rebecca Law
3a3161ecc4 Merge branch 'master' into schedule-api-notification
Conflicts:
	app/celery/scheduled_tasks.py
	app/v2/notifications/post_notifications.py
	tests/app/celery/test_scheduled_tasks.py
2017-05-22 14:05:57 +01:00
Ken Tsang
052004bef0 Refactored data model to remove cascade 2017-05-22 13:33:43 +01:00
Ken Tsang
28ef9a1853 Refactored service permissisons data model 2017-05-22 10:58:41 +01:00
Martyn Inglis
7268bc28fe New array of non-billable states 2017-05-19 16:42:47 +01:00
Martyn Inglis
8dc7a86148 Merge branch 'master' into async-job-stats
Conflicts:
	app/dao/services_dao.py
2017-05-18 09:34:54 +01:00
Rebecca Law
973cc2c4c9 Changed the scheduled_for datetime to only send and hour of a day to send.
Also expect the date being passed in is BST. The date is converted to UTC before saving. And converted to BST when returning a notification.
2017-05-17 15:06:15 +01:00
Ken Tsang
54446d5f4d Add default permissions when creating a service 2017-05-17 14:18:12 +01:00
Martyn Inglis
83a1b1526e Merge branch 'master' into async-job-stats
Conflicts:
	app/notifications/notifications_ses_callback.py
2017-05-17 09:49:43 +01:00
Rebecca Law
1034762489 Ensure the relationship between Notification and ScheduledNotification is one-to-one.
Update db script with the right number
2017-05-16 15:29:31 +01:00
Rebecca Law
3c0da9c8fd Merge branch 'master' into schedule-api-notification 2017-05-16 10:50:53 +01:00
Rebecca Law
f0e2713bef Add scheduled_for in the post notification request form.
Return scheduled for in get_notification requests.
2017-05-15 17:27:38 +01:00
Ken Tsang
380bc22f22 Add relationship for service in ServicePermission 2017-05-15 13:44:52 +01:00
Rebecca Law
75a4dad8c1 New table to hold scheduled_notifications. 2017-05-15 12:59:44 +01:00
Ken Tsang
359c4d2138 add service permissions model + migration script 2017-05-15 12:52:28 +01:00
Martyn Inglis
835dcc6273 Not null job_id and rebuilt the migration script to include this 2017-05-12 13:18:12 +01:00
Martyn Inglis
63b7a4e9fe New status grouping - success 2017-05-12 12:19:44 +01:00
Martyn Inglis
d324d72926 Merge branch 'master' into async-job-stats 2017-05-11 15:41:20 +01:00
Martyn Inglis
f0e47029f2 "Created at" on the model 2017-05-11 15:23:18 +01:00
Martyn Inglis
a5caed5ac8 Changed job_stats table to have an update at time stamp 2017-05-09 14:04:19 +01:00
Martyn Inglis
d647640b65 Added job statistics table 2017-05-09 11:22:05 +01:00
Leo Hemsted
4ff4717fdf make sure we update both statuses when updating notification history 2017-05-09 11:09:16 +01:00
Leo Hemsted
7e52fa4d13 add new notification_status column to models.py
We now have a new column in the database, but it isn't being
populated. The first step is to make sure we update this column,
while still keeping the old enum based column up to date as well.

A couple of changes have had to happen to support this - one irritating
thing is that if we're ever querying columns individually, including
`Notification.status`, then we'll need to give that column a label,
since under the hood it translates to `Notification._status_enum`.
Accessing status through the ORM (i.e., my_noti.status = 'sending' or
similar) will work fine.
2017-05-04 17:24:28 +01:00
kentsanggds
56e5045e9a Merge pull request #928 from alphagov/update-billing-api-with-rate
Update billing api with rate
2017-04-28 11:40:05 +01:00
Leo Hemsted
fd4e27bfd3 add type conversion to report downloads
"sent" is fine as an internal marker but not very obvious to the end
user that it specifically refers to international messages. We now
say "Sent internationally" in the CSV
2017-04-28 11:00:55 +01:00
Rebecca Law
3b41478a0a Updated Notification model to use Float(asdecimal=False) for rate_mutliplier.
Added test with multiple rows for a month.
2017-04-28 10:10:49 +01:00
Rebecca Law
1a64509186 Change the resultset from the yearly and monthly billing data queries.
Fix some formatting of the return objects.
2017-04-28 10:10:49 +01:00
Rebecca Law
a186fc95be Added new endpoints to return the yearly-usage and monthly-usage for a given financial year and service id.
Since the response has changed I have created new endpoints so that the deployments for Admin are more managable.

Removed print statements from some tests.
2017-04-28 10:10:48 +01:00
Imdad Ahad
164ba0c6b3 as_decimal defaults to False 2017-04-27 13:50:51 +01:00
Imdad Ahad
868e102f8a Make rate_multiplier on notification return non-decimal 2017-04-27 13:24:42 +01:00
Leo Hemsted
a138ec478a Merge branch 'master' into sent-status 2017-04-26 16:52:16 +01:00