Open chriswales95 opened 3 months ago
Can we ship this with revisions turned off @chriswales95 ?
@willguv They already are apart from the election content type. They're already turned off for the vote content type.
The issue I've found is that if they use localgov_workflows we're a bit stuck. That module turns on workflows and revisions for each new content type automatically.
We'll just need to advertise for users to not enable workflows for area votes and elections.
Even without workflows enabled, we can still replicate the problem, just by creating a new revision.
Steps to reproduce.
Create new localgov_drupal instance on Gitpod https://gitpod.io/#https://github.com/localgovdrupal/localgov_project
ddev composer require localgovdrupal/localgov_elections
ddev drush en localgov_elections_demo_content -y
View the Oxford East node at /election/general-election-july-2024/oxford-east
ddev drush uli
@finnlewis Yes, that's correct. I just mention workflows because this is how it happend with Bob who we were chatting in with Slack.
Revisions are the route cause.
So we need to make sure users don't use revisons but perhaps also mention workflows because that turns on revisions automatically as well.
Thanks so much both for getting to the bottom of this
Added a PR for making sure revisions are turned off by default for election nodes and added the issue as a known issue in our README.
I think we make a permanent fix after the election.
From debugging with @ekes , we think this might be due to the localgov_election_winner field referencing the same candidate paragraph that the candidates field references.
So we have the same paragraph referenced twice.
When creating a new revision, this creates two new revisions for that paragraph, and the wrong one is referenced in the candidates field.
I think we want to remove the localgov_election_winner reference to the candidate paragraph.
Then we can just store the id of the winning candidate on the node, rather than a full on entity reference revisions field.
Option 1:
Option 2:
Reading here: https://www.drupal.org/docs/drupal-apis/entity-api/dynamicvirtual-field-values-using-computed-field-property-classes
I would prefer to run with option 2, but I think option 1 will be quicker and follows the current pattern of having these fields defined in the field ui.
@dedavidson any thoughts on this one?
Option 2 is best as it is dynamic and won't need hooks to update a stored field.
@dedavidson thanks, I agree,... but... I then saw that most of the views have integration with the paragraphs reference field and I simply don't have time to go through all the views and refactor. We can do in time, but for now I've taken a different approach.
Suppress the creation of new revisions for the localgov_election_candidate paragraph.
See https://github.com/localgovdrupal/localgov_elections/pull/101
Keeping this open but removing the stable blocker label.
We've mitigated the issue with https://github.com/localgovdrupal/localgov_elections/pull/101
BUT we are still not compatible with revisions.
Using revisions with area votes breaks the reporting capability of the module.
With revisions turned on follow these steps to reproduce:
Suggested solution: