diff --git a/application/controllers/Uitslag.php b/application/controllers/Uitslag.php index 0fb0ea9..ddc34c3 100644 --- a/application/controllers/Uitslag.php +++ b/application/controllers/Uitslag.php @@ -32,7 +32,7 @@ class Uitslag extends CI_Controller $scores = $this->Uitslag_model->get_subgroep_punten($subgroep['id']); foreach ($scores as $score) { - $scoreitem = ($score['score']/$score['maxscore'])*100; + $scoreitem = (($score['score']/$score['maxscore'])*100)*$score['gewicht']; $data['uitslag'][$subgroep['id']][$score['spelgebiedid']] = $scoreitem; $data['uitslag'][$subgroep['id']]['total'] = $data['uitslag'][$subgroep['id']]['total'] + $scoreitem; } diff --git a/application/migrations/20160405222600_add_spelgebiedweight.php b/application/migrations/20160405222600_add_spelgebiedweight.php new file mode 100644 index 0000000..ab45489 --- /dev/null +++ b/application/migrations/20160405222600_add_spelgebiedweight.php @@ -0,0 +1,28 @@ +dbforge->add_column('spelgebied', array( + 'gewicht' => array( + 'type' => 'DECIMAL', + 'unsigned' => TRUE, + 'constraint' => '3,2', + 'after' => 'jaar', + 'default' => '1.00', + ), + )); + + } + + public function down() + { + $this->dbforge->drop_column('spelgebied', 'gewicht'); + } +} \ No newline at end of file diff --git a/application/models/Uitslag_model.php b/application/models/Uitslag_model.php index 8c19b6b..6779369 100644 --- a/application/models/Uitslag_model.php +++ b/application/models/Uitslag_model.php @@ -48,6 +48,7 @@ class Uitslag_model extends CI_Model $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, + spelgebied.gewicht AS gewicht, '); $this->db->from('resultaat');