DemocracyClub / EveryElection

:ballot_box_with_check: For recording every election in the UK
https://elections.democracyclub.org.uk/
BSD 3-Clause "New" or "Revised" License
11 stars 15 forks source link

Deleting a child election does not update the parent's modified timestamp #2289

Open awdem opened 3 weeks ago

awdem commented 3 weeks ago

Peter deleted a ballot-level election that was made mistakenly. This updated the modified timestamp for the ballot-level election, but didn't update its parent election's modified timestamp.

Aside from this causing some issues with other project's EE importers, it would make sense that deleting a child election also updates the parent election's modified timestamp because the parent has one less child.

For more info on the soft delete system: https://github.com/DemocracyClub/EveryElection/wiki/Cancelled-Elections-and-Soft-Deletes

One potential fix:

In the ModerationHistory.save() method, touch the modified date of any parent elections as well as the election object itself: https://github.com/DemocracyClub/EveryElection/blob/0decd2dddd2d2e4c09c23e70d6ca74eac1c2ee57/every_election/apps/elections/models.py#L556-L569

related issue on YNR: https://github.com/DemocracyClub/EveryElection/issues/2289

awdem commented 2 weeks ago

Adjacent issue:

two ballot-level elections were created and approved after their parent election local.2024-12-05. Their creation and approval didn't update the parent election modified timestamp. These ballot-level elections weren't synced by YNR because it only syncs recently modified parent elections. I think that this a change like the one suggested above would also address this issue, but it worth investigating.