adhocracy icon indicating copy to clipboard operation
adhocracy copied to clipboard

Amendments sometimes don't have a selection

Open xi opened this issue 9 years ago • 2 comments

Sometimes amendments don't have a selection. When trying to access their selections, an exception is thrown. This leads to a 500 error on the instance overview.

A workaround is to either delete the proposal or add a selection. But when I added a selection, the amendment was still not visible in the amendment overlay.

xi avatar Jan 14 '15 11:01 xi

Here is the script to add missing selections. Note that for some reason this is counted as a selection, but it does not show up in the sidebar.

from adhocracy.lib.text import variant_normalize
from adhocracy import model


def fix_selection(proposal_id, page_id):
    proposal = model.Proposal.find(proposal_id)
    page = model.Page.find(page_id)
    variant = variant_normalize(proposal.title)
    selection = model.Selection.create(proposal, page, proposal.creator, variant=variant)
    model.meta.Session.commit()

xi avatar Aug 04 '15 15:08 xi

Note: page_id is the page the amendment refers to / changes. This may need to be deducted from the content.

nidico avatar Sep 09 '15 21:09 nidico