◆ _getBestPass()
static DBUpdateTestResultCalculator::_getBestPass |
( |
|
$active_id | ) |
|
|
staticprivate |
Definition at line 318 of file class.DBUpdateTestResultCalculator.php.
References $ilDB, $result, $row, and array.
322 $result = $ilDB->queryF(
"SELECT * FROM tst_pass_result WHERE active_fi = %s",
332 if(
$row[
"maxpoints"] > 0)
334 $factor =
$row[
"points"] /
$row[
"maxpoints"];
341 if($factor > $bestfactor)
344 $bestfactor = $factor;
347 if (is_array($bestrow))
349 return $bestrow[
"pass"];
Create styles array
The data for the language used.
◆ _getMaxPass()
static DBUpdateTestResultCalculator::_getMaxPass |
( |
|
$active_id | ) |
|
|
staticprivate |
◆ _getQuestionCountAndPointsForPassOfParticipant()
static DBUpdateTestResultCalculator::_getQuestionCountAndPointsForPassOfParticipant |
( |
|
$active_id, |
|
|
|
$pass, |
|
|
|
$questionSetType |
|
) |
| |
|
staticprivate |
Definition at line 117 of file class.DBUpdateTestResultCalculator.php.
References $ilDB, $pass, $res, $row, and array.
121 switch( $questionSetType )
123 case self::QUESTION_SET_TYPE_DYNAMIC:
125 $res = $ilDB->queryF(
" 126 SELECT COUNT(qpl_questions.question_id) qcount, 127 SUM(qpl_questions.points) qsum 130 ON tst_tests.test_id = tst_active.test_fi 131 INNER JOIN tst_dyn_quest_set_cfg 132 ON tst_dyn_quest_set_cfg.test_fi = tst_tests.test_id 133 INNER JOIN qpl_questions 134 ON qpl_questions.obj_fi = tst_dyn_quest_set_cfg.source_qpl_fi 135 AND qpl_questions.original_id IS NULL 136 AND qpl_questions.complete = %s 137 WHERE tst_active.active_id = %s 139 array(
'integer',
'integer'),
145 case self::QUESTION_SET_TYPE_RANDOM:
147 $res = $ilDB->queryF(
" 148 SELECT tst_test_rnd_qst.pass, 149 COUNT(tst_test_rnd_qst.question_fi) qcount, 150 SUM(qpl_questions.points) qsum 152 FROM tst_test_rnd_qst, 155 WHERE tst_test_rnd_qst.question_fi = qpl_questions.question_id 156 AND tst_test_rnd_qst.active_fi = %s 159 GROUP BY tst_test_rnd_qst.active_fi, 160 tst_test_rnd_qst.pass 162 array(
'integer',
'integer'),
168 case self::QUESTION_SET_TYPE_FIXED:
170 $res = $ilDB->queryF(
" 171 SELECT COUNT(tst_test_question.question_fi) qcount, 172 SUM(qpl_questions.points) qsum 174 FROM tst_test_question, 178 WHERE tst_test_question.question_fi = qpl_questions.question_id 179 AND tst_test_question.test_fi = tst_active.test_fi 180 AND tst_active.active_id = %s 182 GROUP BY tst_test_question.test_fi 192 throw new ilTestException(
"not supported question set type: $questionSetType");
199 return array(
"count" =>
$row[
"qcount"],
"points" =>
$row[
"qsum"]);
202 return array(
"count" => 0,
"points" => 0);
Base Exception for all Exceptions relating to Modules/Test.
Create styles array
The data for the language used.
◆ _getResultPass()
static DBUpdateTestResultCalculator::_getResultPass |
( |
|
$active_id, |
|
|
|
$passScoring |
|
) |
| |
|
staticprivate |
◆ _getWorkingTimeOfParticipantForPass()
static DBUpdateTestResultCalculator::_getWorkingTimeOfParticipantForPass |
( |
|
$active_id, |
|
|
|
$pass |
|
) |
| |
|
staticprivate |
Definition at line 205 of file class.DBUpdateTestResultCalculator.php.
References $ilDB, $pass, $result, $row, and array.
209 $result = $ilDB->queryF(
"SELECT * FROM tst_times WHERE active_fi = %s AND pass = %s ORDER BY started",
210 array(
'integer',
'integer'),
216 preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/",
$row[
"started"], $matches);
217 $epoch_1 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
218 preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/",
$row[
"finished"], $matches);
219 $epoch_2 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
220 $time += ($epoch_2 - $epoch_1);
Create styles array
The data for the language used.
◆ _updateTestResultCache()
static DBUpdateTestResultCalculator::_updateTestResultCache |
( |
|
$active_id, |
|
|
|
$passScoring |
|
) |
| |
|
static |
Definition at line 248 of file class.DBUpdateTestResultCalculator.php.
References $ilDB, $pass, $query, $result, $row, array, and time.
252 $pass = self::_getResultPass($active_id, $passScoring);
255 SELECT tst_pass_result.* 267 $max =
$row[
'maxpoints'];
268 $reached =
$row[
'points'];
270 $obligationsAnswered = (int)
$row[
'obligations_answered'];
272 $percentage = (!$max) ? 0 : ($reached / $max) * 100.0;
274 $mark = self::_getMatchingMarkFromActiveId($active_id, $percentage);
276 $isPassed = ( $mark[
"passed"] ? 1 : 0 );
277 $isFailed = ( !$mark[
"passed"] ? 1 : 0 );
280 DELETE FROM tst_result_cache 284 $affectedRows = $ilDB->manipulateF(
288 $ilDB->insert(
'tst_result_cache',
array(
289 'active_fi'=>
array(
'integer', $active_id),
291 'max_points'=>
array(
'float', strlen($max) ? $max : 0),
292 'reached_points'=>
array(
'float', strlen($reached) ? $reached : 0),
293 'mark_short'=>
array(
'text', strlen($mark[
"short_name"]) ? $mark[
"short_name"] :
" "),
294 'mark_official'=>
array(
'text', strlen($mark[
"official_name"]) ? $mark[
"official_name"] :
" "),
295 'passed'=>
array(
'integer', $isPassed),
296 'failed'=>
array(
'integer', $isFailed),
298 'hint_count'=>
array(
'integer',
$row[
'hint_count']),
299 'hint_points'=>
array(
'float',
$row[
'hint_points']),
300 'obligations_answered' =>
array(
'integer', $obligationsAnswered)
Create styles array
The data for the language used.
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
◆ getExamId()
static DBUpdateTestResultCalculator::getExamId |
( |
|
$active_id, |
|
|
|
$pass, |
|
|
|
$obj_id |
|
) |
| |
|
staticprivate |
Move this to a proper place.
Definition at line 225 of file class.DBUpdateTestResultCalculator.php.
References $ilDB, $ilSetting, $pass, and array.
232 $exam_id_query =
'SELECT exam_id FROM tst_pass_result WHERE active_fi = %s AND pass = %s';
233 $exam_id_result = $ilDB->queryF( $exam_id_query,
array(
'integer',
'integer' ),
array( $active_id,
$pass ) );
234 if ($ilDB->numRows( $exam_id_result ) == 1)
236 $exam_id_row = $ilDB->fetchAssoc( $exam_id_result );
238 if ($exam_id_row[
'exam_id'] != null)
240 return $exam_id_row[
'exam_id'];
244 $inst_id =
$ilSetting->get(
'inst_id', null );
245 return 'I' . $inst_id .
'_T' . $obj_id .
'_A' . $active_id .
'_P' .
$pass;
Create styles array
The data for the language used.
◆ QUESTION_SET_TYPE_DYNAMIC
const DBUpdateTestResultCalculator::QUESTION_SET_TYPE_DYNAMIC = 'DYNAMIC_QUEST_SET' |
◆ QUESTION_SET_TYPE_FIXED
const DBUpdateTestResultCalculator::QUESTION_SET_TYPE_FIXED = 'FIXED_QUEST_SET' |
◆ QUESTION_SET_TYPE_RANDOM
const DBUpdateTestResultCalculator::QUESTION_SET_TYPE_RANDOM = 'RANDOM_QUEST_SET' |
The documentation for this class was generated from the following file: