Skip to content

Commit

Permalink
Use gids rather than ids in motion restriction
Browse files Browse the repository at this point in the history
  • Loading branch information
ajparsons committed Dec 20, 2024
1 parent 6fec9bd commit 1e07479
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
14 changes: 8 additions & 6 deletions src/votes/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -644,9 +644,10 @@ def apply_analysis_override(self):
return self

if override.banned_motion_ids:
banned_ids = [int(x) for x in override.banned_motion_ids.split(",")]
if self.motion_id in banned_ids:
self.motion = None
banned_ids = [x for x in override.banned_motion_ids.split(",")]
if self.motion:
if self.motion.gid in banned_ids:
self.motion = None

return self

Expand Down Expand Up @@ -971,9 +972,10 @@ def apply_analysis_override(self):
if not override:
return self
if override.banned_motion_ids:
banned_ids = [int(x) for x in override.banned_motion_ids.split(",")]
if self.motion_id in banned_ids:
self.motion = None
banned_ids = [x for x in override.banned_motion_ids.split(",")]
if self.motion:
if self.motion.gid in banned_ids:
self.motion = None

return self

Expand Down
2 changes: 1 addition & 1 deletion src/votes/templates/votes/decision.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ <h3>Parliamentary analysis</h3>
{% if decision.motion %}
<h2>Motion</h2>
{% featureflag pg.ADVANCED_INFO %}
<p>Motion ID: {{ decision.motion.id }}</p>
<p>Motion GID: {{ decision.motion.gid }}</p>
{% endfeatureflag %}
<p class = "motion_type">
Motion type: {{ decision.motion.motion_type_nice }}(<a href="{% url 'help' 'motion_types' %}#{{ decision.motion.motion_type|replace_underscore_with_hyphen }}">?</a>)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_analysis_override.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
def override():
ao = AnalysisOverride(
decision_key="pw-2024-12-03-52-commons",
banned_motion_ids="5755",
banned_motion_ids="uk.org.publicwhip/debate/2024-12-03b.193.2.1",
parl_dynamics_group="free_vote",
manual_parl_dynamics_desc="Manual text",
)
Expand Down

0 comments on commit 1e07479

Please sign in to comment.