public static function get_all_scores($order = "user_scores.date_achieved DESC", $extra_conditions = "") { return User_score::all(array('select' => 'user_scores.*, users.username as username, users.display_name as display_name, ranked_files.pack_id as pack_id, ranked_files.stamina_file as stamina_file, ranked_files.file_type as file_type, ranked_files.title as title, ranked_files.subtitle as subtitle, ranked_files.artist as artist, ranked_files.rate as file_rate, ranked_files.length as length, ranked_files.dance_points as total_dance_points, ranked_files.taps as file_taps, ranked_files.holds as file_holds, ranked_files.mines as file_mines, ranked_files.difficulty_score as difficulty_score, packs.name as pack_name, packs.abbreviation as pack_abbreviation', 'conditions' => '(status = "approved" OR status = "below_aa") ' . $extra_conditions . ' AND ranked_files.id IS NOT NULL', 'joins' => array('LEFT JOIN users ON users.id = user_scores.user_id', 'LEFT JOIN ranked_files ON ranked_files.id = user_scores.file_id', 'LEFT JOIN packs ON ranked_files.pack_id = packs.id'), 'order' => $order)); }
function delete_chart($chart_id) { if (Ranked_file::count(array('conditions' => array('id = ?', $chart_id))) != 1) { redirect('home'); } $this->content_view = "mod/delete_chart_success"; $chart = Ranked_file::find($chart_id); $title = $chart->title; $diff = $chart->difficulty_score; $rate = $chart->rate; $chart->delete(); $scores = User_score::all(array('conditions' => array('file_id = ?', $chart_id))); foreach ($scores as $score) { $score->status = "removed"; $score->save(); } $log_string = $this->session->userdata('username') . " (" . $this->session->userdata('display_name') . ") deleted chart: " . $title . " " . number_format($rate, 1) . "x " . " - " . $diff; write_to_mod_log($log_string); }