protected function OpignoTincanQuestionTypeResponse::getStatementFinalScore in Opigno TinCan Question Type 7
Get the statement containing the final score.
Parameters
RemoteLRS $lrs: The LRS connection.
string $registration_uuid: The registration UUID.
string $activity_id: The activity ID of the statement.
Return value
bool|\TinCan\Statement The statement. If not found, returns FALSE.
1 call to OpignoTincanQuestionTypeResponse::getStatementFinalScore()
- OpignoTincanQuestionTypeResponse::getScoreFromLrs in includes/
opigno_tincan_question_type.response.inc - This method will return the score from the LRS system for this response.
File
- includes/
opigno_tincan_question_type.response.inc, line 288 - This file contains the class OpignoTincanQuestionTypeResponse.
Class
- OpignoTincanQuestionTypeResponse
- This class goal is to manage the user's answer(s).
Code
protected function getStatementFinalScore(RemoteLRS $lrs, $registration_uuid, $activity_id) {
$activity = new Activity();
$activity
->setId($activity_id);
$verb_passed = new Verb();
$verb_passed
->setId(OpignoTincanApiTinCanVerbs::$passed['id']);
// Test with verb "passed".
$result = $lrs
->queryStatements(array(
'activity' => $activity,
'registration' => $registration_uuid,
'verb' => $verb_passed,
'limit' => 1,
));
$statements = $result->content
->getStatements();
// If nothing with "passed", test with "failed" verb.
if (count($statements) === 0) {
$verb_failed = new Verb();
$verb_failed
->setId(OpignoTincanApiTinCanVerbs::$failed['id']);
$result = $lrs
->queryStatements(array(
'activity' => $activity,
'registration' => $registration_uuid,
'verb' => $verb_failed,
'limit' => 1,
));
$statements = $result->content
->getStatements();
}
if (count($statements) > 0) {
return $statements[0];
}
else {
return FALSE;
}
}