19 declare(strict_types=1);
59 $this->skillLevelThresholdList->setTestId($test_id);
104 $this->skillQuestionAssignmentList->setParentObjId($questionList->
getParentObjId());
105 $this->skillQuestionAssignmentList->loadFromDb();
107 $this->skillLevelThresholdList->loadFromDb();
132 $this->reachedPointsByQuestion = array();
133 $this->skillPointAccounts = array();
134 $this->reachedSkillLevels = array();
140 $this->questions[] = $questionData[
'question_id'];
142 $this->maxPointsByQuestion[ $questionData[
'question_id'] ] = $questionData[
'points'];
151 foreach ($testResults as
$key => $result) {
152 if (
$key ===
'pass' ||
$key ===
'test') {
156 $this->reachedPointsByQuestion[ $result[
'qid'] ] = $result[
'reached'];
162 foreach ($this->questions as $questionId) {
167 $assignments = $this->skillQuestionAssignmentList->getAssignmentsByQuestionId($questionId);
169 foreach ($assignments as $assignment) {
170 if ($assignment->hasEvalModeBySolution()) {
172 $assignment->getSolutionComparisonExpressionList()
175 $maxTestPoints = $this->maxPointsByQuestion[$questionId];
176 $reachedTestPoints = $this->reachedPointsByQuestion[$questionId];
179 $assignment->getSkillPoints(),
186 $assignment->getSkillBaseId(),
187 $assignment->getSkillTrefId(),
188 $assignment->getMaxSkillPoints(),
197 return isset($this->reachedPointsByQuestion[$questionId]);
203 $questionProvider->setQuestionId($expressionList->
getQuestionId());
205 foreach ($expressionList->
get() as $expression) {
209 $conditionComposite = $conditionParser->parse($expression->getExpression());
216 if ($compositeEvaluator->evaluate($conditionComposite)) {
217 return $expression->getPoints();
226 if ($reachedTestPoints < 0) {
227 $reachedTestPoints = 0;
232 if ($maxTestPoints > 0) {
233 $factor = $reachedTestPoints / $maxTestPoints;
236 return ($skillPoints * $factor);
241 $skillKey = $skillBaseId .
':' . $skillTrefId;
243 if (!isset($this->skillPointAccounts[$skillKey])) {
247 $this->skillPointAccounts[$skillKey]->addBooking($maxSkillPoints, $reachedSkillPoints);
252 foreach ($this->skillPointAccounts as $skillKey => $skillPointAccount) {
257 list($skillBaseId, $skillTrefId) = explode(
':', $skillKey);
260 $levels = $skill->getLevelData();
262 $reachedLevelId = null;
264 foreach ($levels as $level) {
265 $threshold = $this->skillLevelThresholdList->getThreshold($skillBaseId, $skillTrefId, $level[
'id']);
271 if ($skillPointAccount->getTotalReachedSkillPercent() < $threshold->getThreshold()) {
275 $reachedLevelId = $level[
'id'];
278 if ($reachedLevelId) {
279 $this->reachedSkillLevels[] = array(
280 'sklBaseId' => $skillBaseId,
'sklTrefId' => $skillTrefId,
'sklLevelId' => $reachedLevelId
296 if ($reachedSkillLevel[
'sklTrefId'] > 0) {
297 $this->skill_personal_service->addPersonalSkill($this->
getUserId(), (
int) $reachedSkillLevel[
'sklTrefId']);
299 $this->skill_personal_service->addPersonalSkill($this->
getUserId(), (
int) $reachedSkillLevel[
'sklBaseId']);
303 $this->skill_profile_service->writeCompletionEntryForAllProfiles($this->
getUserId());
319 $this->logging_services->root()->info(
320 "refId={$this->refId} / usrId={$this->getUserId()} / levelId={$skillLevelId} / trefId={$skillTrefId}" 328 $skillsMatchingNumAnswersBarrier = array();
330 foreach ($this->skillPointAccounts as $skillKey => $skillPointAccount) {
332 list($skillBaseId, $skillTrefId) = explode(
':', $skillKey);
334 $skillsMatchingNumAnswersBarrier[$skillKey] = array(
335 'base_skill_id' => (
int) $skillBaseId,
336 'tref_id' => (
int) $skillTrefId
341 return $skillsMatchingNumAnswersBarrier;
346 $uniqueSkills = array();
348 foreach ($this->skillQuestionAssignmentList->getUniqueAssignedSkills() as $skill) {
349 $skillKey = $skill[
'skill_base_id'] .
':' . $skill[
'skill_tref_id'];
351 $uniqueSkills[$skillKey] = array(
352 'base_skill_id' => (
int) $skill[
'skill_base_id'],
353 'tref_id' => (
int) $skill[
'skill_tref_id']
357 return $uniqueSkills;
362 $this->skillQuestionAssignmentList->isAssignedSkill($skillBaseId, $skillTrefId);
367 $matchingSkillProfiles = array();
369 $usersProfiles = $this->skill_profile_service->getProfilesOfUser($this->
getUserId());
371 foreach ($usersProfiles as $profileData) {
372 $assignedSkillLevels = $this->skill_profile_service->getSkillLevels($profileData->getId());
374 foreach ($assignedSkillLevels as $assignedSkillLevel) {
375 $skillBaseId = $assignedSkillLevel->getBaseSkillId();
376 $skillTrefId = $assignedSkillLevel->getTrefId();
378 if ($this->skillQuestionAssignmentList->isAssignedSkill($skillBaseId, $skillTrefId)) {
379 $matchingSkillProfiles[$profileData->getId()] = $profileData->getTitle();
384 return $matchingSkillProfiles;
389 $noProfileMatchingSkills = $this->skillQuestionAssignmentList->getUniqueAssignedSkills();
391 foreach ($availableSkillProfiles as $skillProfileId => $skillProfileTitle) {
392 $profile = $this->skill_profile_service->getProfile($skillProfileId);
393 $assignedSkillLevels = $this->skill_profile_service->getSkillLevels($profile->getId());
395 foreach ($assignedSkillLevels as $assignedSkillLevel) {
396 $skillBaseId = $assignedSkillLevel->getBaseSkillId();
397 $skillTrefId = $assignedSkillLevel->getTrefId();
399 if ($this->skillQuestionAssignmentList->isAssignedSkill($skillBaseId, $skillTrefId)) {
400 unset($noProfileMatchingSkills[
"{$skillBaseId}:{$skillTrefId}"]);
405 return $noProfileMatchingSkills !== [];
init(ilAssQuestionList $questionList)
evaluateSkillPointAccounts()
setNumRequiredBookingsForSkillTriggering(int $numRequiredBookingsForSkillTriggering)
calculateReachedSkillPointsFromTestPoints($skillPoints, $maxTestPoints, $reachedTestPoints)
evaluate(array $testResults)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ilAssQuestionSkillAssignmentList $skillQuestionAssignmentList
invokeSkillLevelTrigger(int $skillLevelId, int $skillTrefId)
getAssignedSkillMatchingSkillProfiles()
Provides fluid interface to LoggingServices.
isAnsweredQuestion($questionId)
int $numRequiredBookingsForSkillTriggering
ilTestSkillLevelThresholdList $skillLevelThresholdList
isAssignedSkill($skillBaseId, $skillTrefId)
initTestResultData($testResults)
array $reachedPointsByQuestion
__construct(private ilDBInterface $db, private LoggingServices $logging_services, int $test_id, private int $refId, private SkillProfileService $skill_profile_service, private SkillPersonalService $skill_personal_service)
bookToSkillPointAccount($skillBaseId, $skillTrefId, $maxSkillPoints, $reachedSkillPoints)
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, string $trigger_user_id="")
drawUpSkillPointAccounts()
getNumRequiredBookingsForSkillTriggering()
array $maxPointsByQuestion
array $skillPointAccounts
getSkillsInvolvedByAssignment()
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
initTestQuestionData(ilAssQuestionList $questionList)
doesNumBookingsExceedRequiredBookingsBarrier(ilTestSkillPointAccount $skillPointAccount)
noProfileMatchingAssignedSkillExists(array $availableSkillProfiles)
determineReachedSkillPointsWithSolutionCompare(ilAssQuestionSolutionComparisonExpressionList $expressionList)
array $reachedSkillLevels
getSkillsMatchingNumAnswersBarrier()