diff --git a/uVote/dbd/qq/UVOTE_DATA_USER_PER_PARTY_OVERALL.php b/uVote/dbd/qq/UVOTE_DATA_USER_PER_PARTY_OVERALL.php index e9b774f..52e499e 100644 --- a/uVote/dbd/qq/UVOTE_DATA_USER_PER_PARTY_OVERALL.php +++ b/uVote/dbd/qq/UVOTE_DATA_USER_PER_PARTY_OVERALL.php @@ -8,7 +8,7 @@ class UVOTE_DATA_USER_PER_PARTY_OVERALL extends \SYSTEM\DB\QP { '', //mys 'SELECT party, sum(case when uvote_data.choice = uvote_votes_per_party.choice then 1 else 0 end) class_MATCH, - sum(case when uvote_data.choice = uvote_votes_per_party.choice then 0 else 1 end) class_MISSMATCH + sum(case when uvote_data.choice != uvote_votes_per_party.choice then 1 else 0 end) class_MISSMATCH FROM uvote_data INNER JOIN uvote_votes_per_party ON uvote_data.poll_ID = uvote_votes_per_party.poll_ID WHERE user_ID = ? GROUP BY party;' diff --git a/uVote/page/user_main_uVote/votecountchoice.tpl b/uVote/page/user_main_uVote/votecountchoice.tpl new file mode 100644 index 0000000..b882c15 --- /dev/null +++ b/uVote/page/user_main_uVote/votecountchoice.tpl @@ -0,0 +1,4 @@ + + ${choice} + ${count} + \ No newline at end of file diff --git a/uVote/page/user_main_urVote/urVote.tpl b/uVote/page/user_main_urVote/urVote.tpl index 75707e2..41666ac 100644 --- a/uVote/page/user_main_urVote/urVote.tpl +++ b/uVote/page/user_main_urVote/urVote.tpl @@ -1,3 +1,10 @@
-${choices_user_ID} + + + + + + + ${choices_user_ID} +
PartyMatchMissmatch
\ No newline at end of file diff --git a/uVote/page/user_main_urVote/urvoteparties.tpl b/uVote/page/user_main_urVote/urvoteparties.tpl new file mode 100644 index 0000000..4e107fa --- /dev/null +++ b/uVote/page/user_main_urVote/urvoteparties.tpl @@ -0,0 +1,5 @@ + + ${party} + ${class_MATCH} + ${class_MISSMATCH} + \ No newline at end of file diff --git a/uVote/page/user_main_urVote/user_main_urVote.php b/uVote/page/user_main_urVote/user_main_urVote.php index 9e2d723..ab81183 100644 --- a/uVote/page/user_main_urVote/user_main_urVote.php +++ b/uVote/page/user_main_urVote/user_main_urVote.php @@ -2,15 +2,20 @@ class user_main_urVote extends SYSTEM\PAGE\Page { private function user_per_party_overall(){ - $vars = votes::get_user_per_party_overall(array(\SYSTEM\SECURITY\Security::getUser()->id)); - return print_r($vars, TRUE); - -// if (!$vars['bt_total']){ -// return 'no data yet';} -// $vars['bt_ent'] = round(($vars['bt_attending'] - $vars['bt_pro'] - $vars['bt_con'])/$vars['bt_total']*100,0); -// $vars['bt_pro'] = round($vars['bt_pro']/$vars['bt_total']*100,0); -// $vars['bt_con'] = round($vars['bt_con']/$vars['bt_total']*100,0); - return SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'default_bulletin/table_bt.tpl'), $vars); + //$vars = votes::get_user_per_party_overall(array(\SYSTEM\SECURITY\Security::getUser()->id)); + $result = ''; + $con = new \SYSTEM\DB\Connection(); + $res = $con->prepare( 'test', + 'SELECT party, sum(case when uvote_data.choice = uvote_votes_per_party.choice then 1 else 0 end) class_MATCH, + sum(case when uvote_data.choice != uvote_votes_per_party.choice then 1 else 0 end) class_MISSMATCH + FROM uvote_data INNER JOIN uvote_votes_per_party + ON uvote_data.poll_ID = uvote_votes_per_party.poll_ID + WHERE user_ID = ? GROUP BY party;', + array(\SYSTEM\SECURITY\Security::getUser()->id)); + while($row = $res->next()){ + $result .= \SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main_urVote/urvoteparties.tpl'), $row);; + } + return $result; } public function html(){