Changeset 1114
- Timestamp:
- 03/20/10 16:19:40 (2 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
-
common/db/round.php (modified) (2 diffs)
-
common/security.php (modified) (1 diff)
-
www/macros/macro_tasks.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/common/db/round.php
r1110 r1114 104 104 // 105 105 // if user_id is non-null a join is done on $score 106 function round_get_tasks($round_id, $first = 0, $count = null, $user_id = null, $fetch_scores = false, $filter = null) { 106 function round_get_tasks($round_id, $first = 0, $count = null, 107 $user_id = null, $fetch_scores = false, 108 $filter = null, $progress = false) { 107 109 if ($count === null) { 108 110 $count = 666013; … … 141 143 db_escape($first), db_escape($count)); 142 144 } 143 return db_fetch_all($query); 145 146 $res = db_fetch_all($query); 147 148 if ($progress) { 149 $task_ids = array(); 150 foreach ($res as $row) { 151 $task_ids[] = $row['id']; 152 } 153 154 $query_ratings = sprintf( 155 "SELECT task_ratings.task_id AS id, count(*) AS rating_count 156 FROM ia_task_ratings AS task_ratings 157 WHERE task_ratings.task_id IN (%s) 158 GROUP BY id", 159 implode(',', array_map('db_quote', $task_ids)) 160 ); 161 162 $res_ratings = db_fetch_all($query_ratings); 163 164 $rating_count = array(); 165 foreach ($res_ratings as $res_rating) { 166 $rating_count[$res_rating['id']] = $res_rating['rating_count']; 167 } 168 169 foreach ($res as &$row) { 170 $row['progress'] = getattr($rating_count, $row['id']); 171 } 172 } 173 174 return $res; 144 175 } 145 176 -
trunk/common/security.php
r1111 r1114 147 147 case 'task-edit-ratings': 148 148 case 'round-tag': 149 case 'round-view-progress': 149 150 case 'textblock-tag': 150 151 case 'job-reeval': -
trunk/www/macros/macro_tasks.php
r1110 r1114 13 13 } else { 14 14 return round($val); 15 } 16 } 17 18 function format_progress_column($val) { 19 if (is_null($val)) { 20 return 'N/A'; 21 } else { 22 return $val; 15 23 } 16 24 } … … 127 135 $show_sources = getattr($args, 'show_sources', true); 128 136 137 $show_progress = getattr($args, 'show_progress', false) && 138 identity_can("round-view-progress", $round); 139 129 140 // get round tasks 130 141 $tasks = round_get_tasks($round_id, … … 132 143 $options['display_entries'], 133 144 $user_id, $scores, 134 $filter );145 $filter, $show_progress); 135 146 $options['total_entries'] = round_get_task_count( 136 147 $round_id, $user_id, $filter); … … 174 185 ); 175 186 } 187 if ($show_progress) { 188 $column_infos[] = array ( 189 'title' => 'Note', 190 'css_class' => 'number', 191 'key' => 'progress', 192 'valform' => 'format_progress_column', 193 ); 194 } 176 195 177 196 return $tabs.format_table($tasks, $column_infos, $options);
Note: See TracChangeset
for help on using the changeset viewer.
![[infoarena] development](/chrome/site/logo.png)