Changeset 1120 for trunk/common


Ignore:
Timestamp:
03/26/10 00:37:03 (2 years ago)
Author:
wefgef
Message:

Replaced ia_score, it can now be removed

  • Task search shows difficulty for the tasks
  • Task search uses ia_score_user_round_task instead of ia_score
  • Task delete deletes entries from the rigth db tables

REVIEW URL: http://reviewboard.infoarena.ro/r/145/

Location:
trunk/common/db
Files:
2 edited

Legend:

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

    r1119 r1120  
    535535    db_query($query); 
    536536 
    537     // Delete entries from ia_score 
    538     $query = sprintf("DELETE FROM `ia_score` 
     537    // Delete entries from ia_score_user_round 
     538    $query = sprintf("DELETE FROM `ia_score_user_round` 
     539                      WHERE `round_id` = %s", 
     540                      db_quote($round_id)); 
     541    db_query($query); 
     542 
     543    // Delete entries from ia_score_user_round_task 
     544    $query = sprintf("DELETE FROM `ia_score_user_round_task` 
     545                      WHERE `round_id` = %s", 
     546                      db_quote($round_id)); 
     547    db_query($query); 
     548 
     549    // Delete entries from ia_rating 
     550    $query = sprintf("DELETE FROM `ia_rating` 
    539551                      WHERE `round_id` = %s", 
    540552                      db_quote($round_id)); 
  • trunk/common/db/task.php

    r1110 r1120  
    218218        $score_fields = ""; 
    219219    } else { 
    220         $join_score = "LEFT JOIN ia_score ON ia_score.user_id = ".db_quote($user_id)." AND 
    221                             ia_score.round_id = round.id AND 
    222                             ia_score.task_id = ia_task.id AND 
    223                             ia_score.name = 'score'"; 
    224         $score_fields = "ia_score.score,"; 
     220        $join_score = "LEFT JOIN ia_score_user_round_task AS score ON 
     221                            score.`user_id` = ".db_quote($user_id)." AND 
     222                            score.`round_id` = round_task.`round_id` AND 
     223                            score.`task_id` = round_task.`task_id`"; 
     224        $score_fields = "score.`score` AS `score`,"; 
    225225    } 
    226226 
     
    231231                ia_task.open_source AS open_source, 
    232232                ia_task.open_tests AS open_tests, 
     233                ia_task.rating AS rating, 
    233234                round.id AS round_id, 
    234235                $score_fields 
     
    241242        AND ia_task.hidden = '0' $tag_filter 
    242243    ORDER BY round.id DESC, ia_task.order"; 
     244 
    243245    $tasks = db_fetch_all($query); 
    244246 
Note: See TracChangeset for help on using the changeset viewer.