DemocracyClub / yournextrepresentative

👥 A website for crowd-sourcing structured election candidate data
https://candidates.democracyclub.org.uk
GNU Affero General Public License v3.0
21 stars 27 forks source link

Give users an option to delete results #2307

Closed VirginiaDooley closed 3 months ago

VirginiaDooley commented 4 months ago

There is currently no way to remove results from a ballot in the front end or admin panel. One might try to remove the results in the edit form but this leaves with validation errors that we don't want to change. This change gives user with permission that power, deleting result set, candidate result and reverting winner in the process.

The context for this particular feature, requested by @pmk01, was: "One of the candidates needs splitting into two profiles, but this can only be done if the ballot doesn't have results added."

Screenshot 2024-05-07 at 4 01 47 PM

symroe commented 3 months ago

I think this is a classic XY problem: we really want to be able to split candidates, we can't, and this prevents the workaround from working properly.

We should grasp the nettle and figure out candidate splitting, really.

I imagine there might be other reasons to remove results, though. However, I'm not convinced that deleting the resultset model is a good idea. This means we lose all the history of the results forever, including sources etc.

It would be better to delete the candidate results (in the backend, so as to avoid form validation errors), and create a new version in the versions field to reflect that the results were deleted. This would (should) allow reverting to a previous set of results if they were deleted in error.

However, I think the better solution is to allow splitting. I can't actually think of another reason to remove the results all together (rather than correcting them).

pmk01 commented 3 months ago

Good points Sym. I do want to delete some results, but these are all the non-FPTP ones which don't work in our system. How close are we to being able to split candidates? This needs doing sooner rather than later, hence the results deletion workaround.

VirginiaDooley commented 3 months ago

We've decided that this feature is not actually what we need, esp as we want to keep version history. Instead we will focus on the long awaited fix for candidate splitting. https://github.com/DemocracyClub/yournextrepresentative/issues/646