Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cu 86cv2unwj manage case sensitive inputs #2594

Merged
merged 2 commits into from
Jun 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading