Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
Derive Government from Edition at run-time, rather than persisting on Document #2008
Taking this approach simplifies the code significantly, keeping the relationship to
Paired with @tekin
Government was set based on `first_published_at`, which does not work for consultations and speeches; - Consultations do not set a `first_published_at` - Speeches have a `delivered_on`, which may be different from `first_published_at`, and is usually earlier. Add a new method to expose the right date to identify a Government responsible for the Edition.
This association is not used anywhere in the app. Getting rid of it as a pre step to refactoring the derivation of government on editions.
We've moving away from Government being set on Document, and instead being derived from the Edition itself. Move the "which government owns this edition" logic into the Edition model itself. Update the publishing workflow to use this, rather than having to know about Edition/Government relationships.
We now derive Government from an Edition, on demand, rather than pre-calculating it and storing it on Document.
- Break date related tests into their own class - Use new government factories - Generally much easier to read and understand intent