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

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