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

1738 move votes from profile page #1756

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php_version: ["7.0", "7.2", "7.3", "7.4"]
php_version: ["7.3", "7.4", "8.2"]

services:
mariadb:
Expand Down
4 changes: 2 additions & 2 deletions classes/Divisions.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,8 @@ public function getRecentDebatesWithDivisions($number = 20, $majors = null) {
# Fetch any division speech, its subsection gid for the link, and
# section/subsection bodies to construct a debate title
$q = $this->db->query(
"SELECT eps.body as section_body, epss.body as subsection_body,
ss.gid as debate_gid, h.gid, h.hdate, h.major, count(h.gid) AS c
"SELECT min(eps.body) as section_body, min(epss.body) as subsection_body,
min(ss.gid) as debate_gid, min(h.gid), min(h.hdate), min(h.major), count(h.gid) AS c
FROM hansard h, hansard ss, epobject eps, epobject epss
WHERE h.section_id = eps.epobject_id
AND h.subsection_id = epss.epobject_id
Expand Down
6 changes: 1 addition & 5 deletions classes/Member.php
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,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);

Expand All @@ -495,10 +495,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,
Expand Down
7 changes: 5 additions & 2 deletions classes/Memcache.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,17 @@ public function __construct() {
if (class_exists('\Memcached')) {
self::$memcache = new \Memcached;
self::$memcache->addServer(OPTION_TWFY_MEMCACHED_HOST, OPTION_TWFY_MEMCACHED_PORT);
} else {
} elseif (class_exists('\Memcache')) {
self::$memcache = new \Memcache;
self::$memcache->connect(OPTION_TWFY_MEMCACHED_HOST, OPTION_TWFY_MEMCACHED_PORT);
}
}
}

public function set($key, $value, $timeout = 3600) {
if (!self::$memcache) {
return;
}
if (class_exists('\Memcached')) {
self::$memcache->set(OPTION_TWFY_DB_NAME.':'.$key, $value, $timeout);
} else {
Expand All @@ -37,7 +40,7 @@ public function get($key) {
$was_found = false;
if (class_exists('\Memcached')) {
$value = self::$memcache->get(OPTION_TWFY_DB_NAME.':'.$key, null, $was_found);
} else {
} elseif (class_exists('\Memcache')) {
$value = self::$memcache->get(OPTION_TWFY_DB_NAME.':'.$key, $was_found);
}
if ($was_found === false) {
Expand Down
17 changes: 14 additions & 3 deletions classes/PartyCohort.php
Original file line number Diff line number Diff line change
Expand Up @@ -395,14 +395,25 @@ public static function getCohortQuery(){
from
(select
person_id,
REPLACE(COALESCE(party), "/Co-operative", "") as "start_party",
GROUP_CONCAT(concat(entered_house,":", left_house)) as "membership_key"
REPLACE(COALESCE(m2party), "/Co-operative", "") as "start_party",
GROUP_CONCAT(concat(entered_house,":", left_house) ORDER BY entered_house) as "membership_key"
from
member

inner join
(
select party m2party, person_id m2pid
from member
where
house = :house and entered_house > :cut_off
and entered_house = (select min(entered_house) from member m3 where house=:house and entered_house > :cut_off and member.person_id=m3.person_id)
) m2
ON member.person_id = m2.m2pid

where
house = :house and entered_house > :cut_off
group by person_id
order by person_id, entered_house
order by person_id
)as member_periods
left join
(select
Expand Down
7 changes: 7 additions & 0 deletions classes/Utility/Wikipedia.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,13 @@ public static function wikipedize($source) {
$params[':phrase' . $i] = $phrase;
}

if (!$params) {
if ($was_array) {
$source = explode('|||', $source);
}
return $source;
}

# Open up a db connection, and whittle our list down even further, against
# the real titles.
$matched = array();
Expand Down
12 changes: 7 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
}
},
"require": {
"php": ">=5.4",
"php": ">=7.3",
"filp/whoops": "2.*",
"ircmaxell/password-compat": "1.0.4",
"facebook/graph-sdk": "^5.6",
Expand All @@ -15,13 +15,15 @@
"phpmailer/phpmailer": "^6.5"
},
"require-dev": {
"phpunit/phpunit": "4.8.*",
"phpunit/dbunit": ">=1.2",
"phpdocumentor/phpdocumentor": "2.*"
"phpunit/phpunit": "9.*",
"phpdocumentor/phpdocumentor": "3.*"
},
"config": {
"platform": {
"php": "7.0"
"php": "7.3"
},
"allow-plugins": {
"symfony/flex": true
}
}
}
Loading