Code Duplication    Length = 14-15 lines in 2 locations

main/inc/lib/skill.lib.php 1 location

@@ 1215-1228 (lines=14) @@
1212
     * @param int $user_id
1213
     * @return bool
1214
     */
1215
    public function get_user_skill_ranking($user_id)
1216
    {
1217
        $user_id = intval($user_id);
1218
        $sql = "SELECT count(skill_id) count FROM {$this->table} s
1219
                INNER JOIN {$this->table_skill_rel_user} su
1220
                ON (s.id = su.skill_id)
1221
                WHERE user_id = $user_id";
1222
        $result  = Database::query($sql);
1223
        if (Database::num_rows($result)) {
1224
            $result = Database::fetch_row($result);
1225
            return $result[0];
1226
        }
1227
        return false;
1228
    }
1229
1230
    /**
1231
     * @param $start

main/exercise/exercise.class.php 1 location

@@ 6454-6468 (lines=15) @@
6451
    /**
6452
     * Get total number of question that will be parsed when using the category/exercise
6453
     */
6454
    public function getNumberQuestionExerciseCategory()
6455
    {
6456
        $table = Database::get_course_table(TABLE_QUIZ_REL_CATEGORY);
6457
        if (!empty($this->id)) {
6458
            $sql = "SELECT SUM(count_questions) count_questions
6459
                    FROM $table
6460
                    WHERE exercise_id = {$this->id} AND c_id = {$this->course_id}";
6461
            $result = Database::query($sql);
6462
            if (Database::num_rows($result)) {
6463
                $row = Database::fetch_array($result);
6464
                return $row['count_questions'];
6465
            }
6466
        }
6467
        return 0;
6468
    }
6469
6470
    /**
6471
     * Save categories in the TABLE_QUIZ_REL_CATEGORY table