Permalink
Browse files

votes should have 0 votes and be in order of card creation for top()

  • Loading branch information...
1 parent ddfb18c commit ff83e2479f19d93460bc10d67272f67d4a2e80d4 Willem Van der Merwe committed Feb 27, 2012
Showing with 13 additions and 13 deletions.
  1. +11 −11 includes/functions.php
  2. +2 −2 index.php
View
@@ -159,17 +159,17 @@ function get($key) {
}
}
-function top_or_random($count, $votes, $cards) {
- //gets top from votes
- $top_or_random = top($count,$votes);
- //if not enough, keeps ending latest card id until enough or no more cards
- while(count($top_or_random) < $count && count($cards)) {
- $latest = array_pop($cards);
- $top_or_random[] = $latest->id;
- }
- //returns array of ids
- return($top_or_random);
-}
+//function top_or_random($count, $votes, $cards) {
+// //gets top from votes
+// $top_or_random = top($count,$votes);
+// //if not enough, keeps ending latest card id until enough or no more cards
+// while(count($top_or_random) < $count && count($cards)) {
+// $latest = array_pop($cards);
+// $top_or_random[] = $latest->id;
+// }
+// //returns array of ids
+// return($top_or_random);
+//}
function top($count, $votes) {
$ids = array();
View
@@ -180,7 +180,7 @@
$data['event'] = $event;
$data['event_cards'] = $event_cards;
$data['votes'] = $votes;
- $data['top50'] = top_or_random(50, $votes, $event_cards);
+ $data['top50'] = top(50, $votes);
$data['steep'] = $steep;
}
view('vote',$data);
@@ -211,7 +211,7 @@
}
$event_cards = callAPI("card", array('event_id'=>$event_id), 'obj');
$votes = callAPI("vote", array('event_id'=>$event_id), 'obj');
- $data['top50'] = top_or_random(50, $votes, $event_cards);
+ $data['top50'] = top(50, $votes);
$data['event'] = $event;
$data['event_cards'] = $event_cards;
$data['votes'] = $votes;

0 comments on commit ff83e24

Please sign in to comment.