• Модуль: learning
  • Путь к файлу: ~/bitrix/modules/learning/classes/general/testresult.php
  • Класс: CTestResult
  • Вызов: CTestResult::GetPercent
static function GetPercent($ATTEMPT_ID)
{
	global $DB;

	$strSql =
	"SELECT ROUND(SUM(CASE WHEN TR.CORRECT = 'Y' THEN Q.POINT ELSE 0 END) * 100 / SUM(Q.POINT), 4) as PCNT ".
	"FROM b_learn_test_result TR, b_learn_question Q ".
	"WHERE TR.ATTEMPT_ID = '".intval($ATTEMPT_ID)."' AND TR.QUESTION_ID = Q.ID";

	if (!$res = $DB->Query($strSql, false, "File: ".__FILE__."
Line: ".__LINE__)) return false; if (!$arStat = $res->Fetch()) return false; // Round bottom in right way, some magic due to IEEE 754 return ( (int) (floor($arStat["PCNT"] + 0.00001) + 0.00001) ); }