Skip to content
This repository has been archived by the owner on Jul 11, 2019. It is now read-only.

Amendments sometimes don't have a selection #950

Open
xi opened this issue Jan 14, 2015 · 2 comments
Open

Amendments sometimes don't have a selection #950

xi opened this issue Jan 14, 2015 · 2 comments
Labels

Comments

@xi
Copy link
Collaborator

xi commented Jan 14, 2015

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
Copy link
Collaborator Author

xi commented Aug 4, 2015

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()

@nidico
Copy link
Collaborator

nidico commented Sep 9, 2015

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants