diff --git a/classes/Divisions.php b/classes/Divisions.php index d2a1d9f0d2..772286e381 100644 --- a/classes/Divisions.php +++ b/classes/Divisions.php @@ -143,7 +143,7 @@ public function getRecentDebatesWithDivisions($number = 20, $majors = null) { # section/subsection bodies to construct a debate title $q = $this->db->query( "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 + min(ss.gid) as debate_gid, min(h.gid), min(h.hdate) as hdate, min(h.major) as hmajor, 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 @@ -161,9 +161,9 @@ public function getRecentDebatesWithDivisions($number = 20, $majors = null) { $debate_gid = fix_gid_from_db($debate['debate_gid']); $anchor = ''; if ($debate['c'] == 1) { - $anchor = '#g' . gid_to_anchor(fix_gid_from_db($debate['gid'])); + $anchor = '#g' . gid_to_anchor(fix_gid_from_db($debate['debate_gid'])); } - $url = new Url($hansardmajors[$debate['major']]['page']); + $url = new Url($hansardmajors[$debate['hmajor']]['page']); $url->insert(array('gid' => $debate_gid)); $debates[] = [ 'url' => $url->generate() . $anchor,