Fix choosing a date from category hits graph pages

If you were viewing the hits in a category, for example:

/sites/businesslink/hits/category?category=errors

The code was overwriting the querystring and so omitting the category
parameter. Following that link would trigger a 5xx error because category was
empty when it shouldn't be.

Using the URI library, we can add or overwrite just the relevant part of the
querystring.
Merge pull request #397 from alphagov/fix_hits_graph_period_selection_from_category_pages

Fix choosing a date from category hits graph pages
Store path relative to Rails.root when tracking hits files

We use timestamped directories for releases in production. This
means that on every deploy the absolute filenames for hits files
change, even if the hits files in transition-stats and pre-transition-stats
haven't changed. All hits files are therefore re-imported after every
deploy, which is unnecessary and takes a long time.

To fix this, this stores the filename relative to Rails.root, thereby
excluding the part of the path which changes on deploy. @rgarner thought
he had a reason for not doing this originally, but can't remember it now.

It would be good to avoid this in production, but in preview it is
even more important at the moment. Preview is deployed to more frequently
than production, and the overnight data sync from production also
causes timestamp mismatches. We're trying to compare performance of
the hits import between MySQL and Postgres at the moment, and that
is very hard when the import mostly takes much longer than it needs to,
and longer than it would be in production.
Delete absolute filename ImportedHitsFiles

Each actual hits file will have many records in this table because the
filenames were being stored as absolute paths, including a timestamped
directory per deploy. This cleans those old records up so that we will
have only one row per real hits file with a relative path filename.

This will delete only rows with an absolute filename, in case someone
wants to rollback in dev and then migrate forwards through this again
without losing any relative-filename tracking.
Add third GDS TLD IP address
Merge pull request #399 from rjc123/patch-3

Add third GDS TLD IP address
Merge pull request #398 from alphagov/store_relative_filename_for_tracking_hits

Store relative filename for tracking hits
MappingsController index can render a CSV
Link to mappings CSV export, for admins only

We don't want to encourage use of spreadsheets, but we do occasionally get
asked to provide them. Let's make life easy on ourselves by giving us a means
to provide the spreadsheet easily. It also enables advanced users to search and
filter in ways we don't intend to support (eg look for mappings matching a
regex).
Only allow admins to export as CSV
Merge pull request #392 from alphagov/mappings_csv_export

Mappings CSV export
Really test that the jump to mapping dialog finds a site

- Before, this was only testing for the presence of the site host in any
  form, which would have matched on the error page's <p> tag and passed.
  We don't want it to match an error page, we want to know that the site
  has been found, so test for the site host in header text.
- Add a test for the "Unknown site" error page case.
- Remove www. in the test data to be consistent with the factory—I'd got
  confused with the thing I did for finding non-www sites.
Make an RSpec test consistent with the others of its type

- This was testing for `response.status` redirecting to a URL. I'm not
  sure how this worked, unless `redirect_to` passes its status code back
  and it was receiving that, but in any case it looks wrong at first
  glance, and we should be consistent with the other redirect_to tests
  in this file and others.
Merge pull request #401 from alphagov/make_an_rspec_test_consistent

Make an RSpec test consistent with the others of its type
Add unique index to ImportedHitsFile.filename

Conceptually there is only one hits file at a given path; if the
content has changed, then the hash will also have changed and it
will be reimported. This enforces this at the database level.
Validate uniqueness of ImportedHitsFile.filename
Merge pull request #404 from alphagov/uniqueness_of_imported_hits_files

Ensure that ImportedHitsFiles are unique by filename
Merge pull request #400 from alphagov/really_test_jump_to_mapping

Really test that the jump to mapping dialog finds a site
Enable GDS Editors to edit the transition date

- Following a conversation with Jenny and Robin, dates can be edited
  even when the site is live.
- This specifies the format that they're entered in with the date_field
  form helper, which goes into the database as yyyy-mm-dd and gets
  converted to the GOV.UK date format upon display on the site
  dashboard, as it already did.
Remove launch_date from the redirector site YAML import

- Soon, redirector will no longer be the source of transition dates.