Changeset 1120


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
Files:
3 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 
  • trunk/www/views/task_filter_results.php

    r1099 r1120  
    11<?php 
     2require_once(IA_ROOT_DIR . "www/macros/macro_stars.php"); 
     3 
    24include('header.php'); 
    35include('format/table.php'); 
     
    1820    } else { 
    1921        return round($val); 
     22    } 
     23} 
     24 
     25function format_rating_column($val) { 
     26    if (is_null($val)) { 
     27        return 'N/A'; 
     28    } else { 
     29        $stars_args = array( 
     30            'rating' => $val, 
     31            'scale' => 5, 
     32            'type' => 'normal' 
     33        ); 
     34        return macro_stars($stars_args); 
    2035    } 
    2136} 
     
    109124        'css_class' => 'source', 
    110125        'key' => 'round_title'); 
     126$column_infos[] = array( 
     127        'title' => 'Dificultate', 
     128        'css_class' => 'rating', 
     129        'key' => 'rating', 
     130        'valform' => 'format_rating_column'); 
    111131if (!is_null($user_id)) { 
    112132    $column_infos[] = array ( 
    113133            'title' => 'Scorul tău', 
    114             'css_class' => 'number score', 
     134            'css_class' => 'score', 
    115135            'key' => 'score', 
    116136            'valform' => 'format_score_column'); 
Note: See TracChangeset for help on using the changeset viewer.