Browse Source

Merge branch 'testing' into develop

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

26
application/controllers/Dashboard.php

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

11
application/views/user_lijsten.php

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

Loading…
Cancel
Save