Browse Source

data normalisation

master
Rogier Neeleman 8 years ago
parent
commit
df2b3e2d0c
  1. 5
      application/controllers/Uitslag.php
  2. 1
      application/models/Uitslag_model.php

5
application/controllers/Uitslag.php

@ -32,8 +32,9 @@ class Uitslag extends CI_Controller @@ -32,8 +32,9 @@ class Uitslag extends CI_Controller
$scores = $this->Uitslag_model->get_subgroep_punten($subgroep['id']);
foreach ($scores as $score) {
$data['uitslag'][$subgroep['id']][$score['spelgebiedid']] = $score['score'];
$data['uitslag'][$subgroep['id']]['total'] = $data['uitslag'][$subgroep['id']]['total'] + $score['score'];
$scoreitem = ($score['score']/$score['maxscore'])*100;
$data['uitslag'][$subgroep['id']][$score['spelgebiedid']] = $scoreitem;
$data['uitslag'][$subgroep['id']]['total'] = $data['uitslag'][$subgroep['id']]['total'] + $scoreitem;
}
}

1
application/models/Uitslag_model.php

@ -46,6 +46,7 @@ class Uitslag_model extends CI_Model @@ -46,6 +46,7 @@ class Uitslag_model extends CI_Model
public function get_subgroep_punten($subgroepid)
{
$this->db->select('SUM('.$this->db->dbprefix('resultaat').'.score/'.$this->db->dbprefix('lijst').'.ronde) AS score,
SUM('.$this->db->dbprefix('vragen').'.score) AS maxscore,
spelgebied.id AS spelgebiedid,
');
$this->db->from('resultaat');

Loading…
Cancel
Save