- Duplicates were appearing in the output of this because it was checking all editions and not differentiating between published and archived editions. As per #398 (comment), display the `state` of an edition to guard against this confusion and provide opportunities for filtering.
The department field is being removed because: * we have the organisations tagging now, which is structured and formal * this field is labelled "Writing team" in Panopticon, so has all sorts of data in it, including the names of individuals
The list of tags is not orderable, but is shown during editing in the order that the tags were added. However, when the draft is saved and then re-displayed, the tags appear in alphabetical order. This has caused some confusion in the past amongst editors. Similar solution to: alphagov/policy-publisher#66
Migrate existing analytics profiles from frontend to non-archived transaction editions * Add profiles from https://github.com/alphagov/frontend/blob/d940889b5bb779ca72266c03c7458b b296e010af/app/helpers/cross_domain_analytics_helper.rb * 1 new from https://trello.com/c/QyHwb1Zu/
- Generates a CSV of the form "slug","lgsl","lgil","title". - This might need to be done again in future, and across environments, hence the rake task.
Add a third column to the CSV being used to import mainstream browse tags to indicate whether the tag should be applied as a "primary" tag (ie, at the start of the list of browse pages, so used for breadcrumbs on the page, or at the end of the list). Complain if we get any value other than "TRUE", "FALSE" or unspecified from this field, so we don't get confused when converting from the value in the CSV to a boolean.
After content has been tagged with mainstream browse pages, we need to republish it to the publishing-api and to panopticon, so that search and other information is updated correctly. We republish whether we've made changes or not in this run, since a previous run might have made the changes to the publisher database, but then received errors when publishing. Simply republishing always means we can handle such errors cleanly.
If a document has no published edition, or the published edition was already tagged with the required page, editions in draft state were not also being updated. Fix this by fetching all non-archived editions, instead of just the published edition. Change the output messages to start with what action or error happened, so that it's easy to scan down the output for slugs which failed. Also, refactor to put the code which adds the tag into a private method instead of being inline, and to pass editions to the `import_error` reporting method so that both the slug and version number can be reported.