diff --git a/uVote/api/votes/votes.php b/uVote/api/votes/votes.php index 2ace03d..78687b1 100644 --- a/uVote/api/votes/votes.php +++ b/uVote/api/votes/votes.php @@ -75,7 +75,9 @@ class votes { public static function get_user_per_party_overall($user_ID){ return \DBD\UVOTE_DATA_USER_PER_PARTY_OVERALL::QA(array($user_ID)); } - + public static function get_user_to_bt_overall($user_ID){ + return \DBD\UVOTE_DATA_USER_TO_BT::QA(array($user_ID)); + } public static function get_voteinfo($poll_ID){ $con = new \SYSTEM\DB\Connection(new \DBD\uVote()); diff --git a/uVote/dbd/qq/UVOTE_DATA_USER_TO_BT.php b/uVote/dbd/qq/UVOTE_DATA_USER_TO_BT.php new file mode 100644 index 0000000..3cb98da --- /dev/null +++ b/uVote/dbd/qq/UVOTE_DATA_USER_TO_BT.php @@ -0,0 +1,15 @@ + -
-
+

uVote BETA Feedback


diff --git a/uVote/page/user_main_uVote/user_main_uVote.php b/uVote/page/user_main_uVote/user_main_uVote.php index 467b3a4..79f5ea6 100644 --- a/uVote/page/user_main_uVote/user_main_uVote.php +++ b/uVote/page/user_main_uVote/user_main_uVote.php @@ -1,5 +1,6 @@ + + + + ${class_MATCH} + ${class_MISSMATCH} + ${match_percentage} + \ 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 0aacf33..696de84 100644 --- a/uVote/page/user_main_urVote/urVote.tpl +++ b/uVote/page/user_main_urVote/urVote.tpl @@ -9,5 +9,9 @@
${urVote_user_party_compare}
${choices_user_ID} + + + ${choices_bt_to_user} + \ No newline at end of file diff --git a/uVote/page/user_main_urVote/urvoteparties.tpl b/uVote/page/user_main_urVote/urvoteparties.tpl index 86df87a..f1f3b77 100644 --- a/uVote/page/user_main_urVote/urvoteparties.tpl +++ b/uVote/page/user_main_urVote/urvoteparties.tpl @@ -3,5 +3,6 @@ ${class_MATCH} - ${class_MISSMATCH} + ${class_MISSMATCH} + ${match_percentage}% \ 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 018abcc..f65bacd 100644 --- a/uVote/page/user_main_urVote/user_main_urVote.php +++ b/uVote/page/user_main_urVote/user_main_urVote.php @@ -1,6 +1,25 @@ prepare( 'bt_to_user', + 'SELECT sum(case when uvote_data.choice = uvote_votes.bt_choice then 1 else 0 end) class_MATCH, + sum(case when uvote_data.choice != uvote_votes.bt_choice then 1 else 0 end) class_MISSMATCH + FROM uvote_data LEFT JOIN uvote_votes + ON uvote_data.poll_ID = uvote_votes.ID + WHERE user_ID = ?;', + array(\SYSTEM\SECURITY\Security::getUser()->id)); + while($row = $res->next()){ + $row['match_percentage'] = round($row['class_MATCH']/($row['class_MATCH']+$row['class_MISSMATCH'])*100,2); + $result .= \SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main_urVote/bt_to_user_overall.tpl'), $row);; + } + return $result; + } + private function user_per_party_overall(){ //$vars = votes::get_user_per_party_overall(array(\SYSTEM\SECURITY\Security::getUser()->id)); $result = ''; @@ -12,7 +31,8 @@ class user_main_urVote extends SYSTEM\PAGE\Page { 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()){ + while($row = $res->next()){ + $row['match_percentage'] = round($row['class_MATCH']/($row['class_MATCH']+$row['class_MISSMATCH'])*100,2); $result .= \SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main_urVote/urvoteparties.tpl'), $row);; } return $result; @@ -21,6 +41,7 @@ class user_main_urVote extends SYSTEM\PAGE\Page { public function html(){ $vars = array(); $vars['choices_user_ID'] = $this->user_per_party_overall(); + $vars['choices_bt_to_user'] = $this->user_to_bt(); $vars['frontend_logos'] = \SYSTEM\CONFIG\config::get(\SYSTEM\CONFIG\config_ids::SYS_CONFIG_PATH_BASEURL).'api.php?call=img&cat=frontend_logos&id='; $vars = array_merge($vars, \SYSTEM\locale::getStrings(DBD\locale_string::VALUE_CATEGORY_MAINPAGE)); $vars = array_merge($vars, \SYSTEM\locale::getStrings(150));