Chris Hill-Scott
c032ef215a
Return org_type in list of all organisations
...
This will let us do some filtering of this list in the admin. It’s
better to do it there because it means the admin can use the same cached
response from Redis each time.
2019-09-05 16:04:14 +01:00
Rebecca Law
6e6b7584cf
Merge pull request #2605 from alphagov/fix-get-pdf-using-created_at-date
...
Fix the folder returned for a pdf letter.
2019-09-05 14:21:02 +01:00
Rebecca Law
a772fb8acf
Fix the folder returned for a pdf letter.
...
Using the created at date for the folder is not always going to work because the pdf created_at date could be just before the cut off date but virus scan and validation has yet to happen. By the time the letters is in the created state, the letter goes into the next days bucket.
It can also happen if the letters is stuck in `pending-virus-scan` and we need to restart the task, and the letters is in a different folder.
2019-09-05 11:47:31 +01:00
Leo Hemsted
70828d4d87
Merge pull request #2601 from alphagov/pyup-scheduled-update-2019-08-28
...
Scheduled weekly dependency update for week 34
2019-09-04 13:05:38 +01:00
Leo Hemsted
51f90c17fd
pin marshmallow and update flask error handling
2019-09-04 12:14:28 +01:00
Leo Hemsted
01c702535d
freeze requirements and bump utils
2019-09-04 10:55:22 +01:00
Rebecca Law
c953ef5223
Merge pull request #2602 from alphagov/fix-group-by-for-letter-counts
...
Fix grouping on the usage for all services report
2019-09-03 13:32:56 +01:00
Rebecca Law
e64ae321cf
The sheet count was not calculated properly (it should be billable_units/notifications_sent).
...
And it turns out the sheet count is not required for the report. This PR takes out the columns to resolve the group by error.
2019-09-03 13:16:08 +01:00
Leo Hemsted
d83a9fee05
Merge pull request #2599 from alphagov/billing-for-all-services
...
Billing for all services
2019-09-02 16:38:05 +01:00
Leo Hemsted
93e631221a
use dates rather than datetimes when comparing with bst_date
...
bst_date is a date field. Comparing dates with datetimes in postgres
gets confusing and dangerous. See this example, where a date evaluates
as older than midnight that same day.
```
notification_api=# select '2019-04-01' >= '2019-04-01 00:00';
?column?
----------
f
(1 row)
```
By only using dates everywhere, we reduce the chance of these bugs
happening
2019-09-02 11:56:56 +01:00
Leo Hemsted
5975ae2383
remove unneccessary duped lines
...
as per pr comments
2019-08-30 16:49:58 +01:00
Leo Hemsted
7313dbeb86
normalise join patterns across billing queries
...
select from service, join to org and ft_billing
2019-08-30 12:18:52 +01:00
Leo Hemsted
6f420cf066
explicitly join tables
...
from service, join organisation, the free_allowance_remainder subquery
and the ft_billing table. Being explicit reduces confusion about what
tables we're joining and how we're constraining those joins
also remove references to AnnualBilling since we've already got the
free sms allowance from the free_allowance_remainder subquery
2019-08-30 12:18:52 +01:00
Leo Hemsted
48e96f253b
ensure fetch_sms_free_allowance_remainder always returns
...
if there are no rows for a service in ft_billing, we should still
return their allowance (with 0 fragments used).
To do this, we need to build the query starting from AnnualBilling and
joining onto FactBilling, rather than the other way round. Also, we
need to account for the possibility of the sums being null by
coalescing them to 0
2019-08-30 12:18:40 +01:00
Leo Hemsted
b46eed1423
sort rest response by org_name, service_name
...
needed to re-arrange test results for this
2019-08-30 12:18:00 +01:00
Leo Hemsted
7811010e6c
fix command name and get most recent data rather than oldest
...
fix query to order the right way
also remove debug prints that duplicate the formatted line below
2019-08-30 12:18:00 +01:00
Leo Hemsted
e4963ca0d3
make sure all letter costs are cast from decimal to float
2019-08-30 12:18:00 +01:00
Leo Hemsted
99a008e908
explicitly join annual_billing and remove reference to service.id
...
service.id isn't used in this query (both tables already have
service_id), and explicitly joining makes what we're doing more obvious
2019-08-30 12:18:00 +01:00
Leo Hemsted
741d75c3a9
use func.greatest rather than case statement
...
simplifies the query quite a bit
2019-08-30 12:18:00 +01:00
Leo Hemsted
608738ca67
remove unneccessary str cast
2019-08-30 12:18:00 +01:00
Leo Hemsted
028b81b787
simplify validate_date_range_is_within_a_financial_year
...
we can use the get_financial_year_for_datetime function
to massively simplify this
2019-08-30 12:18:00 +01:00
Leo Hemsted
b7e8f1baa2
rename which_financial_year to get_financial_year_for_datetime
...
also fix bug on the very second of rollover, march 31st 23:00:00, and
add tests
2019-08-30 12:18:00 +01:00
Rebecca Law
2abcda47a3
Remove print
2019-08-30 12:17:59 +01:00
Rebecca Law
1c94d6d24a
Added command to populate data for annual billing based on last years values.
2019-08-30 12:17:59 +01:00
Rebecca Law
cb7fff6100
Add endpoint to return structured data
2019-08-30 12:17:59 +01:00
Rebecca Law
4c36e22e93
[WIP]
...
fire alarm is going off - better save :)
2019-08-30 12:17:59 +01:00
Rebecca Law
1a5763feb6
Compare result tuple rather than each element in tuple (just to make it a little shorter)
...
Change order of columns
2019-08-30 12:17:59 +01:00
Rebecca Law
3b16950aee
Final touches on tests and query for itemised letter billing data.
2019-08-30 12:17:59 +01:00
Rebecca Law
236d111c22
Update queries for data model change (removal of organisation_to_service)
...
New query to get letter breakdown.
2019-08-30 12:17:59 +01:00
Chris Hill-Scott
703effe31f
Merge pull request #2600 from alphagov/add-gp-org-type
...
Add ‘GP’ as an org type
2019-08-28 15:47:41 +01:00
Chris Hill-Scott
8d9038c3e9
Give GP practices NHS branding by default
...
Previously we were doing it based on their email address. This will also
apply it if they self-select as a GP surgery, even if they don’t have an
NHS email address.
2019-08-28 15:33:00 +01:00
Chris Hill-Scott
edb5790b7c
Use nhs_gp not gp as org type
...
Means we have the option of looking for anything starting with `nhs` as
a way of filtering organisations.
2019-08-28 15:24:30 +01:00
pyup-bot
44872388a8
Update sqlalchemy from 1.3.3 to 1.3.8
2019-08-28 14:00:16 +01:00
pyup-bot
bbd82e9957
Update psycopg2-binary from 2.8.2 to 2.8.3
2019-08-28 14:00:14 +01:00
pyup-bot
b695bce284
Update marshmallow from 2.19.2 to 3.0.1
2019-08-28 14:00:13 +01:00
pyup-bot
7f32ed76b1
Update marshmallow-sqlalchemy from 0.16.3 to 0.17.0
2019-08-28 14:00:11 +01:00
pyup-bot
83e894a287
Update jsonschema from 3.0.1 to 3.0.2
2019-08-28 14:00:09 +01:00
pyup-bot
9bc886aad4
Update eventlet from 0.24.1 to 0.25.1
2019-08-28 14:00:08 +01:00
pyup-bot
b751393b53
Update flask from 1.0.2 to 1.1.1
2019-08-28 14:00:06 +01:00
pyup-bot
fd5bf4fb2a
Update flask-migrate from 2.4.0 to 2.5.2
2019-08-28 14:00:05 +01:00
Chris Hill-Scott
a5b36457f2
Add ‘GP’ as an org type
...
Although their allowances are the same as what we call `nhs_local` it
makes more sense to store them separately because:
- we already present them as two separate choices to the user
- we may want to handle them differently in the future, eg in terms of
what branding choices are available to them
2019-08-27 17:01:03 +01:00
Leo Hemsted
d3449c37da
Merge pull request #2593 from alphagov/split-up-nightly-tasks
...
split up reporting tasks in to separate tasks per day
2019-08-21 15:58:17 +01:00
Leo Hemsted
1d9fd775d3
move delete tasks to 4am
...
just to make sure they definitely run after the create tasks
2019-08-21 11:15:49 +01:00
Rebecca Law
d40cbf8d74
Merge pull request #2594 from alphagov/update-alert-for-letters-in-created
...
Update alert for letters in created status
2019-08-20 13:49:27 +01:00
Pea (Malgorzata Tyczynska)
009406898f
Merge pull request #2596 from alphagov/lighter-serialize-for-users
...
Leaner serialize for user model for displaying list of users
2019-08-20 11:40:07 +01:00
Leo Hemsted
8f13697cf1
Revert "trigger nightly delete tasks from the create notification status task"
...
This reverts commit 58f24a0a83 .
2019-08-19 16:06:25 +01:00
Leo Hemsted
36dd750637
split up reporting tasks in to separate tasks per day
...
to try and speed up overall time by parallelising
2019-08-19 16:06:25 +01:00
Rebecca Law
ad389e7252
Merge pull request #2591 from alphagov/remove-org-to-service-table
...
Remove the organisation_to_service table.
2019-08-19 15:15:00 +01:00
Rebecca Law
8fdf700b90
Remove print statement
2019-08-19 14:51:21 +01:00
Pea Tyczynska
b2f811662d
Leaner serialize for user model for displaying list of users
2019-08-19 13:31:29 +01:00