From 2627e43e2601feb5a5322d4769dc5b212f25b8c8 Mon Sep 17 00:00:00 2001 From: Ari Timonen Date: Mon, 30 Mar 2020 02:17:34 +0300 Subject: [PATCH] Fix random things Add users to adminpanel, cleanup routes, remove byebugs --- app/controllers/challenges_controller.rb | 18 ++++++++++-------- app/models/user.rb | 1 - app/views/about/adminpanel.html.erb | 1 + config/routes.rb | 8 +++++--- docker-compose.dev.yml | 3 ++- 5 files changed, 18 insertions(+), 13 deletions(-) diff --git a/app/controllers/challenges_controller.rb b/app/controllers/challenges_controller.rb index 5fae970..90c116a 100644 --- a/app/controllers/challenges_controller.rb +++ b/app/controllers/challenges_controller.rb @@ -9,14 +9,6 @@ class ChallengesController < ApplicationController return_here end - def refresh - Challenge.past.pending.each do |c| - c.destroy - end - - render text: t(:challenges_cleared) - end - def new #No new challenges for now. raise AccessError @@ -69,6 +61,16 @@ class ChallengesController < ApplicationController render text: t(:challenges_cleared) end + # Custom method + + def refresh + Challenge.past.pending.each do |c| + c.destroy + end + + render text: t(:challenges_cleared) + end + private def get_challenge diff --git a/app/models/user.rb b/app/models/user.rb index 45a747a..b73772d 100755 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -296,7 +296,6 @@ class User < ActiveRecord::Base # FIXME: if team has been removed def validate_team if team and !active_teams.exists?({:id => team.id}) - byebug self.team = nil self.save! errors.add :team diff --git a/app/views/about/adminpanel.html.erb b/app/views/about/adminpanel.html.erb index 783df4d..997a4a5 100644 --- a/app/views/about/adminpanel.html.erb +++ b/app/views/about/adminpanel.html.erb @@ -20,6 +20,7 @@
  • <%= link_to "Contests", contests_path %>
  • <%= link_to "Challenges", challenges_path %>
  • <%= link_to "Maps", maps_path %>
  • +
  • <%= link_to "Users", users_path %>
  • <%= link_to "Custom Article URLs", custom_urls_path %>
  • \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 661d395..2fd88ab 100755 --- a/config/routes.rb +++ b/config/routes.rb @@ -60,7 +60,11 @@ Ensl::Application.routes.draw do end end resources :locks - resources :contesters + resources :contesters do + collection do + get :recalc + end + end get "contests/:id/confirmedmatches" => "contests#confirmed_matches", as: :confirmed_matches resources :contests @@ -113,8 +117,6 @@ Ensl::Application.routes.draw do get 'data_files/delFile' get 'data_files/trash' - get 'contesters/recalc' - get 'directories', to: "directories#show", id: 1 get 'gathers/refresh' diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index 7ef8abd..c88ddbf 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -5,8 +5,9 @@ services: command: "bundle exec puma" tty: true stdin_open: true + # NOtE: Use attach rather than this # Debug - #command: /bin/bash + # command: /bin/bash container_name: ensl_dev build: context: ./