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
Conversation
a609046
to
50cd881
Compare
$db = new \ParlDB; | ||
|
||
$party_list = $db->query( | ||
"SELECT DISTINCT party FROM member" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ignore empty party?
Some questions, but not really on the code which is fine :) |
|
// generate party policy diffs | ||
$party = new MySociety\TheyWorkForYou\Party($MEMBER->party()); | ||
$positions = new MySociety\TheyWorkForYou\PolicyPositions( $policiesList, $MEMBER ); | ||
if ( $party ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this ever false?
One tiny query, otherwise 👍 (and yay tests) |
4625523
to
585b6b5
Compare
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.
585b6b5
to
16321df
Compare
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