Commit Graph

4789 Commits

Author SHA1 Message Date
Chris Hill-Scott
f902ba476c Bring in refactored CSV processing
Shouldn’t be any functional changes here, just things being named more
clearly.
2018-03-08 13:12:00 +00:00
Chris Waszczuk
1a63847988 Merge pull request #1746 from alphagov/add-is-org-unique-rest-endpoint
Add endpoint to check for unique organisation names
2018-03-08 12:11:06 +00:00
Chris Hill-Scott
c029927fde Merge pull request #1733 from alphagov/remove-dvla
Remove anything to do with DVLA format letters
2018-03-08 10:58:34 +00:00
Richard Chapman
e6a3d63d3d Merge pull request #1749 from alphagov/pyup-update-sqlalchemy-1.2.4-to-1.2.5
Update sqlalchemy to 1.2.5
2018-03-08 09:56:11 +00:00
Richard Chapman
94dea42f6f Merge pull request #1747 from alphagov/add_precompiled_letters
Fixed bug only where only data being passed to TemplatePreview when JSON is required
2018-03-08 09:56:03 +00:00
Chris Hill-Scott
ae0113a5de Merge pull request #1748 from alphagov/quis-patch-1
Add warning to Performance Platform command
2018-03-07 17:13:46 +00:00
Sakis
1782d824c8 Merge pull request #1751 from alphagov/fix-dockerfile
Install libffi-dev and python-dev in docker
2018-03-07 16:10:40 +00:00
Athanasios Voutsadakis
a84a70d791 Install libffi-dev and python-dev in docker
This is to allow us to build cffi
2018-03-07 15:56:41 +00:00
Katie Smith
f78cde61e7 Merge pull request #1743 from alphagov/remove-job-stats-step-1
Delete functions which call the job statistics tasks
2018-03-07 11:11:39 +00:00
Katie Smith
a85f5d3acf Merge pull request #1741 from alphagov/pyup-update-freezegun-0.3.9-to-0.3.10
Update freezegun to 0.3.10
2018-03-07 11:11:30 +00:00
Richard Chapman
d60e802f35 Removed the superfluous variable and pass through as it pulls it
automatically out of sys.exc_info.
2018-03-07 09:51:58 +00:00
Richard Chapman
7f32b06615 Replaced the JSONDecodeError with a ValueError as it was failing on
Jenkins.
2018-03-07 09:32:56 +00:00
Katie Smith
7f2e9f507e Delete functions which call the job statistics tasks
The JobStatistics table is going to be deleted. There are currently
3 tasks which use the JobStatistics model via the Statistics DAO, so we
need to make sure that these tasks aren't being used before they are
deleted in a separate PR.

This commit deletes:
* The `create_initial_notification_statistic_tasks` function which gets
used to call the `record_initial_job_statistics` task.
* The `create_outcome_notification_statistic_tasks` function which gets
used to call the `record_outcome_job_statistics` task.
* And the scheduling of the `timeout-job-statistics` scheduled task.
2018-03-07 09:23:29 +00:00
Katie Smith
0c1d5c12a3 Merge pull request #1699 from alphagov/persist-sorted-in-letter-response-file
Create and populate DailySortedLetter table
2018-03-07 09:06:33 +00:00
Katie Smith
f1db3c25eb Merge pull request #1740 from alphagov/pyup-update-pytest-3.4.1-to-3.4.2
Update pytest to 3.4.2
2018-03-07 09:06:21 +00:00
pyup-bot
e2a308a703 Update sqlalchemy from 1.2.4 to 1.2.5 2018-03-06 19:17:29 +00:00
Richard Chapman
cf2a506b3b Removed the import and directly used json.decoder.JSONDecodeError
as it was failing on Jenkins.
2018-03-06 18:20:45 +00:00
Richard Chapman
3f9a37d8a3 Updated the import for JSONDecodeError to import from from json.decoder
as it was failing on Jenkins.
2018-03-06 17:31:08 +00:00
Richard Chapman
e1e7f13f23 Added tests to ensure the parameter to the mock post request are the
correct type for the call as there are some that require json and some
binary. The additional checks ensure that that json decode either fails
or succeeds in the correct case.
2018-03-06 16:16:29 +00:00
Chris Hill-Scott
5db3eef8f2 Add warning to Performance Platform command 2018-03-06 15:42:38 +00:00
Richard Chapman
77a3397ce5 Added option flag to the _get_png_preview method to determine if the
post method content is data or json format.
2018-03-06 15:35:00 +00:00
chrisw
a487293bf0 Add check org name is unique endpoint 2018-03-06 15:34:39 +00:00
Richard Chapman
ed9936bba0 Fixed bug where the content header was not being passed onto the post
request. Changed data => json.

Added extra logging to display the error with more detail
2018-03-06 14:42:53 +00:00
Richard Chapman
d0df85a602 Fixed bug where the content header was not being passed onto the post
request. Changed data => json.

Added extra logging to display the error with more detail
2018-03-06 14:24:30 +00:00
Chris Hill-Scott
d7823fdbd6 Merge pull request #1739 from alphagov/backfill-performance-totals
Add command to backfill Performance Platform totals
2018-03-06 09:38:26 +00:00
Katie Smith
136d89e2f1 Persist daily sorted letter counts from response file
In the update_letter_notifications_statuses task we now check whether
each row in the response file that we receive from the DVLA has the
value of 'Sorted' or 'Unsorted' in the postcode validation field. We
then calculate the number of Sorted and Unsorted rows for each day and
save each day as a row in the daily_sorted_letter table.

The data in daily_sorted_letter table should be in local time, so we
convert the datetime before saving.
2018-03-06 09:09:02 +00:00
Katie Smith
1b5aaed10a Create DAO for daily sorted letter model 2018-03-06 09:09:02 +00:00
Katie Smith
b0de3ba4d9 Create DailySortedLetter table
The response files we receive from the DVLA when we send letters
contain a row for each letter and a field with a value of 'Unsorted' or
'Sorted'. This table will be used to store the total number of
'Unsorted' and 'Sorted' letter notifications per day.
2018-03-06 09:09:02 +00:00
Richard Chapman
271e157d1a Merge pull request #1737 from alphagov/add_precompiled_letters
Updated API to handle pre-compiled pdfs
2018-03-06 08:39:49 +00:00
pyup-bot
3a9e390902 Update freezegun from 0.3.9 to 0.3.10 2018-03-06 03:11:22 +00:00
pyup-bot
acd6b0c05b Update pytest from 3.4.1 to 3.4.2 2018-03-06 00:07:20 +00:00
Richard Chapman
bfdd385ba3 Tidied up imports. Removed local imports and made a global import so its
easier to maintain in future.
2018-03-05 17:08:09 +00:00
Chris Hill-Scott
ca167206d5 Add command to backfill Performance Platform totals
We don’t have any way of playing back the totals we send to performance
platform.

This commit copies the command used to backfill the processing time and
adapts it to backfill the totals instead. Under the hood it uses the
same code that we use in the scheduled tasks to update performance
platform on a daily basis. I had to modify this code to take a `day`
argument because it was hardcoded to only work for ‘yesterday’.
2018-03-05 17:02:33 +00:00
Richard Chapman
033a4099bc Added tests for all conditions for s_precompiled_letter.
* Added tests for hidden = true but name not precompiled
* Added test where name is precompiled but hidden is false
2018-03-05 16:57:48 +00:00
Richard Chapman
e91a0efc43 Refactored code to make it more maintainable and changed an error type
* Rather than an abort 404 returned a 500 and InvalidRequest so that the
error is more easily handled on the admin console. If the file is
missing but expected to be there is actually an internal error for admin
* Refactored the code to remove duplicate code in calls to template
preview by creating a new private method which is called with specific
parameters
2018-03-05 14:54:18 +00:00
Chris Hill-Scott
98d5408d7d Merge pull request #1727 from alphagov/pyup-update-pytest-mock-1.7.0-to-1.7.1
Update pytest-mock to 1.7.1
2018-03-05 14:52:15 +00:00
Chris Hill-Scott
e972b97226 Merge pull request #1735 from alphagov/pyup-update-coveralls-1.2.0-to-1.3.0
Update coveralls to 1.3.0
2018-03-05 14:52:06 +00:00
Chris Hill-Scott
2d45070086 Merge pull request #1734 from alphagov/count-letters-performance-platform
Send count of sent letters to performance platform
2018-03-05 14:51:47 +00:00
Richard Chapman
a4feaba309 Added tests to tests for precompiled flow and refactored a little
* Added is_precompiled_letter method to letter/utils.py
* Added tests for letter/utils.py
* Added tests for the rest endpoint
* Moved the Precompiled name to a central location
* Added hidden field to the test method to create a template
2018-03-05 14:11:37 +00:00
pyup-bot
5e44449e66 Update coveralls from 1.2.0 to 1.3.0 2018-03-03 00:00:41 +00:00
Chris Hill-Scott
7e1aa03371 Send count of sent letters to performance platform
Now we’ve been sending real letters for quite a while it would be nice
to show how many.
2018-03-02 16:54:48 +00:00
Richard Chapman
a9a67ce542 Updated API to handle pre-compiled pdfs
* added a method to letter/utils.py to get the PDF document from the S3
bucket
* added the logic to return the pdf or to produce a png of the pdf
2018-03-02 14:54:28 +00:00
Chris Hill-Scott
7ef6af2d14 Remove anything to do with DVLA format letters 2018-03-02 14:13:12 +00:00
Rebecca Law
d4db959a55 Merge pull request #1731 from alphagov/process-old-letter-responses
Process old letter responses
2018-03-02 12:35:47 +00:00
Rebecca Law
8aea452df9 Because research mode and test keys do not create notification history, a try except block has been added. 2018-03-02 11:37:15 +00:00
Rebecca Law
c474b2312b Process responses for letters even after the notification has been deleted.
This will continue to update the notification history for letter notifications.
We currently have an issue where the responses to letters from the provider is taking a long time.
This is due to the manual nature of their process.
Updating the status of the letter will still work if the notification has been purged.

Also turned back on the purge letter notification scheduled task.
2018-03-02 11:29:22 +00:00
Rebecca Law
a6de9142cf Merge pull request #1721 from alphagov/remove-old-letter-flow
Remove old letter flow
2018-03-02 11:23:07 +00:00
Rebecca Law
d6c929d127 Another unused method to delete 2018-03-02 11:05:06 +00:00
Rebecca Law
bffc4863db Remove all methods no longer used now that we only send pdf files to DVLA. 2018-03-02 11:05:05 +00:00
Rebecca Law
304f4d5c67 Remove unused methods 2018-03-02 11:05:05 +00:00