diff --git a/app/controllers/contests_controller.rb b/app/controllers/contests_controller.rb --- a/app/controllers/contests_controller.rb +++ b/app/controllers/contests_controller.rb @@ -17,6 +17,14 @@ 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 if not Configuration.indv_contest_mode? redirect_to :action => 'index' and return diff --git a/app/models/user.rb b/app/models/user.rb --- a/app/models/user.rb +++ b/app/models/user.rb @@ -20,7 +20,7 @@ has_many :test_pair_assignments, :dependent => :delete_all has_many :submission_statuses - has_one :contest_stat, :class_name => "UserContestStat" + has_one :contest_stat, :class_name => "UserContestStat", :dependent => :destroy belongs_to :site belongs_to :country