diff --git a/classes/Member.php b/classes/Member.php index 25f7261449..deadb7631c 100644 --- a/classes/Member.php +++ b/classes/Member.php @@ -459,7 +459,7 @@ private function left_house_line($house, $house_name) { } } - public function getPartyPolicyDiffs($partyCohort, $policiesList, $positions, $only_diffs = false) { + public function getPartyPolicyDiffs($partyCohort, $policiesList, $positions) { $policy_diffs = array(); $party_positions = $partyCohort->getAllPolicyPositions($policiesList); @@ -482,10 +482,6 @@ public function getPartyPolicyDiffs($partyCohort, $policiesList, $positions, $on $score_diff = $this->calculatePolicyDiffScore($mp_score, $party_score); - // skip anything that isn't a yes vs no diff - if ( $only_diffs && $score_diff < 2 ) { - continue; - } $policy_diffs[$policy_id] = [ 'policy_text' => $details['policy'], 'score_difference' => $score_diff, diff --git a/tests/PartyTest.php b/tests/PartyTest.php index f018e951f9..17116a068a 100644 --- a/tests/PartyTest.php +++ b/tests/PartyTest.php @@ -252,13 +252,20 @@ private function getMemberFromPersonId($person_id) return new MySociety\TheyWorkForYou\Member([ "person_id" => $person_id ]); } - public function testMPPartyPolicyTextWhenDiffers() { // Checks that an MP that differs from party gets the 'sometimes differs from their party' on the profile page $page = $this->fetch_page(array('pid' => 15, 'url' => '/mp/15/test_mp_g_party_1/test_westminster_constituency')); $this->assertStringContainsString('Test MP G Party 1', $page); + } + + public function testMPPartyPolicyTextWhenDiffersVotes() + { + MySociety\TheyWorkForYou\PartyCohort::populateCohorts(); + MySociety\TheyWorkForYou\PartyCohort::calculatePositions(); + $page = $this->fetch_page(array('pagetype' => 'votes', 'pid' => 15, 'url' => '/mp/15/test_mp_g_party_1/test_westminster_constituency/votes')); $this->assertStringContainsString('is a G Party MP', $page); + $this->assertStringContainsString('Test MP G Party 1', $page); $this->assertStringContainsString('sometimes differs from their party', $page); } diff --git a/www/docs/mp/index.php b/www/docs/mp/index.php index 751215e2bf..cfe6618a49 100644 --- a/www/docs/mp/index.php +++ b/www/docs/mp/index.php @@ -416,7 +416,12 @@ ); } - person_party_policy_diffs($MEMBER, $policiesList, false); + person_party_policy_diffs($MEMBER, $policiesList); + + $data['sorted_diffs_only'] = array_filter( + $data['sorted_diffs'], + function($k) { return $k['score_difference'] >= 2; } + ); // Send the output for rendering MySociety\TheyWorkForYou\Renderer::output('mp/votes', $data); @@ -483,8 +488,6 @@ // Generate limited voting record list $data['policyPositions'] = new MySociety\TheyWorkForYou\PolicyPositions($policies, $MEMBER, $policyOptions); - person_party_policy_diffs($MEMBER, $policiesList, true); - // Send the output for rendering MySociety\TheyWorkForYou\Renderer::output('mp/profile', $data); @@ -1162,7 +1165,7 @@ function policy_image($data, $MEMBER, $format) { } // generate party policy diffs -function person_party_policy_diffs($MEMBER, $policiesList, $only_diffs) { +function person_party_policy_diffs($MEMBER, $policiesList) { global $data; $divisions = new MySociety\TheyWorkForYou\Divisions($MEMBER); @@ -1178,6 +1181,6 @@ function person_party_policy_diffs($MEMBER, $policiesList, $only_diffs) { $positions = new MySociety\TheyWorkForYou\PolicyPositions( $policiesList, $MEMBER, [ 'summaries' => $policySummaries, ]); - $policy_diffs = $MEMBER->getPartyPolicyDiffs($partyCohort, $policiesList, $positions, $only_diffs); + $policy_diffs = $MEMBER->getPartyPolicyDiffs($partyCohort, $policiesList, $positions); $data['sorted_diffs'] = $policy_diffs; } diff --git a/www/includes/easyparliament/templates/html/mp/profile.php b/www/includes/easyparliament/templates/html/mp/profile.php index a134e2a9bc..adcdf15056 100644 --- a/www/includes/easyparliament/templates/html/mp/profile.php +++ b/www/includes/easyparliament/templates/html/mp/profile.php @@ -5,10 +5,6 @@ // it'll display a banner with the MPs stats, assuming we have them for the // year $display_wtt_stats_banner = '2015'; - -# fetch covid_policy_list -$policies_obj = new MySociety\TheyWorkForYou\Policies(); -$covid_policy_list = $policies_obj->getCovidAffected(); ?>
See full list of topics voted on
- -We have lots more plain English analysis of = $full_name ?>’s voting record on issues like health, welfare, taxation and more. Visit = $full_name ?>’s full vote analysis page for more.
- -- = $full_name ?> is a = $party ?> MP, and on the vast majority of issues votes the same way as other = $party ?> MPs. -
- -- However, = $full_name ?> sometimes differs from their party colleagues, such as: -
- -We have lots more plain English analysis of = $full_name ?>’s voting record on issues like health, welfare, taxation and more. Visit = $full_name ?>’s full vote analysis page for more.
- - positions) > 0 ): ?> - 1) { ?> - $comparison_party){ ?> -- = $full_name ?> is a = $party ?> MP, but has changed parties or become independent. -
-- Compared to their original party (= $comparison_party ?>), for the vast majority of issues they have voted in the same way as other = $comparison_party ?> MPs. -
- - -- = $full_name ?> is a = $party ?> MP, and on the vast majority of issues votes the same way as other = $party ?> MPs. -
- - - - -- This is a random selection of = $full_name ?>’s votes. -
- -- Last updated: = format_date($policy_last_update['latest'], SHORTDATEFORMAT) ?>. - Learn more about our voting records and what they mean. -
- -We have lots more plain English analysis of = $full_name ?>’s voting record on issues like health, welfare, taxation and more. Visit = $full_name ?>’s full vote analysis page for more.
- positions) == 0 ): ?> - -No votes to display.
- - - -= $full_name ?> = $rebellion_rate ?>
- -+ = $full_name ?> is a = $party ?> MP, and on the vast majority of issues votes the same way as other = $party ?> MPs. +
+ ++ However, = $full_name ?> sometimes differs from their party colleagues, such as: +
+ += $full_name ?> = $rebellion_rate ?>
+ + += $segment['votes']->moreLinksString ?>