Browse Source

Wegingsfactoren zijn nu meegenomen en mogelijk.

master
Rogier Neeleman 8 years ago
parent
commit
ac020c1a4e
  1. 2
      application/controllers/Uitslag.php
  2. 28
      application/migrations/20160405222600_add_spelgebiedweight.php
  3. 1
      application/models/Uitslag_model.php

2
application/controllers/Uitslag.php

@ -32,7 +32,7 @@ class Uitslag extends CI_Controller @@ -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;
}

28
application/migrations/20160405222600_add_spelgebiedweight.php

@ -0,0 +1,28 @@ @@ -0,0 +1,28 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/**
* Add regio table
*/
class Migration_Add_spelgebiedweight extends CI_Migration
{
public function up()
{
$this->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');
}
}

1
application/models/Uitslag_model.php

@ -48,6 +48,7 @@ class Uitslag_model extends CI_Model @@ -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');

Loading…
Cancel
Save