Index: /trunk/admin/rating.php
===================================================================
--- /trunk/admin/rating.php	(revision 26899)
+++ /trunk/admin/rating.php	(revision 26900)
@@ -76,23 +76,4 @@
     $page['user_filter'] = ' AND r.user_id = '.$conf['guest_id'];
   }
-}
-
-if (isset($_GET['del']))
-{
-  include_once(PHPWG_ROOT_PATH.'include/functions_rate.inc.php');
-  $del_params = urldecode( $_GET['del'] );
-  parse_str($del_params, $vars);
-  if ( !is_numeric($vars['e']) or !is_numeric($vars['u']) )
-  {
-    die('Hacking attempt');
-  }
-  $query = '
-DELETE FROM '. RATE_TABLE .'
-WHERE element_id=' . $vars['e'] . '
-AND user_id=' . $vars['u'] . '
-AND anonymous_id=\'' . $vars['a'] . '\'
-;';
-  pwg_query($query);
-  update_rating_score( $vars['e'] );
 }
 
Index: /trunk/admin/rating_user.php
===================================================================
--- /trunk/admin/rating_user.php	(revision 26899)
+++ /trunk/admin/rating_user.php	(revision 26900)
@@ -36,4 +36,10 @@
 }
 
+$consensus_top_number = $conf['top_number'];
+if (isset($_GET['consensus_top_number']))
+{
+  $consensus_top_number = (int)$_GET['consensus_top_number'];
+}
+
 // build users
 global $conf;
@@ -61,5 +67,5 @@
 }
 
-
+// by user aggregation
 $image_ids = array();
 $by_user_ratings = array();
@@ -88,4 +94,5 @@
     $rating['uid'] = (int)$row['user_id'];
     $rating['aid'] = $usr['anon'] ? $row['anonymous_id'] : '';
+    $rating['last_date'] = $row['date'];
   }
   $rating['rates'][$row['rate']][] = array(
@@ -114,4 +121,5 @@
 }
 
+//all image averages
 $query='SELECT element_id,
     AVG(rate) AS avg
@@ -125,7 +133,14 @@
 }
 
+$query='SELECT id
+  FROM '.IMAGES_TABLE.'
+  ORDER by rating_score DESC
+  LIMIT '.$consensus_top_number;
+$best_rated = array_flip( array_from_query($query, 'id'));
+
+// by user stats
 foreach($by_user_ratings as $id => &$rating)
 {
-  $c=0; $s=0; $ss=0; $consensus_dev=0;
+  $c=0; $s=0; $ss=0; $consensus_dev=0; $consensus_dev_top=0; $consensus_dev_top_count=0;
   foreach($rating['rates'] as $rate => $rates)
   {
@@ -136,9 +151,17 @@
     foreach($rates as $id_date)
     {
-      $consensus_dev += abs($rate - $all_img_sum[$id_date['id']]['avg']);
+      $dev = abs($rate - $all_img_sum[$id_date['id']]['avg']);
+      $consensus_dev += $dev;
+      if (isset($best_rated[$id_date['id']]))
+      {
+        $consensus_dev_top += $dev;
+        $consensus_dev_top_count++;
+      }
     }
   }
 
   $consensus_dev /= $c;
+  if ($consensus_dev_top_count)
+    $consensus_dev_top /= $consensus_dev_top_count;
 
   $var = ($ss - $s*$s/$c)/$c;
@@ -148,5 +171,6 @@
     'avg' => $s/$c,
     'cv'  => $s==0 ? -1 : sqrt($var)/($s/$c), // http://en.wikipedia.org/wiki/Coefficient_of_variation
-    'cd'  => $consensus_dev
+    'cd'  => $consensus_dev,
+    'cdtop'  => $consensus_dev_top_count ? $consensus_dev_top : ''
   );
 }
@@ -214,4 +238,5 @@
   'F_ACTION' => get_root_url().'admin.php',
   'F_MIN_RATES' => $filter_min_rates,
+  'CONSENSUS_TOP_NUMBER' => $consensus_top_number,
   'available_rates' => $conf['rate_items'],
   'ratings' => $by_user_ratings,
Index: /trunk/admin/themes/default/template/rating_user.tpl
===================================================================
--- /trunk/admin/themes/default/template/rating_user.tpl	(revision 26899)
+++ /trunk/admin/themes/default/template/rating_user.tpl	(revision 26900)
@@ -31,4 +31,9 @@
 	<input type="text" size="5" name="f_min_rates" value="{$F_MIN_RATES}">
 	</label>
+	<label>{'Consensus deviation'|@translate}
+	<input type="text" size="5" name="consensus_top_number" value="{$CONSENSUS_TOP_NUMBER}">
+	{'Best rated'|@translate}
+	</label>
+
 	<input type="submit" value="{'Submit'|@translate}">
 	</label>
@@ -44,6 +49,10 @@
 	aaSorting: [[4,'desc']],
 	aoColumnDefs: [
+		/*{
+			aTargets: ["dtc_user"]
+		},*/
 		{
-			aTargets: ["dtc_user"],
+			aTargets: ["dtc_date"],
+			asSorting: ["desc","asc"]
 		},
 		{
@@ -93,8 +102,10 @@
 <tr class="throw">
 	<td class="dtc_user">{'Username'|@translate}</td>
+	<td class="dtc_date">{'Last'|@translate}</td>
 	<td class="dtc_stat">{'Number of rates'|@translate}</td>
 	<td class="dtc_stat">{'Average rate'|@translate}</td>
 	<td class="dtc_stat">{'Variation'|@translate}</td>
 	<td class="dtc_stat">{'Consensus deviation'|@translate|@replace:' ':'<br>'}</td>
+	<td class="dtc_stat">{'Consensus deviation'|@translate|@replace:' ':'<br>'} {$CONSENSUS_TOP_NUMBER}</td>
 {foreach from=$available_rates item=rate}
 	<td class="dtc_rate">{$rate}</td>
@@ -106,8 +117,10 @@
 <tr>
 	<td>{$user}</td>
+	<td>{$rating.last_date}</td>
 	<td>{$rating.count}</td>
 	<td>{$rating.avg|@number_format:2}</td>
 	<td>{$rating.cv|@number_format:3}</td>
 	<td>{$rating.cd|@number_format:3}</td>
+	<td>{if !empty($rating.cdtop)}{$rating.cdtop|@number_format:3}{/if}</td>
 	{foreach from=$rating.rates item=rates key=rate}
 	<td>{if !empty($rates)}
