Пример #1
0
 /**
  * Имплементация метода выдачи очков пользователям за найденные решения
  */
 private function doGivePoints(GivePointsContext $ctxt)
 {
     $tillNum = min(ChessKnightBean::inst()->getUserSolvedCnt($ctxt->getUserId()), self::MAX_TASKS);
     for ($index = 1; $index <= $tillNum; $index++) {
         $ctxt->givePoints(self::POINTS_PER_TASK, $index);
     }
 }
Пример #2
0
 private function tryGivePoints(GivePointsContext $ctxt, $testingId)
 {
     if ($ctxt->hasPoints($testingId)) {
         return;
         //---
     }
     $testResult = TestingBean::inst()->getTestingResult($testingId, $ctxt->getUserId());
     if ($testResult && $testResult->getPercent() >= self::PASS_THRESHOLD_PCNT) {
         $ctxt->givePoints(5, $testingId);
     }
 }