@@ -793,7 +793,7 @@ public static function manage_attempt_answers( $attempt_answers, $attempt, $atte
793793 $ is_answer_was_correct = false ;
794794 $ given_answer = '' ;
795795
796- if ( ' true_false ' === $ question_type || ' single_choice ' === $ question_type ) {
796+ if ( QuizModel:: QUESTION_TYPE_TRUE_FALSE === $ question_type || QuizModel:: QUESTION_TYPE_SINGLE_CHOICE === $ question_type ) {
797797 $ given_answer = $ answers ;
798798 $ is_answer_was_correct = (bool ) $ wpdb ->get_var (
799799 $ wpdb ->prepare (
@@ -805,7 +805,7 @@ public static function manage_attempt_answers( $attempt_answers, $attempt, $atte
805805 )
806806 );
807807
808- } elseif ( ' multiple_choice ' === $ question_type ) {
808+ } elseif ( QuizModel:: QUESTION_TYPE_MULTIPLE_CHOICE === $ question_type ) {
809809
810810 $ given_answer = (array ) ( $ answers );
811811 $ given_answer = array_filter ( $ given_answer , fn ( $ id ) => is_numeric ( $ id ) && intval ( $ id ) > 0 );
@@ -828,9 +828,10 @@ public static function manage_attempt_answers( $attempt_answers, $attempt, $atte
828828 if ( count ( array_diff ( $ get_original_answers , $ given_answer ) ) === 0 && count ( $ get_original_answers ) === count ( $ given_answer ) ) {
829829 $ is_answer_was_correct = true ;
830830 }
831- $ given_answer = maybe_serialize ( $ answers );
832831
833- } elseif ( 'fill_in_the_blank ' === $ question_type ) {
832+ $ given_answer = maybe_serialize ( $ given_answer );
833+
834+ } elseif ( QuizModel::QUESTION_TYPE_FILL_IN_THE_BLANK === $ question_type ) {
834835
835836 $ get_original_answer = $ wpdb ->get_row (
836837 $ wpdb ->prepare (
@@ -869,11 +870,11 @@ function ( $ans ) {
869870 if ( strtolower ( $ given_answer ) === strtolower ( $ gap_answer ) ) {
870871 $ is_answer_was_correct = true ;
871872 }
872- } elseif ( ' open_ended ' === $ question_type || ' short_answer ' === $ question_type ) {
873+ } elseif ( QuizModel:: QUESTION_TYPE_OPEN_ENDED === $ question_type || QuizModel:: QUESTION_TYPE_SHORT_ANSWER === $ question_type ) {
873874 $ review_required = true ;
874875 $ given_answer = wp_kses_post ( $ answers );
875876
876- } elseif ( ' ordering ' === $ question_type || ' matching ' === $ question_type || ' image_matching ' === $ question_type ) {
877+ } elseif ( QuizModel:: QUESTION_TYPE_ORDERING === $ question_type || QuizModel:: QUESTION_TYPE_MATCHING === $ question_type || QuizModel:: QUESTION_TYPE_IMAGE_MATCHING === $ question_type ) {
877878 $ answers = (array ) tutor_utils ()->avalue_dot ( 'answers ' , $ answers );
878879
879880 $ given_answer = (array ) array_map ( 'sanitize_text_field ' , $ answers );
@@ -897,7 +898,7 @@ function ( $ans ) {
897898 if ( maybe_serialize ( $ get_original_answers ) == $ given_answer ) {
898899 $ is_answer_was_correct = true ;
899900 }
900- } elseif ( ' image_answering ' === $ question_type ) {
901+ } elseif ( QuizModel:: QUESTION_TYPE_IMAGE_ANSWERING === $ question_type ) {
901902 $ image_inputs = tutor_utils ()->avalue_dot ( 'answer_id ' , $ answers );
902903 $ image_inputs = (array ) array_map ( 'sanitize_text_field ' , $ image_inputs );
903904 $ given_answer = maybe_serialize ( $ image_inputs );
@@ -963,7 +964,7 @@ function ( $ans ) {
963964 * Check if question_type open ended or short ans the set
964965 * is_correct default value null before saving
965966 */
966- if ( in_array ( $ question_type , array ( ' open_ended ' , ' short_answer ' , ' image_answering ' ) ) ) {
967+ if ( in_array ( $ question_type , QuizModel:: get_manual_review_types (), true ) ) {
967968 $ answers_data ['is_correct ' ] = null ;
968969 $ review_required = true ;
969970 }
@@ -1953,6 +1954,10 @@ public static function render_quiz_attempts( $quiz_id ) {
19531954 )
19541955 );
19551956 ?>
1957+
1958+ <div class="tutor-quiz-item-actions">
1959+ <?php $ quiz_attempt_obj ->render_details_button ( $ attempt , true ); ?>
1960+ </div>
19561961 </div>
19571962 <?php
19581963 }
0 commit comments