statistics

This commit is contained in:
Nael 2014-03-04 00:45:19 +01:00
parent 40e34ce9b8
commit 1b42a206e6
9 changed files with 25 additions and 18 deletions

View File

@ -9,5 +9,6 @@ class UVOTE_DATA_TEMP_VOTES extends \SYSTEM\DB\QP {
//mys
'SELECT SUM(CASE WHEN uvote_data.user_ID = ? THEN 1 ELSE 0 END) as voted,
SUM(CASE WHEN uvote_data.user_ID = ? THEN 0 ELSE 1 END) AS not_voted
FROM uvote_data RIGHT JOIN uvote_votes ON ( uvote_data.poll_ID = uvote_votes.ID AND uvote_data.user_ID = ?);'
FROM uvote_data RIGHT JOIN uvote_votes ON ( uvote_data.poll_ID = uvote_votes.ID AND uvote_data.user_ID = ?)
WHERE time_end > NOW();'
);}}

View File

@ -6,7 +6,7 @@
${voice_weight}
</div>
<div>
<h4>Ergebnis Bundestag</h4>
${bars_bt}
</div>
<div>
@ -14,7 +14,7 @@
</div>
</div>
<img src="${frontend_logos}logo2.png" style="margin-left: 40px;" width="35%"/>
<img src="${frontend_logos}logo2.png" style="" width="35%"/>
<div style="float: left;">
${vote_buttons}

View File

@ -40,7 +40,7 @@ class default_bulletin extends SYSTEM\PAGE\Page {
private function voice_weight(){
$vars = votes::get_count_user_votes_per_poll($this->poll_ID);
$vars['voteweight'] = 1/$vars['count']*100;
$vars['voteweight'] = round(1/$vars['count']*100);
return SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'default_bulletin/voteweight.tpl'), $vars);
}
@ -113,7 +113,8 @@ class default_bulletin extends SYSTEM\PAGE\Page {
$user_vote = votes::getUserPollData($this->poll_ID);
$vars = array();
$vars['bars_party'] = $vars['bars_user'] = $vars['bars_bt'] = $vars['voice_weight'] = 'Vote to see results!';
$vars['voice_weight'] = $vars['bars_user'] = $vars['bars_bt'] = '';
$vars['bars_party'] = 'Erst nach der Abgabe deiner Stimme werden dir die daten angezeigt';
$vars['js'] = $this->js();
$vars['css'] = $this->css();

View File

@ -1,4 +1,5 @@
<div style="">
<div style="">
<h4>Ergebnis Bundestag</h4>
<div class="progress" style="height: 20px;">
<div class="bar bar-success" style="width: ${bt_pro}%;">${bt_pro}%</div>
<div class="bar bar-danger" style="width: ${bt_con}%;">${bt_con}%</div>

View File

@ -93,7 +93,7 @@ class default_page extends SYSTEM\PAGE\Page {
foreach($uvote as $v){
$vote['uv'] .= \SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'default_page/vote_uv.tpl'),
array( 'badge' => self::badge_class($v['choice']),
'perc' => $v['count'] > 0 ? $v['count']/$vote_count['count']*100 : 0));
'perc' => $v['count'] > 0 ? round($v['count']/$vote_count['count']*100, 2) : 0));
}
}

View File

@ -11,10 +11,15 @@
<img src="${frontend_logos}icon_bt.png" width="80"/>
${bt}
</td>
<td class="${uv_vote_class}" style="width: 50px; height: 100%; border-left: 1px solid lightgray;">
<img src="${frontend_logos}icon_urn.png" width="25"/><br/>
<td class="${uv_vote_class}" style="width: 60px; height: 100%; border-left: 1px solid lightgray;">
<img src="${frontend_logos}icon_urn.png" width="20"/>
<span style="float: right"><font size="2">uVote</font></span>
<br/>
${uv}
<span class="badge badge-info" style="">${uv_count}</span>
<br>
<br>
<br>
</td>
<td style="margin: 0; padding: 0; width: 3px;" >
<table class="poll_time" time="${time_end}" style="width: 100%; height: 100%; margin: 0; padding: 0;">

View File

@ -1 +1 @@
<span class="badge ${badge}" style="">${perc}%</span><br/>
<span class="badge ${badge}" style="">${perc}%</span>

View File

@ -1,9 +1,8 @@
<h5>Deine Abstimmungsquote</h5>
<div style="">
<div style="float: left">Abgestimmt/</div>
<div style="margin-left: 90px;">Offen</div>
<h5>Aktueller Status</h5>
<div style="width: 100%;">
<font size="2">Teilnahme an aktuellen Abstimmungen</font>
<div class="progress" style="height: 20px;">
<div class="bar bar-success" style="width: ${vote_perc}%;">${voted}</div>
<div class="bar bar-info" style="width: ${no_vote_perc}%;">${not_voted}</div>
<div class="bar" style="width: ${vote_perc}%;">${vote_perc}%</div>
<div class="bar bar-info" style="width: 100%;"></div>
</div>
</div>

View File

@ -8,8 +8,8 @@ class user_main_urVote extends SYSTEM\PAGE\Page {
$v = $vars['voted'];
$nv = $vars['not_voted'];
return \SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main_urVote/all_polls.tpl'),
array( 'vote_perc'=> round($v/($nv+$v)*100,0),
'no_vote_perc'=> round($nv/($nv+$v)*100,0),
array( 'vote_perc'=> round($v/($nv+$v)*100, 2),
'no_vote_perc'=> round($nv/($nv+$v)*100, 2),
'voted'=> $v,
'not_voted'=> $nv));
}