Skip to content

Commit

Permalink
Merge pull request #2594 from QuizandSurveyMaster/CU-86cv2unwj-manage…
Browse files Browse the repository at this point in the history
…-case-sensitive-inputs

Cu 86cv2unwj manage case sensitive inputs
  • Loading branch information
zubairraeen committed Jun 27, 2024
2 parents 59c0079 + ba3b951 commit 69d576e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion php/admin/options-page-questions-tab.php
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ class="save-page-button button button-primary"><?php esc_html_e( 'Save Questions
'1' => __( 'Yes', 'quiz-master-next' ),
),
'default' => '0',
'show' => '14' . $show_case_sensitive,
'show' => '3, 5, 14' . $show_case_sensitive,
),
'limit_text' => array(
'heading' => __( 'Limit Text', 'quiz-master-next' ),
Expand Down
8 changes: 7 additions & 1 deletion php/classes/question-types/class-question-review-text.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,14 @@ public function set_user_answer() {
}

public function set_answer_status() {
global $mlwQuizMasterNext;
$case_sensitive = $mlwQuizMasterNext->pluginHelper->get_question_setting( $this->question_id, 'case_sensitive' );
$user_answer_value = $this->user_answer['input'];
$answer_key = array_search( $this->prepare_for_string_matching( $user_answer_value ), array_map( array( $this, 'prepare_for_string_matching' ), $this->correct_answer ), true );
if ( 1 === intval($case_sensitive ) ) {
$answer_key = array_search( $user_answer_value, $this->correct_answer, true );
}else {
$answer_key = array_search( $this->prepare_for_string_matching( $user_answer_value ), array_map( array( $this, 'prepare_for_string_matching' ), $this->correct_answer ), true );
}
if ( false !== $answer_key ) {
$this->answer_status = 'correct';
$this->points += $this->answer_array[ $answer_key ][1];
Expand Down

0 comments on commit 69d576e

Please sign in to comment.