◆ _getBestPass()
static DBUpdateTestResultCalculator::_getBestPass |
( |
|
$active_id | ) |
|
|
staticprivate |
Definition at line 319 of file class.DBUpdateTestResultCalculator.php.
References $ilDB, $result, $row, and array.
324 "SELECT * FROM tst_pass_result WHERE active_fi = %s",
332 if (
$row[
"maxpoints"] > 0) {
333 $factor =
$row[
"points"] /
$row[
"maxpoints"];
338 if ($factor > $bestfactor) {
340 $bestfactor = $factor;
343 if (is_array($bestrow)) {
344 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 118 of file class.DBUpdateTestResultCalculator.php.
References $ilDB, $pass, $res, $row, and array.
122 switch ($questionSetType) {
123 case self::QUESTION_SET_TYPE_DYNAMIC:
125 $res = $ilDB->queryF(
127 SELECT COUNT(qpl_questions.question_id) qcount, 128 SUM(qpl_questions.points) qsum 131 ON tst_tests.test_id = tst_active.test_fi 132 INNER JOIN tst_dyn_quest_set_cfg 133 ON tst_dyn_quest_set_cfg.test_fi = tst_tests.test_id 134 INNER JOIN qpl_questions 135 ON qpl_questions.obj_fi = tst_dyn_quest_set_cfg.source_qpl_fi 136 AND qpl_questions.original_id IS NULL 137 AND qpl_questions.complete = %s 138 WHERE tst_active.active_id = %s 140 array(
'integer',
'integer'),
146 case self::QUESTION_SET_TYPE_RANDOM:
148 $res = $ilDB->queryF(
150 SELECT tst_test_rnd_qst.pass, 151 COUNT(tst_test_rnd_qst.question_fi) qcount, 152 SUM(qpl_questions.points) qsum 154 FROM tst_test_rnd_qst, 157 WHERE tst_test_rnd_qst.question_fi = qpl_questions.question_id 158 AND tst_test_rnd_qst.active_fi = %s 161 GROUP BY tst_test_rnd_qst.active_fi, 162 tst_test_rnd_qst.pass 164 array(
'integer',
'integer'),
170 case self::QUESTION_SET_TYPE_FIXED:
172 $res = $ilDB->queryF(
174 SELECT COUNT(tst_test_question.question_fi) qcount, 175 SUM(qpl_questions.points) qsum 177 FROM tst_test_question, 181 WHERE tst_test_question.question_fi = qpl_questions.question_id 182 AND tst_test_question.test_fi = tst_active.test_fi 183 AND tst_active.active_id = %s 185 GROUP BY tst_test_question.test_fi 195 throw new ilTestException(
"not supported question set type: $questionSetType");
200 if (is_array(
$row)) {
201 return array(
"count" =>
$row[
"qcount"],
"points" =>
$row[
"qsum"]);
204 return array(
"count" => 0,
"points" => 0);
Base Exception for all Exceptions relating to Modules/Test.
foreach($_POST as $key=> $value) $res
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 207 of file class.DBUpdateTestResultCalculator.php.
References $ilDB, $pass, $result, $row, $time, and array.
212 "SELECT * FROM tst_times WHERE active_fi = %s AND pass = %s ORDER BY started",
213 array(
'integer',
'integer'),
218 preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/",
$row[
"started"], $matches);
219 $epoch_1 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
220 preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/",
$row[
"finished"], $matches);
221 $epoch_2 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
222 $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.* 263 array(
'integer',
'integer'),
269 $max =
$row[
'maxpoints'];
270 $reached =
$row[
'points'];
272 $obligationsAnswered = (int)
$row[
'obligations_answered'];
274 $percentage = (!$max) ? 0 : ($reached / $max) * 100.0;
276 $mark = self::_getMatchingMarkFromActiveId($active_id, $percentage);
278 $isPassed = ($mark[
"passed"] ? 1 : 0);
279 $isFailed = (!$mark[
"passed"] ? 1 : 0);
282 DELETE FROM tst_result_cache 286 $affectedRows = $ilDB->manipulateF(
292 $ilDB->insert(
'tst_result_cache',
array(
293 'active_fi'=>
array(
'integer', $active_id),
295 'max_points'=>
array(
'float', strlen($max) ? $max : 0),
296 'reached_points'=>
array(
'float', strlen($reached) ? $reached : 0),
297 'mark_short'=>
array(
'text', strlen($mark[
"short_name"]) ? $mark[
"short_name"] :
" "),
298 'mark_official'=>
array(
'text', strlen($mark[
"official_name"]) ? $mark[
"official_name"] :
" "),
299 'passed'=>
array(
'integer', $isPassed),
300 'failed'=>
array(
'integer', $isFailed),
302 'hint_count'=>
array(
'integer',
$row[
'hint_count']),
303 'hint_points'=>
array(
'float',
$row[
'hint_points']),
304 '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 227 of file class.DBUpdateTestResultCalculator.php.
References $ilDB, $ilSetting, $pass, and array.
234 $exam_id_query =
'SELECT exam_id FROM tst_pass_result WHERE active_fi = %s AND pass = %s';
235 $exam_id_result = $ilDB->queryF($exam_id_query,
array(
'integer',
'integer' ),
array( $active_id,
$pass ));
236 if ($ilDB->numRows($exam_id_result) == 1) {
237 $exam_id_row = $ilDB->fetchAssoc($exam_id_result);
239 if ($exam_id_row[
'exam_id'] != null) {
240 return $exam_id_row[
'exam_id'];
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: