4 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionSkillAssignmentList.php';
5 require_once
'Modules/TestQuestionPool/classes/questions/LogicalAnswerCompare/ilAssLacQuestionProvider.php';
6 require_once
'Modules/TestQuestionPool/classes/questions/LogicalAnswerCompare/ilAssLacConditionParser.php';
7 require_once
'Modules/TestQuestionPool/classes/questions/LogicalAnswerCompare/ilAssLacCompositeEvaluator.php';
8 require_once
'Modules/Test/classes/class.ilTestSkillPointAccount.php';
9 require_once
'Modules/Test/classes/class.ilTestSkillLevelThresholdList.php';
10 require_once
'Services/Skill/classes/class.ilBasicSkill.php';
93 $this->skillLevelThresholdList->setTestId($testId);
95 $this->questions = array();
96 $this->maxPointsByQuestion = array();
141 $this->skillQuestionAssignmentList->setParentObjId($questionList->
getParentObjId());
142 $this->skillQuestionAssignmentList->loadFromDb();
144 $this->skillLevelThresholdList->loadFromDb();
169 $this->reachedPointsByQuestion = array();
170 $this->skillPointAccounts = array();
171 $this->reachedSkillLevels = array();
177 $this->questions[] = $questionData[
'question_id'];
179 $this->maxPointsByQuestion[ $questionData[
'question_id'] ] = $questionData[
'points'];
188 foreach ($testResults as $key =>
$result) {
189 if ($key ===
'pass' || $key ===
'test') {
193 if (!
$result[
'workedthrough']) {
197 $this->reachedPointsByQuestion[
$result[
'qid'] ] = $result[
'reached'];
203 foreach ($this->questions as $questionId) {
208 $assignments = $this->skillQuestionAssignmentList->getAssignmentsByQuestionId($questionId);
210 foreach ($assignments as $assignment) {
211 if ($assignment->hasEvalModeBySolution()) {
213 $assignment->getSolutionComparisonExpressionList()
216 $maxTestPoints = $this->maxPointsByQuestion[$questionId];
217 $reachedTestPoints = $this->reachedPointsByQuestion[$questionId];
220 $assignment->getSkillPoints(),
227 $assignment->getSkillBaseId(),
228 $assignment->getSkillTrefId(),
229 $assignment->getMaxSkillPoints(),
238 return isset($this->reachedPointsByQuestion[$questionId]);
244 $questionProvider->setQuestionId($expressionList->
getQuestionId());
246 foreach ($expressionList->
get() as $expression) {
250 $conditionComposite = $conditionParser->parse($expression->getExpression());
258 if ($compositeEvaluator->evaluate($conditionComposite)) {
259 return $expression->getPoints();
268 if ($reachedTestPoints < 0) {
269 $reachedTestPoints = 0;
274 if ($maxTestPoints > 0) {
275 $factor = $reachedTestPoints / $maxTestPoints;
278 return ($skillPoints * $factor);
283 $skillKey = $skillBaseId .
':' . $skillTrefId;
285 if (!isset($this->skillPointAccounts[$skillKey])) {
289 $this->skillPointAccounts[$skillKey]->addBooking($maxSkillPoints, $reachedSkillPoints);
294 foreach ($this->skillPointAccounts as $skillKey => $skillPointAccount) {
301 list($skillBaseId, $skillTrefId) = explode(
':', $skillKey);
304 $levels = $skill->getLevelData();
306 $reachedLevelId = null;
308 foreach ($levels as $level) {
309 $threshold = $this->skillLevelThresholdList->getThreshold($skillBaseId, $skillTrefId, $level[
'id']);
315 $reachedLevelId = $level[
'id'];
317 if ($skillPointAccount->getTotalReachedSkillPercent() <= $threshold->getThreshold()) {
322 if ($reachedLevelId) {
323 $this->reachedSkillLevels[] = array(
324 'sklBaseId' => $skillBaseId,
'sklTrefId' => $skillTrefId,
'sklLevelId' => $reachedLevelId
340 if ($reachedSkillLevel[
'sklTrefId'] > 0) {
363 $DIC->logger()->root()->info(
364 "refId={$this->refId} / usrId={$this->getUserId()} / levelId={$skillLevelId} / trefId={$skillTrefId}" 372 $skillsMatchingNumAnswersBarrier = array();
374 foreach ($this->skillPointAccounts as $skillKey => $skillPointAccount) {
376 list($skillBaseId, $skillTrefId) = explode(
':', $skillKey);
378 $skillsMatchingNumAnswersBarrier[$skillKey] = array(
379 'base_skill_id' => (
int) $skillBaseId,
380 'tref_id' => (
int) $skillTrefId
385 return $skillsMatchingNumAnswersBarrier;
390 $uniqueSkills = array();
392 foreach ($this->skillQuestionAssignmentList->getUniqueAssignedSkills() as $skill) {
393 $skillKey = $skill[
'skill_base_id'] .
':' . $skill[
'skill_tref_id'];
395 $uniqueSkills[$skillKey] = array(
396 'base_skill_id' => (
int) $skill[
'skill_base_id'],
397 'tref_id' => (
int) $skill[
'skill_tref_id']
401 return $uniqueSkills;
406 $this->skillQuestionAssignmentList->isAssignedSkill($skillBaseId, $skillTrefId);
411 $matchingSkillProfiles = array();
413 include_once(
"./Services/Skill/classes/class.ilSkillProfile.php");
416 foreach ($usersProfiles as $profileData) {
418 $assignedSkillLevels = $profile->getSkillLevels();
420 foreach ($assignedSkillLevels as $assignedSkillLevel) {
421 $skillBaseId = $assignedSkillLevel[
'base_skill_id'];
422 $skillTrefId = $assignedSkillLevel[
'tref_id'];
424 if ($this->skillQuestionAssignmentList->isAssignedSkill($skillBaseId, $skillTrefId)) {
425 $matchingSkillProfiles[$profileData[
'id']] = $profile->getTitle();
430 return $matchingSkillProfiles;
435 $noProfileMatchingSkills = $this->skillQuestionAssignmentList->getUniqueAssignedSkills();
437 foreach ($availableSkillProfiles as $skillProfileId => $skillProfileTitle) {
439 $assignedSkillLevels = $profile->getSkillLevels();
441 foreach ($assignedSkillLevels as $assignedSkillLevel) {
442 $skillBaseId = $assignedSkillLevel[
'base_skill_id'];
443 $skillTrefId = $assignedSkillLevel[
'tref_id'];
445 if ($this->skillQuestionAssignmentList->isAssignedSkill($skillBaseId, $skillTrefId)) {
446 unset($noProfileMatchingSkills[
"{$skillBaseId}:{$skillTrefId}"]);
451 return count($noProfileMatchingSkills);
init(ilAssQuestionList $questionList)
setNumRequiredBookingsForSkillTriggering($numRequiredBookingsForSkillTriggering)
evaluateSkillPointAccounts()
invokeSkillLevelTrigger($skillLevelId, $skillTrefId)
calculateReachedSkillPointsFromTestPoints($skillPoints, $maxTestPoints, $reachedTestPoints)
Class CompositeEvaluator.
getAssignedSkillMatchingSkillProfiles()
isAnsweredQuestion($questionId)
$numRequiredBookingsForSkillTriggering
__construct(ilDBInterface $db, $testId, $refId)
static getProfilesOfUser($a_user_id)
Get profiles of a user.
isAssignedSkill($skillBaseId, $skillTrefId)
$skillQuestionAssignmentList
noProfileMatchingAssignedSkillExists($availableSkillProfiles)
initTestResultData($testResults)
bookToSkillPointAccount($skillBaseId, $skillTrefId, $maxSkillPoints, $reachedSkillPoints)
static addPersonalSkill($a_user_id, $a_skill_node_id)
Add personal skill.
drawUpSkillPointAccounts()
getNumRequiredBookingsForSkillTriggering()
getSkillsInvolvedByAssignment()
Class ilParserQuestionProvider.
initTestQuestionData(ilAssQuestionList $questionList)
static writeUserSkillLevelStatus( $a_level_id, $a_user_id, $a_trigger_ref_id, $a_tref_id=0, $a_status=ilBasicSkill::ACHIEVED, $a_force=false, $a_self_eval=false, $a_unique_identifier="")
Write skill level status.
doesNumBookingsExceedRequiredBookingsBarrier(ilTestSkillPointAccount $skillPointAccount)
determineReachedSkillPointsWithSolutionCompare(ilAssQuestionSolutionComparisonExpressionList $expressionList)
getSkillsMatchingNumAnswersBarrier()