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';
92 $this->skillLevelThresholdList->setTestId($testId);
94 $this->questions = array();
95 $this->maxPointsByQuestion = array();
140 $this->skillQuestionAssignmentList->setParentObjId($questionList->
getParentObjId());
141 $this->skillQuestionAssignmentList->loadFromDb();
143 $this->skillLevelThresholdList->loadFromDb();
168 $this->reachedPointsByQuestion = array();
169 $this->skillPointAccounts = array();
170 $this->reachedSkillLevels = array();
176 $this->questions[] = $questionData[
'question_id'];
178 $this->maxPointsByQuestion[ $questionData[
'question_id'] ] = $questionData[
'points'];
187 foreach ($testResults as $key =>
$result) {
188 if ($key ===
'pass' || $key ===
'test') {
192 if (!
$result[
'workedthrough']) {
196 $this->reachedPointsByQuestion[
$result[
'qid'] ] = $result[
'reached'];
202 foreach ($this->questions as $questionId) {
207 $assignments = $this->skillQuestionAssignmentList->getAssignmentsByQuestionId($questionId);
209 foreach ($assignments as $assignment) {
210 if ($assignment->hasEvalModeBySolution()) {
212 $assignment->getSolutionComparisonExpressionList()
215 $maxTestPoints = $this->maxPointsByQuestion[$questionId];
216 $reachedTestPoints = $this->reachedPointsByQuestion[$questionId];
219 $assignment->getSkillPoints(),
226 $assignment->getSkillBaseId(),
227 $assignment->getSkillTrefId(),
228 $assignment->getMaxSkillPoints(),
237 return isset($this->reachedPointsByQuestion[$questionId]);
243 $questionProvider->setQuestionId($expressionList->
getQuestionId());
245 foreach ($expressionList->
get() as $expression) {
249 $conditionComposite = $conditionParser->parse($expression->getExpression());
257 if ($compositeEvaluator->evaluate($conditionComposite)) {
258 return $expression->getPoints();
267 if ($reachedTestPoints < 0) {
268 $reachedTestPoints = 0;
273 if ($maxTestPoints > 0) {
274 $factor = $reachedTestPoints / $maxTestPoints;
277 return ($skillPoints * $factor);
282 $skillKey = $skillBaseId .
':' . $skillTrefId;
284 if (!isset($this->skillPointAccounts[$skillKey])) {
288 $this->skillPointAccounts[$skillKey]->addBooking($maxSkillPoints, $reachedSkillPoints);
293 foreach ($this->skillPointAccounts as $skillKey => $skillPointAccount) {
300 list($skillBaseId, $skillTrefId) = explode(
':', $skillKey);
303 $levels = $skill->getLevelData();
305 $reachedLevelId = null;
307 foreach ($levels as $level) {
308 $threshold = $this->skillLevelThresholdList->getThreshold($skillBaseId, $skillTrefId, $level[
'id']);
314 $reachedLevelId = $level[
'id'];
316 if ($skillPointAccount->getTotalReachedSkillPercent() <= $threshold->getThreshold()) {
321 if ($reachedLevelId) {
322 $this->reachedSkillLevels[] = array(
323 'sklBaseId' => $skillBaseId,
'sklTrefId' => $skillTrefId,
'sklLevelId' => $reachedLevelId
339 if ($reachedSkillLevel[
'sklTrefId'] > 0) {
362 $DIC->logger()->root()->info(
363 "refId={$this->refId} / usrId={$this->getUserId()} / levelId={$skillLevelId} / trefId={$skillTrefId}" 371 $skillsMatchingNumAnswersBarrier = array();
373 foreach ($this->skillPointAccounts as $skillKey => $skillPointAccount) {
375 list($skillBaseId, $skillTrefId) = explode(
':', $skillKey);
377 $skillsMatchingNumAnswersBarrier[$skillKey] = array(
378 'base_skill_id' => (
int) $skillBaseId,
379 'tref_id' => (
int) $skillTrefId
384 return $skillsMatchingNumAnswersBarrier;
389 $uniqueSkills = array();
391 foreach ($this->skillQuestionAssignmentList->getUniqueAssignedSkills() as $skill) {
392 $skillKey = $skill[
'skill_base_id'] .
':' . $skill[
'skill_tref_id'];
394 $uniqueSkills[$skillKey] = array(
395 'base_skill_id' => (
int) $skill[
'skill_base_id'],
396 'tref_id' => (
int) $skill[
'skill_tref_id']
400 return $uniqueSkills;
405 $this->skillQuestionAssignmentList->isAssignedSkill($skillBaseId, $skillTrefId);
410 $matchingSkillProfiles = array();
414 foreach ($usersProfiles as $profileData) {
416 $assignedSkillLevels = $profile->getSkillLevels();
418 foreach ($assignedSkillLevels as $assignedSkillLevel) {
419 $skillBaseId = $assignedSkillLevel[
'base_skill_id'];
420 $skillTrefId = $assignedSkillLevel[
'tref_id'];
422 if ($this->skillQuestionAssignmentList->isAssignedSkill($skillBaseId, $skillTrefId)) {
423 $matchingSkillProfiles[$profileData[
'id']] = $profile->getTitle();
428 return $matchingSkillProfiles;
433 $noProfileMatchingSkills = $this->skillQuestionAssignmentList->getUniqueAssignedSkills();
435 foreach ($availableSkillProfiles as $skillProfileId => $skillProfileTitle) {
437 $assignedSkillLevels = $profile->getSkillLevels();
439 foreach ($assignedSkillLevels as $assignedSkillLevel) {
440 $skillBaseId = $assignedSkillLevel[
'base_skill_id'];
441 $skillTrefId = $assignedSkillLevel[
'tref_id'];
443 if ($this->skillQuestionAssignmentList->isAssignedSkill($skillBaseId, $skillTrefId)) {
444 unset($noProfileMatchingSkills[
"{$skillBaseId}:{$skillTrefId}"]);
449 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 writeUserSkillLevelStatus(int $a_level_id, int $a_user_id, int $a_trigger_ref_id, int $a_tref_id=0, int $a_status=ilBasicSkill::ACHIEVED, bool $a_force=false, bool $a_self_eval=false, string $a_unique_identifier="", float $a_next_level_fulfilment=0.0)
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)
doesNumBookingsExceedRequiredBookingsBarrier(ilTestSkillPointAccount $skillPointAccount)
determineReachedSkillPointsWithSolutionCompare(ilAssQuestionSolutionComparisonExpressionList $expressionList)
getSkillsMatchingNumAnswersBarrier()