protected function OpignoTincanQuestionTypeResponse::getScoreFromLrs in Opigno TinCan Question Type 7
This method will return the score from the LRS system for this response.
Return value
int The score not weighted.
1 call to OpignoTincanQuestionTypeResponse::getScoreFromLrs()
- OpignoTincanQuestionTypeResponse::score in includes/
opigno_tincan_question_type.response.inc - Calculate the score for the response.
File
- includes/
opigno_tincan_question_type.response.inc, line 203 - This file contains the class OpignoTincanQuestionTypeResponse.
Class
- OpignoTincanQuestionTypeResponse
- This class goal is to manage the user's answer(s).
Code
protected function getScoreFromLrs() {
// First, try to get the connection.
$lrs = $this
->getLrsConnection();
if (!$lrs) {
drupal_set_message(t('Connection to the LRS failed'));
return 0;
}
// If we have the connection, get the statement.
if (empty($this->registration)) {
drupal_set_message(t('There was an error while answering the question, please go back and try again.'));
return 0;
}
if (!isset($this->question->activity_id)) {
drupal_set_message(t('Error while obtaining the activity ID. Maybe a malformed TinCan package.'));
return 0;
}
$score_statement = $this
->getStatementFinalScore($lrs, $this->registration, $this->question->activity_id);
if (!$score_statement) {
return 0;
}
// If we have the statement, extract the score and returns it.
return $this
->getScoreFromStatement($score_statement);
}