19declare(strict_types=1);
45 return $this->positions;
50 return $this->positions->getAllAttempts()[$usr_active_id];
55 return $this->
object->createQuestionGUI(
"", $qid);
66 foreach ($this->positions->getAllAttempts() as $usr_active_id => $attempt) {
77 $question_titles = [];
78 foreach ($this->positions->getAllQuestionProperties() as $qid => $qprop) {
79 $question_titles[$qid] = sprintf(
82 $qprop->getTypeName(
$lng)
85 return $question_titles;
93 || !$this->test_access->checkScoreParticipantsAccess()
95 return \ilObjTest::buildExamId($usr_active_id, $attempt, $this->
object->getId());
97 $user_id = (string) $this->
object->_getUserIdFromActiveId($usr_active_id);
98 $user_data = $this->
object->getUserData([
$user_id]);
113 || !$this->test_access->checkScoreParticipantsAccess()
115 return \ilObjTest::buildExamId($usr_active_id, $attempt, $this->
object->getId());
117 return (
string) $this->
object->_getUserIdFromActiveId($usr_active_id);
123 if (array_key_exists(
"finalized_tstamp", $fb)) {
124 $fb[
"finalized_time"] = $this->current_user->getDateTimeFormat()->applyTo(
125 \DateTimeImmutable::createFromFormat(
'U', (
string) $fb[
"finalized_tstamp"])
133 $question_gui = $this->getQuestionGUI($qid);
134 $shuffle_trafo = $this->shuffler->getAnswerShuffleFor($qid, $usr_active_id, $attempt_id);
135 $question = $question_gui->getObject();
136 $question->setShuffler($shuffle_trafo);
137 $question_gui->setObject($question);
138 return $question_gui;
147 foreach ($this->positions->getAllAttempts() as $usr_active_id => $attempt_id) {
148 $answered[$usr_active_id] = [];
150 $user_results = $this->
object->getTestResult(
158 foreach ($user_results as $idx => $qresult) {
159 if (!is_numeric($idx)) {
162 if ((
bool) $qresult[
'answered']) {
163 $answered[$usr_active_id][] = (
int) $qresult[
'qid'];
176 $usr_active_ids = array_keys($this->positions->getAllAttempts());
177 foreach (array_keys($this->positions->getAllQuestionProperties()) as $qid) {
178 $feedback = $this->
object->getCompleteManualFeedback($qid);
179 foreach ($usr_active_ids as $uid) {
180 if (! array_key_exists($uid, $finalized)) {
181 $finalized[$uid] = [];
183 $attempt_id = $this->getAttemptUsedForEvaluation($uid);
184 if ((
bool) ($feedback[$uid][$attempt_id][$qid][
'finalized_evaluation'] ??
false)) {
185 $finalized[$uid][] = $qid;
198 $usr_active_ids = array_keys($this->positions->getAllAttempts());
199 foreach (array_keys($this->positions->getAllQuestionProperties()) as $qid) {
200 $feedback = $this->
object->getCompleteManualFeedback($qid);
201 foreach ($usr_active_ids as $uid) {
202 $attempt_id = $this->getAttemptUsedForEvaluation($uid);
203 $scorer = $feedback[$uid][$attempt_id][$qid][
'finalized_by_usr_id'] ?? 0;
205 if (in_array($scorer, $finalizing_usr_ids)) {
210 return array_unique($finalized);
219 $attempts = $this->positions->getAllAttempts();
220 $question_ids = array_keys($this->positions->getAllQuestionProperties());
222 foreach ($question_ids as $qid) {
223 $feedback = $this->
object->getCompleteManualFeedback($qid);
225 foreach ($attempts as $uid => $attempt_id) {
226 if ($feedback[$uid][$attempt_id][$qid][
'finalized_by_usr_id'] ??
false) {
227 $scorer_id = $feedback[$uid][$attempt_id][$qid][
'finalized_by_usr_id'];
228 $finalized_by[$scorer_id] = $scorer_id;
233 function ($scorer_id) {
235 return $ud[
'firstname'] .
' ' . $ud[
'lastname'];
258 $previously_reached_points = $this->getQuestionObject($qid)
259 ->getReachedPoints($usr_active_id, $attempt_id);
260 if ($score !== $previously_reached_points) {
261 \assQuestion::_setReachedPoints(
271 $this->
object->saveManualFeedback(
279 $this->scorer->setPreserveManualScores(
true);
280 $this->scorer->recalculateSolution($usr_active_id, $attempt_id);
287 if ($this->
logger->isLoggingEnabled()) {
288 $this->
logger->logScoringInteraction(
289 $this->
logger->getInteractionFactory()->buildScoringInteraction(
290 $this->object->getRefId(),
292 $this->current_user->getId(),
294 TestScoringInteractionTypes::QUESTION_GRADED,
296 AdditionalInformationGenerator::KEY_REACHED_POINTS => $score,
297 AdditionalInformationGenerator::KEY_FEEDBACK => $feedback,
298 AdditionalInformationGenerator::KEY_EVAL_FINALIZED => $this->logger
299 ->getAdditionalInformationGenerator()->getTrueFalseTagForBool($final)
310 $this->scoring_done_helper->setDone($usr_active_id, $flag);
315 return $this->scoring_done_helper->isDone($usr_active_id);
getSingleManualFeedback(int $qid, int $usr_active_id, int $attempt_id)
getUserId(int $usr_active_id, string $attempt,)
completeScoring(int $usr_active_id, bool $flag=true)
getQidsFinalizedBy(array $finalizing_usr_ids)
getFinalizedFeedbackIds()
isScoringComplete(int $usr_active_id)
getUserQuestionGUI(int $qid, int $usr_active_id, int $attempt_id)
__construct(private readonly Positions $positions, private readonly \ilObjTest $object, private readonly \ilTestShuffler $shuffler, private readonly TestLogger $logger, private TestScoring $scorer, private TestManScoringDoneHelper $scoring_done_helper, private \ilObjUser $current_user, private readonly \ilTestAccess $test_access,)
store(int $qid, int $usr_active_id, int $attempt_id, float $score, bool $final, string $feedback, float $max_points)
getQuestionTitles(\ilLanguage $lng)
getQuestionObject(int $qid)
getAttemptUsedForEvaluation(int $usr_active_id)
getUserFullName(int $usr_active_id, string $attempt)
getAllFinalizingUserNames()
static _updateStatus(int $a_obj_id, int $a_usr_id, ?object $a_obj=null, bool $a_percentage=false, bool $a_force_raise=false)
static _getParticipantId(int $active_id)
Get user id for active id.
static getSingleManualFeedback(int $active_id, int $question_id, int $pass)
static _getUserData(array $a_internalids)
static _getUsedHTMLTagsAsString(string $module='')
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
TestScoringInteractionTypes
if(!file_exists('../ilias.ini.php'))