Code Duplication    Length = 23-23 lines in 2 locations

main/inc/lib/MoodleImport.class.php 2 locations

@@ 717-739 (lines=23) @@
714
     * @param integer $questionWeighting
715
     * @return integer db response
716
     */
717
    public function processUniqueAnswer($objAnswer, $answerValues, $position, &$questionWeighting)
718
    {
719
        $correct = intval($answerValues['fraction']) ? intval($answerValues['fraction']) : 0;
720
        $answer = $answerValues['answertext'];
721
        $comment = $answerValues['feedback'];
722
        $weighting = $answerValues['fraction'];
723
        $weighting = abs($weighting);
724
        if ($weighting > 0) {
725
            $questionWeighting += $weighting;
726
        }
727
        $goodAnswer =  $correct ? true : false;
728
729
        $objAnswer->createAnswer(
730
            $answer,
731
            $goodAnswer,
732
            $comment,
733
            $weighting,
734
            $position,
735
            null,
736
            null,
737
            ''
738
        );
739
    }
740
741
    /**
742
     * Process Chamilo True False
@@ 750-772 (lines=23) @@
747
     * @param integer $questionWeighting
748
     * @return integer db response
749
     */
750
    public function processTrueFalse($objAnswer, $answerValues, $position, &$questionWeighting)
751
    {
752
        $correct = intval($answerValues['fraction']) ? intval($answerValues['fraction']) : 0;
753
        $answer = $answerValues['answertext'];
754
        $comment = $answerValues['feedback'];
755
        $weighting = $answerValues['fraction'];
756
        $weighting = abs($weighting);
757
        if ($weighting > 0) {
758
            $questionWeighting += $weighting;
759
        }
760
        $goodAnswer =  $correct ? true : false;
761
762
        $objAnswer->createAnswer(
763
            $answer,
764
            $goodAnswer,
765
            $comment,
766
            $weighting,
767
            $position,
768
            null,
769
            null,
770
            ''
771
        );
772
    }
773
774
    /**
775
     * Process Chamilo FillBlanks