/** * $resultsData should be array with following keys and values: * 't' in seconds (currently not used) * 's' integer score * * * @param \_OurBrand_\Quiz\Domain\Model\StudentQuizSession $studentQuizSession * @param \_OurBrand_\Quiz\Domain\Model\Exercise $exercise * @param array $resultsData */ public function addResultToQuizSessionResultsStatistics($studentQuizSession, $exercise, $resultsData) { $studentQuizSessionIdentifier = $this->persistenceManager->getIdentifierByObject($studentQuizSession); $exerciseIdentifier = $this->persistenceManager->getIdentifierByObject($exercise); $quizSession = $studentQuizSession->getQuizSession(); $quizSession->addResultToResultsStatistics($studentQuizSessionIdentifier, $exerciseIdentifier, $resultsData); $this->quizSessionRepository->update($quizSession); $this->writeLiveStatisticsFile($quizSession); }
/** * Generate testData * * This command inserts all the required data to start testing the student view of the Dictation exercise * * @return void */ public function generateInsertCommand() { $quiz = new Quiz(); $quiz->setTitle('Dictation Insert'); $quiz->setAuthor('Test Instructor'); $quiz->setCreator('instructor'); $quiz->setIsDraft(false); $quiz->setType(0); $exercise = new InsertDictationExercise(); $exercise->setTitle('Spelling and Grammer: Insert Dictation'); $exercise->setDescription('Description'); $snippet = new DictationSnippet(); $snippet->setText('<span class="textShow">This is a very</span> <span class="textmark">marvellous</span> horse'); $markedText = new MarkedText(); $markedText->setText('marvellous'); $snippet->addMarkedText($markedText); $exercise->addSnippet($snippet); $snippet = new DictationSnippet(); $snippet->setText('<span class="textShow">This is another</span> <span class="textmark">sentence</span> horse'); $markedText = new MarkedText(); $markedText->setText('sentence'); $snippet->addMarkedText($markedText); $exercise->addSnippet($snippet); $snippet = new DictationSnippet(); $snippet->setText('<span class="textmark">Newest</span> <span class="textShow">more</span><span class="textmark">text</span>'); $markedText = new MarkedText(); $markedText->setText('Newest'); $snippet->addMarkedText($markedText); $markedText = new MarkedText(); $markedText->setText('text'); $snippet->addMarkedText($markedText); $exercise->addSnippet($snippet); $quiz->addExercise($exercise); $this->quizRepository->add($quiz); //Create QuizSession $quizSession = new QuizSession(); $quizSession->setQuiz($quiz); $quizSession->setInstructor('instructor'); $quizSession->setStudentCanSeeSummaryAndReviewExercises(1); $quizSession->setShowGradeOnSummary(1); $this->quizSessionRepository->add($quizSession); //Create studentQuizSession $studentQuizSession = new StudentQuizSession(); $studentQuizSession->setQuizSession($quizSession); $studentQuizSession->setStudent('student'); $this->studentQuizSessionRepository->add($studentQuizSession); }