Skip to content

Commit df8da38

Browse files
authored
Merge pull request #1046 from datanfr/delete-warning-card_home
Delete warning card home
2 parents 36a6c81 + ce0ceb7 commit df8da38

File tree

2 files changed

+24
-3
lines changed

2 files changed

+24
-3
lines changed

application/controllers/Stats.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,10 @@ public function individual($url){
201201
$data['ageMeanPop'] = round(mean_age_france());
202202
$data['groupsAge'] = $this->stats_model->get_groups_age();
203203
if ($data['groupsAge']) {
204+
foreach ($data['groupsAge'] as &$group) {
205+
$group['couleurCard'] = $this->groupes_model->get_groupe_color_card(['uid' => $group['organeRef']]);
206+
}
207+
unset($group);
204208
$data['groupOldest'] = array_slice($data['groupsAge'], 0, 1);
205209
$data['groupOldest'] = $data['groupOldest'][0];
206210
$data['groupOldest']['couleurAssociee'] = $this->groupes_model->get_groupe_color(array($data['groupOldest']['libelleAbrev'], $data['groupOldest']['couleurAssociee']));
@@ -223,6 +227,10 @@ public function individual($url){
223227
$data['womenMean']['diff'] = abs($women_mean[1]['percentage'] - $data['womenMean']['nSociety']);
224228
$data['groupsWomen'] = $this->stats_model->get_groups_women();
225229
if ($data['groupsWomen']) {
230+
foreach ($data['groupsWomen'] as &$group) {
231+
$group['couleurCard'] = $this->groupes_model->get_groupe_color_card(['uid' => $group['organeRef']]);
232+
}
233+
unset($group);
226234
$data['groupsWomenFirst'] = $data['groupsWomen'][0];
227235
$data['groupsWomenFirst']['couleurAssociee'] = $this->groupes_model->get_groupe_color(array($data['groupsWomenFirst']['libelleAbrev'], $data['groupsWomenFirst']['couleurAssociee']));
228236
$data['groupsWomenLast'] = end($data['groupsWomen']);
@@ -256,6 +264,7 @@ public function individual($url){
256264
$data['groups'] = $this->stats_model->get_groups_cohesion();
257265
if ($data['groups']) {
258266
foreach ($data['groups'] as $key => $value) {
267+
$data['groups'][$key]['couleurCard'] = $this->groupes_model->get_groupe_color_card(['uid' => $value['organeRef']]);
259268
if ($value['libelleAbrev'] == 'NI') {
260269
$keyRemoveNI = $key;
261270
}
@@ -323,6 +332,10 @@ public function individual($url){
323332

324333
$data['groups'] = $data['n_sps'] < 10 ? $data['votes_all'] : $data['votes_sps'];
325334
if ($data['groups']) {
335+
foreach ($data['groups'] as &$group) {
336+
$group['couleurCard'] = $this->groupes_model->get_groupe_color_card(['uid' => $group['organeRef']]);
337+
}
338+
unset($group);
326339
$data['groupsFirst'] = $data['groups'][0];
327340
$data['groupsFirst']['couleurAssociee'] = $this->groupes_model->get_groupe_color(array($data['groupsFirst']['libelleAbrev'], $data['groupsFirst']['couleurAssociee']));
328341
$data['groupsLast'] = end($data['groups']);
@@ -362,6 +375,12 @@ public function individual($url){
362375
}
363376
$data['groups_rose'] = $this->jobs_model->get_groups_rose();
364377
if ($data['groups_rose']) {
378+
foreach ($data['groups_rose'] as &$group) {
379+
$group['couleurCard'] = $this->groupes_model->get_groupe_color_card([
380+
'uid' => $group['organeRef']
381+
]);
382+
}
383+
unset($group);
365384
$data['rose_first'] = $data['groups_rose'][0];
366385
$data['rose_first']['couleurAssociee'] = $this->groupes_model->get_groupe_color(array($data['rose_first']['libelleAbrev'], $data['rose_first']['couleurAssociee']));
367386
$groups = $this->jobs_model->get_groups_representativite();

application/models/Stats_model.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,13 +98,14 @@ public function get_mps_loyalty($legislature) : array
9898
$sql = 'SELECT
9999
RANK() OVER (ORDER BY cl.score DESC, cl.votesN DESC) AS "rank",
100100
cl.mpId,
101-
ROUND(cl.score * 100) AS score,
101+
cl.legislature,
102+
ROUND(cl.score * 100) AS score,
102103
cl.votesN,
103104
da.civ,
104105
da.nameLast,
105106
da.nameFirst,
106107
da.nameUrl,
107-
da.legislature,
108+
da.legislature AS legislature_last,
108109
da.img,
109110
da.libelle AS libelle,
110111
da.libelleAbrev AS libelleAbrev,
@@ -195,7 +196,8 @@ public function get_mps_participation() : array
195196
da.couleurAssociee,
196197
da.img,
197198
da.departementNom,
198-
da.departementCode,
199+
da.departementCode,
200+
CONCAT(da.departementNom, " (", da.departementCode, ")") AS cardCenter,
199201
da.legislature AS legislature_last
200202
FROM class_participation cp
201203
LEFT JOIN deputes_last da

0 commit comments

Comments
 (0)