19declare(strict_types=1);
48 return $this->positions;
53 return $this->positions->getAllAttempts()[$usr_active_id];
58 return $this->
object->createQuestionGUI(
"", $qid);
69 foreach ($this->positions->getAllAttempts() as $usr_active_id => $attempt) {
80 $question_titles = [];
81 foreach ($this->positions->getAllQuestionProperties() as $qid => $qprop) {
82 $question_titles[$qid] = sprintf(
85 $qprop->getTypeName(
$lng)
88 return $question_titles;
96 || !$this->test_access->checkScoreParticipantsAccess()
98 return \ilObjTest::buildExamId($usr_active_id, $attempt, $this->
object->getId());
101 $participant = $this->participant_repository->getParticipantByActiveId($this->
object->getTestId(), $usr_active_id);
102 $importname = $participant->getImportname();
103 $user_id = $participant->getUserId();
105 return $participant->getDisplayName($this->
lng);
123 || !$this->test_access->checkScoreParticipantsAccess()
125 return \ilObjTest::buildExamId($usr_active_id, $attempt, $this->
object->getId());
127 return (
string) $this->
object->_getUserIdFromActiveId($usr_active_id);
133 if (array_key_exists(
"finalized_tstamp", $fb)) {
134 $fb[
"finalized_time"] = $this->current_user->getDateTimeFormat()->applyTo(
135 \DateTimeImmutable::createFromFormat(
'U', (
string) $fb[
"finalized_tstamp"])
143 $question_gui = $this->getQuestionGUI($qid);
144 $shuffle_trafo = $this->shuffler->getAnswerShuffleFor($qid, $usr_active_id, $attempt_id);
145 $question = $question_gui->getObject();
146 $question->setShuffler($shuffle_trafo);
147 $question_gui->setObject($question);
148 return $question_gui;
157 foreach ($this->positions->getAllAttempts() as $usr_active_id => $attempt_id) {
158 $answered[$usr_active_id] = [];
160 $user_results = $this->
object->getTestResult(
168 foreach ($user_results as $idx => $qresult) {
169 if (!is_numeric($idx)) {
172 if ((
bool) $qresult[
'answered']) {
173 $answered[$usr_active_id][] = (
int) $qresult[
'qid'];
186 $usr_active_ids = array_keys($this->positions->getAllAttempts());
187 foreach (array_keys($this->positions->getAllQuestionProperties()) as $qid) {
188 $feedback = $this->
object->getCompleteManualFeedback($qid);
189 foreach ($usr_active_ids as $uid) {
190 if (! array_key_exists($uid, $finalized)) {
191 $finalized[$uid] = [];
193 $attempt_id = $this->getAttemptUsedForEvaluation($uid);
194 if ((
bool) ($feedback[$uid][$attempt_id][$qid][
'finalized_evaluation'] ??
false)) {
195 $finalized[$uid][] = $qid;
208 $usr_active_ids = array_keys($this->positions->getAllAttempts());
209 foreach (array_keys($this->positions->getAllQuestionProperties()) as $qid) {
210 $feedback = $this->
object->getCompleteManualFeedback($qid);
211 foreach ($usr_active_ids as $uid) {
212 $attempt_id = $this->getAttemptUsedForEvaluation($uid);
213 $scorer = $feedback[$uid][$attempt_id][$qid][
'finalized_by_usr_id'] ?? 0;
215 if (in_array($scorer, $finalizing_usr_ids)) {
220 return array_unique($finalized);
229 $attempts = $this->positions->getAllAttempts();
230 $question_ids = array_keys($this->positions->getAllQuestionProperties());
232 foreach ($question_ids as $qid) {
233 $feedback = $this->
object->getCompleteManualFeedback($qid);
235 foreach ($attempts as $uid => $attempt_id) {
236 if ($feedback[$uid][$attempt_id][$qid][
'finalized_by_usr_id'] ??
false) {
237 $scorer_id = $feedback[$uid][$attempt_id][$qid][
'finalized_by_usr_id'];
238 $finalized_by[$scorer_id] = $scorer_id;
243 function ($scorer_id) {
245 return $ud[
'firstname'] .
' ' . $ud[
'lastname'];
268 $previously_reached_points = $this->getQuestionObject($qid)
269 ->getReachedPoints($usr_active_id, $attempt_id);
270 if ($score !== $previously_reached_points) {
271 \assQuestion::_setReachedPoints(
281 $this->
object->saveManualFeedback(
289 $this->scorer->setPreserveManualScores(
true);
290 $this->scorer->recalculateSolution($usr_active_id, $attempt_id);
297 if ($this->
logger->isLoggingEnabled()) {
298 $this->
logger->logScoringInteraction(
299 $this->
logger->getInteractionFactory()->buildScoringInteraction(
300 $this->object->getRefId(),
302 $this->current_user->getId(),
304 TestScoringInteractionTypes::QUESTION_GRADED,
306 AdditionalInformationGenerator::KEY_REACHED_POINTS => $score,
307 AdditionalInformationGenerator::KEY_FEEDBACK => $feedback,
308 AdditionalInformationGenerator::KEY_EVAL_FINALIZED => $this->logger
309 ->getAdditionalInformationGenerator()->getTrueFalseTagForBool($final)
320 $this->scoring_done_helper->setDone($usr_active_id, $flag);
325 return $this->scoring_done_helper->isDone($usr_active_id);
getSingleManualFeedback(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, private readonly ParticipantRepository $participant_repository, private readonly Language $lng,)
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)
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'))