/**
  * 
  * give user points
  * anon doesn't earn points
  */
 function _reward($criteria_id)
 {
     $user = $this->getConnectedUser();
     if ($user == $this->anonymous) {
         return;
     }
     if ($this->_wants_to_spend()) {
         return;
     }
     $repo = $this->getCurrentRepository();
     $criteria = $this->Criteria->read(null, $criteria_id);
     if (!$criteria) {
         $this->_cancel_everything('Criteria not found');
     }
     $reward = $criteria['Criteria']['challenge_reward'];
     if ($this->RepositoriesUser->addPoints($user['User']['id'], $repo['Repository']['id'], $reward)) {
         $this->Session->write('Points.status', "Congratulations! you have won {$reward} points");
     } else {
         $this->Session->write("Points.status", "An error occurred adding points. Please blame to the administrator or the developer");
         $this->Session->write("Points.proceed", false);
     }
 }