|
|
|
|
@ -684,14 +684,19 @@ class FillBlanks extends Question |
|
|
|
|
* it is not as simple as equality, because of the type of Fill The Blank question |
|
|
|
|
* eg : studentAnswer = 'Un' and correctAnswer = 'Un||1||un'. |
|
|
|
|
* |
|
|
|
|
* @param string $studentAnswer [student_answer] of the info array of the answer field |
|
|
|
|
* @param string $correctAnswer [words] of the info array of the answer field |
|
|
|
|
* @param bool $fromDatabase |
|
|
|
|
* @param string $studentAnswer [student_answer] of the info array of the answer field |
|
|
|
|
* @param string $correctAnswer [words] of the info array of the answer field |
|
|
|
|
* @param bool $fromDatabase Optional |
|
|
|
|
* @param bool $studentAnswerIsHash Optional. |
|
|
|
|
* |
|
|
|
|
* @return bool |
|
|
|
|
*/ |
|
|
|
|
public static function isStudentAnswerGood($studentAnswer, $correctAnswer, $fromDatabase = false) |
|
|
|
|
{ |
|
|
|
|
public static function isStudentAnswerGood( |
|
|
|
|
string $studentAnswer, |
|
|
|
|
string $correctAnswer, |
|
|
|
|
bool $fromDatabase = false, |
|
|
|
|
bool $studentAnswerIsHash = false |
|
|
|
|
): bool { |
|
|
|
|
$result = false; |
|
|
|
|
switch (self::getFillTheBlankAnswerType($correctAnswer)) { |
|
|
|
|
case self::FILL_THE_BLANK_MENU: |
|
|
|
|
@ -701,7 +706,10 @@ class FillBlanks extends Question |
|
|
|
|
$item = $listMenu[0]; |
|
|
|
|
if (!$fromDatabase) { |
|
|
|
|
$item = sha1($item); |
|
|
|
|
$studentAnswer = sha1($studentAnswer); |
|
|
|
|
|
|
|
|
|
if (!$studentAnswerIsHash) { |
|
|
|
|
$studentAnswer = sha1($studentAnswer); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if ($item === $studentAnswer) { |
|
|
|
|
$result = true; |
|
|
|
|
|