Code Duplication    Length = 23-23 lines in 2 locations

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

@@ 674-696 (lines=23) @@
671
     * @param integer $questionWeighting
672
     * @return integer db response
673
     */
674
    public function processUniqueAnswer($objAnswer, $answerValues, $position, &$questionWeighting)
675
    {
676
        $correct = intval($answerValues['fraction']) ? intval($answerValues['fraction']) : 0;
677
        $answer = $answerValues['answertext'];
678
        $comment = $answerValues['feedback'];
679
        $weighting = $answerValues['fraction'];
680
        $weighting = abs($weighting);
681
        if ($weighting > 0) {
682
            $questionWeighting += $weighting;
683
        }
684
        $goodAnswer =  $correct ? true : false;
685
686
        $objAnswer->createAnswer(
687
            $answer,
688
            $goodAnswer,
689
            $comment,
690
            $weighting,
691
            $position,
692
            null,
693
            null,
694
            ''
695
        );
696
    }
697
698
    /**
699
     * Process Chamilo True False
@@ 707-729 (lines=23) @@
704
     * @param integer $questionWeighting
705
     * @return integer db response
706
     */
707
    public function processTrueFalse($objAnswer, $answerValues, $position, &$questionWeighting)
708
    {
709
        $correct = intval($answerValues['fraction']) ? intval($answerValues['fraction']) : 0;
710
        $answer = $answerValues['answertext'];
711
        $comment = $answerValues['feedback'];
712
        $weighting = $answerValues['fraction'];
713
        $weighting = abs($weighting);
714
        if ($weighting > 0) {
715
            $questionWeighting += $weighting;
716
        }
717
        $goodAnswer =  $correct ? true : false;
718
719
        $objAnswer->createAnswer(
720
            $answer,
721
            $goodAnswer,
722
            $comment,
723
            $weighting,
724
            $position,
725
            null,
726
            null,
727
            ''
728
        );
729
    }
730
731
    /**
732
     * Process Chamilo FillBlanks