}
 //echo $task->id . ': teacherweight-' . $teacherweight . ' selfweight-' .$selfweight . ' peerweight-' .$peerweight.'<br/>';
 foreach ($users as $user) {
     //It obtains assignments for each task and user
     $params2 = array('taskid' => $task->id, 'studentid' => $user->id);
 /**
  * Factory method - uses the parameters to retrieve matching instance from the DB.
  * @static final protected
  * @return mixed object instance or false if not found
  */
 protected static function fetch_helper($table, $classname, $params)
 {
     if ($instances = evalcomix_object::fetch_all_helper($table, $classname, $params)) {
         if (count($instances) > 1) {
             // we should not tolerate any errors here - problems might appear later
             print_error('morethanonerecordinfetch', 'debug');
         }
         return reset($instances);
     } else {
         return false;
     }
 }