Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display any votes where MP differs from party on profile page #911

Merged
merged 9 commits into from Jul 23, 2015

Conversation

struan
Copy link
Member

@struan struan commented Jul 2, 2015

This imports the policy vote from PublicWhip and then uses all the votes of current party members to calculate the party's position on a policy. It then compares that with an MP's position and if it is in opposition then it displays that policy on the MP's profile page.

Connects to #910

@struan struan force-pushed the issues/910-mp-party-issues-differences branch 5 times, most recently from a609046 to 50cd881 Compare July 2, 2015 16:54
$db = new \ParlDB;

$party_list = $db->query(
"SELECT DISTINCT party FROM member"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ignore empty party?

@dracos dracos added Reviewed and removed Reviewing labels Jul 13, 2015
@dracos
Copy link
Member

dracos commented Jul 13, 2015

Some questions, but not really on the code which is fine :)

@struan
Copy link
Member Author

struan commented Jul 14, 2015

$motion->direction is the result of the vote ( Majority indicates the vote went with the policy and minority against ) and $motion->motion->policy_vote is which direction an MP would vote if they agreed with the policy.

@dracos dracos self-assigned this Jul 20, 2015
// generate party policy diffs
$party = new MySociety\TheyWorkForYou\Party($MEMBER->party());
$positions = new MySociety\TheyWorkForYou\PolicyPositions( $policiesList, $MEMBER );
if ( $party ) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this ever false?

@dracos
Copy link
Member

dracos commented Jul 20, 2015

One tiny query, otherwise 👍 (and yay tests)

@dracos dracos removed their assignment Jul 20, 2015
@struan struan force-pushed the issues/910-mp-party-issues-differences branch 6 times, most recently from 4625523 to 585b6b5 Compare July 22, 2015 16:37
Import details of which way an MP has to vote to be in agreement with a
policy to allow us to use this in calculations
Run over all policies and use the MPs division votes to calculate the
parties position on the policy.
Then store that position in a table for later lookup.
If an MP has policies where they are in opposition to their party then
display that in the votes box on their profile page. Otherwise default
to the existing random selection of votes.
Also ignore Crossbench and Independent parties as they're not really a
party so it doesn't make sense to calculate policies positions for them
Avoid confusing people by calculating the policies for Labour and
Labour/Co-op MPs as if they were all Labour MPs because that's what
people would expect.
in this case it doesn't really make sense to assign a position to the
party so the score is -1.
if the party has no positions then we can't say what the policy
differences with the MP are so just return an empty set
it was possible if the MP did not have positions on the randomly
selected 6 policies that nothing would display in the votes box so if
they have party differences display the box.
@struan struan force-pushed the issues/910-mp-party-issues-differences branch from 585b6b5 to 16321df Compare July 23, 2015 10:40
@struan struan merged commit 16321df into master Jul 23, 2015
@struan struan removed the Reviewed label Jul 23, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants