Show More
Commit Description:
fig bugs in login report
Commit Description:
fig bugs in login report
References:
File last commit:
Show/Diff file:
Action:
app/controllers/contest_management_controller.rb
| 50 lines
| 1.2 KiB
| text/x-ruby
| RubyLexer
|
|
r266 | class ContestManagementController < ApplicationController | ||
r745 | before_action :admin_authorization | |||
|
r266 | |||
def index | ||||
|
r267 | @num_contests = Contest.count() | ||
|
r266 | end | ||
def user_stat | ||||
|
r320 | if not GraderConfiguration.indv_contest_mode? | ||
|
r266 | redirect_to :action => 'index' and return | ||
end | ||||
r619 | @users = User.all | |||
|
r266 | @start_times = {} | ||
r619 | UserContestStat.all.each do |stat| | |||
|
r266 | @start_times[stat.user_id] = stat.started_at | ||
end | ||||
end | ||||
def clear_stat | ||||
user = User.find(params[:id]) | ||||
if user.contest_stat!=nil | ||||
user.contest_stat.destroy | ||||
end | ||||
redirect_to :action => 'user_stat' | ||||
end | ||||
def clear_all_stat | ||||
|
r320 | if not GraderConfiguration.indv_contest_mode? | ||
|
r266 | redirect_to :action => 'index' and return | ||
end | ||||
UserContestStat.delete_all() | ||||
flash[:notice] = 'All start time statistic cleared.' | ||||
redirect_to :action => 'index' | ||||
end | ||||
|
r267 | def change_contest_mode | ||
|
r369 | if ['standard', 'contest', 'indv-contest', 'analysis'].include? params[:id] | ||
|
r320 | config = GraderConfiguration.find_by_key('system.mode') | ||
|
r267 | config.value = params[:id] | ||
config.save | ||||
else | ||||
flash[:notice] = 'Wrong contest mode value' | ||||
end | ||||
redirect_to :action => 'index' | ||||
end | ||||
|
r266 | end | ||