Browse Source

Merge branch 'testing' into develop

master
Rogier Neeleman 9 years ago
parent
commit
f40ae93196
  1. 30
      application/controllers/Dashboard.php
  2. 11
      application/views/user_lijsten.php

30
application/controllers/Dashboard.php

@ -35,12 +35,18 @@ class Dashboard extends CI_Controller @@ -35,12 +35,18 @@ class Dashboard extends CI_Controller
$vragen = $this->Dashboard_model->get_total_vragen();
$antwoorden = $this->Dashboard_model->get_total_gedaan();
$data['gedaan'] = round(($antwoorden/$vragen)*100);
if ($vragen == 0) {
$data['gedaan'] = 0;
} else {
$data['gedaan'] = round(($antwoorden/$vragen)*100);
}
// Per lijst
$subgroepen = $this->Dashboard_model->get_subgroepen();
$lijsten = $this->Dashboard_model->get_lijsten();
$bardata = array();
foreach ($lijsten as $lijst)
{
$beantwoord = 0;
@ -51,7 +57,11 @@ class Dashboard extends CI_Controller @@ -51,7 +57,11 @@ class Dashboard extends CI_Controller
$aantal = $this->Dashboard_model->get_antwoorden($vraag['id']);
$beantwoord = $beantwoord + $aantal;
}
$bardata[$lijst['id']]['percentage'] = (($beantwoord)/($subgroepen*count($vragen)))*100;
if (($subgroepen*count($vragen)) == 0) {
$bardata[$lijst['id']]['percentage'] = 0;
} else {
$bardata[$lijst['id']]['percentage'] = (($beantwoord)/($subgroepen*count($vragen)))*100;
}
}
$data['bardata'] = $bardata;
@ -71,9 +81,15 @@ class Dashboard extends CI_Controller @@ -71,9 +81,15 @@ class Dashboard extends CI_Controller
}
}
$data['bar']['gedaan'] = round(($barok/($barok + $barnok + $barbezig))*100);
$data['bar']['bezig'] = round(($barbezig/($barok + $barnok + $barbezig))*100);
$data['bar']['doen'] = 100-$data['bar']['gedaan']-$data['bar']['bezig'];
if (($barok + $barnok + $barbezig) == 0) {
$data['bar']['gedaan'] = 0;
$data['bar']['bezig'] = 0;
$data['bar']['doen'] = 100;
} else {
$data['bar']['gedaan'] = round(($barok/($barok + $barnok + $barbezig))*100);
$data['bar']['bezig'] = round(($barbezig/($barok + $barnok + $barbezig))*100);
$data['bar']['doen'] = 100-$data['bar']['gedaan']-$data['bar']['bezig'];
}
// Header
$this->load->view('header', $data);
@ -143,4 +159,4 @@ class Dashboard extends CI_Controller @@ -143,4 +159,4 @@ class Dashboard extends CI_Controller
$this->load->view('footer');
}
}
}

11
application/views/user_lijsten.php

@ -9,6 +9,7 @@ @@ -9,6 +9,7 @@
</div>
</div>
<?php if (isset($lijsten)) { ?>
<?php echo form_open(base_url().'beoordelen/ronde'); ?>
<p>
<div class="row">
@ -26,4 +27,14 @@ @@ -26,4 +27,14 @@
</p>
<?php echo form_close(); ?>
<?php } else { ?>
<p>
<div class="row">
<div class="text-center">
Geen openstaande lijsten beschikbaar.
</div>
</div>
</p>
<?php } ?>
</div>

Loading…
Cancel
Save