Code Duplication    Length = 13-19 lines in 2 locations

includes/class-sensei-grading.php 1 location

@@ 612-624 (lines=13) @@
609
            $pass_required = get_post_meta( $quiz_id, '_pass_required', true );
610
            $quiz_passmark = abs( round( doubleval( get_post_meta( $quiz_id, '_quiz_passmark', true ) ), 2 ) );
611
            $lesson_metadata = array();
612
            if ( $pass_required ) {
613
                // Student has reached the pass mark and lesson is complete
614
                if ( $quiz_passmark <= $grade ) {
615
                    $lesson_status = 'passed';
616
                }
617
                else {
618
                    $lesson_status = 'failed';
619
                } // End If Statement
620
            }
621
            // Student only has to partake the quiz
622
            else {
623
                $lesson_status = 'graded';
624
            }
625
            $lesson_metadata['grade'] = $grade; // Technically already set as part of "WooThemes_Sensei_Utils::sensei_grade_quiz()" above
626
627
            Sensei_Utils::update_lesson_status( $user_id, $quiz_lesson_id, $lesson_status, $lesson_metadata );

includes/class-sensei-quiz.php 1 location

@@ 590-608 (lines=19) @@
587
         if ('auto' == $quiz_grade_type && ! is_wp_error( $grade )  ) {
588
589
             // Quiz has been automatically Graded
590
             if ( 'on' == $pass_required ) {
591
592
                 // Student has reached the pass mark and lesson is complete
593
                 if ( $quiz_pass_percentage <= $grade ) {
594
595
                     $lesson_status = 'passed';
596
597
                 } else {
598
599
                     $lesson_status = 'failed';
600
601
                 } // End If Statement
602
603
             } else {
604
605
                 // Student only has to partake the quiz
606
                 $lesson_status = 'graded';
607
608
             }
609
610
             $lesson_metadata['grade'] = $grade; // Technically already set as part of "WooThemes_Sensei_Utils::sensei_grade_quiz_auto()" above
611