Changeset 1117 for trunk/common


Ignore:
Timestamp:
03/21/10 19:31:48 (2 years ago)
Author:
bogdan2412
Message:

Fix Rankings macro crash when user doesn't have permissions to view.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/common/db/score.php

    r1116 r1117  
    9797function score_get_count($user, $task, $round) { 
    9898    $where = score_build_where_clauses($user, $task, $round); 
     99    if (count($where) == 0) { 
     100        return 0; 
     101    } 
    99102    $query = sprintf("SELECT COUNT(DISTINCT user_id) AS `cnt` 
    100103            FROM ia_score_user_round 
     
    362365function score_get_rankings($rounds, $tasks, $start = 0, $count = 999999, 
    363366                            $detail_task = false, $detail_round = false) { 
    364     if (count($rounds) == 0) { 
     367    $where = score_build_where_clauses(null, null, $rounds); 
     368    if (count($where) == 0) { 
    365369        return array(); 
    366370    } 
    367     $where = score_build_where_clauses(null, null, $rounds); 
    368371 
    369372    // Get the total score for all rounds 
     
    442445        //task columns 
    443446        if ($detail_task == true) { 
    444             foreach ($tasks as $task) { 
    445                 $task_id = $task['id']; 
     447            foreach ($tasks as $task_id) { 
    446448                if (isset($task_scores[$user_id][$task_id])) { 
    447449                    $score = $task_scores[$user_id][$task_id]; 
Note: See TracChangeset for help on using the changeset viewer.