61 $this->parentObjId =
null;
62 $this->assignments = [];
63 $this->numAssignsBySkill = [];
64 $this->maxPointsBySkill = [];
65 $this->questionIdFilter =
null;
102 $this->assignments = [];
103 $this->numAssignsBySkill = [];
104 $this->maxPointsBySkill = [];
109 if (!isset($this->assignments[$assignment->
getQuestionId()])) {
113 $this->assignments[$assignment->
getQuestionId()][] = $assignment;
120 if (!isset($this->numAssignsBySkill[$key])) {
121 $this->numAssignsBySkill[$key] = 0;
124 $this->numAssignsBySkill[$key]++;
131 if (!isset($this->maxPointsBySkill[$key])) {
132 $this->maxPointsBySkill[$key] = 0;
142 $res = $this->db->query(
" 143 SELECT obj_fi, question_fi, skill_base_fi, skill_tref_fi, skill_points, eval_mode 144 FROM qpl_qst_skl_assigns 145 WHERE {$this->getWhereConditions()} 148 while ($row = $this->db->fetchAssoc(
$res)) {
151 if ($assignment->hasEvalModeBySolution()) {
152 $assignment->loadComparisonExpressions();
164 'obj_fi = ' . $this->db->quote($this->
getParentObjId(),
'integer')
168 $conditions[] =
'question_fi = ' . $this->db->quote($this->
getQuestionIdFilter(),
'integer');
171 return implode(
' AND ', $conditions);
182 $assignment->setParentObjId(
$data[
'obj_fi']);
183 $assignment->setQuestionId(
$data[
'question_fi']);
184 $assignment->setSkillBaseId(
$data[
'skill_base_fi']);
185 $assignment->setSkillTrefId(
$data[
'skill_tref_fi']);
186 $assignment->setSkillPoints(
$data[
'skill_points']);
187 $assignment->setEvalMode(
$data[
'eval_mode']);
194 return $skillBaseId .
':' . $skillTrefId;
199 foreach ($this->assignments as $assignmentsByQuestion) {
200 foreach ($assignmentsByQuestion as $assignment) {
201 $assignment->loadAdditionalSkillData();
212 if (!isset($this->assignments[$questionId])) {
216 return $this->assignments[$questionId];
221 if (!isset($this->assignments[$questionId])) {
225 foreach ($this->assignments[$questionId] as $assignment) {
226 if ($assignment->getSkillBaseId() != $skillBaseId) {
230 if ($assignment->getSkillTrefId() != $skillTrefId) {
244 foreach ($this->assignments as $assignmentsByQuestion) {
245 foreach ($assignmentsByQuestion as $assignment) {
246 $key = $this->
buildSkillKey($assignment->getSkillBaseId(), $assignment->getSkillTrefId());
247 if (!isset($skills[$key])) {
249 'skill' =>
new ilBasicSkill($assignment->getSkillBaseId()),
250 'skill_base_id' => $assignment->getSkillBaseId(),
251 'skill_tref_id' => $assignment->getSkillTrefId(),
252 'skill_title' => $assignment->getSkillTitle(),
253 'skill_path' => $assignment->getSkillPath(),
255 $assignment->getSkillBaseId(),
256 $assignment->getSkillTrefId()
259 $assignment->getSkillBaseId(),
260 $assignment->getSkillTrefId()
273 if ($assignedSkill[
'skill_base_id'] != $skillBaseId) {
277 if ($assignedSkill[
'skill_tref_id'] == $skillTrefId) {
287 return $this->numAssignsBySkill[$this->
buildSkillKey($skillBaseId, $skillTrefId)] ??
null;
292 return $this->maxPointsBySkill[$this->
buildSkillKey($skillBaseId, $skillTrefId)] ??
null;
297 $global_barrier = (
new ilObjTestFolder())->getGlobalSettingsRepository()
298 ->getGlobalSettings()->getSkillTriggeringNumberOfAnswers();
301 if ($skill_data[
'num_assigns'] < $global_barrier) {
incrementMaxPointsBySkill(ilAssQuestionSkillAssignment $assignment)
__construct(ilDBInterface $db)
getNumAssignsBySkill($skillBaseId, $skillTrefId)
loadAdditionalSkillData()
hasSkillsAssignedLowerThanBarrier()
getAssignmentsByQuestionId($questionId)
buildSkillKey($skillBaseId, $skillTrefId)
setQuestionIdFilter($questionIdFilter)
setParentObjId($parentObjId)
getMaxPointsBySkill($skillBaseId, $skillTrefId)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
addAssignment(ilAssQuestionSkillAssignment $assignment)
buildSkillQuestionAssignmentByArray($data)
isAssignedSkill($skillBaseId, $skillTrefId)
getUniqueAssignedSkills()
isAssignedToQuestionId($skillBaseId, $skillTrefId, $questionId)
incrementNumAssignsBySkill(ilAssQuestionSkillAssignment $assignment)