Description:
Merge branch 'master' into codejom (user stat reset)
Conflicts:
app/models/user.rb
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r248:0f32f3dd1054 - - 2 files changed: 9 inserted, 1 deleted
@@ -8,23 +8,31 | |||||
|
8 | def user_stat |
|
8 | def user_stat |
|
9 | if not Configuration.indv_contest_mode? |
|
9 | if not Configuration.indv_contest_mode? |
|
10 | redirect_to :action => 'index' and return |
|
10 | redirect_to :action => 'index' and return |
|
11 | end |
|
11 | end |
|
12 |
|
12 | ||
|
13 | @users = User.find(:all) |
|
13 | @users = User.find(:all) |
|
14 | @start_times = {} |
|
14 | @start_times = {} |
|
15 | UserContestStat.find(:all).each do |stat| |
|
15 | UserContestStat.find(:all).each do |stat| |
|
16 | @start_times[stat.user_id] = stat.started_at |
|
16 | @start_times[stat.user_id] = stat.started_at |
|
17 | end |
|
17 | end |
|
18 | end |
|
18 | end |
|
19 |
|
19 | ||
|
|
20 | + def clear_stat | ||
|
|
21 | + user = User.find(params[:id]) | ||
|
|
22 | + if user.contest_stat!=nil | ||
|
|
23 | + user.contest_stat.destroy | ||
|
|
24 | + end | ||
|
|
25 | + redirect_to :action => 'user_stat' | ||
|
|
26 | + end | ||
|
|
27 | + | ||
|
20 | def clear_all_stat |
|
28 | def clear_all_stat |
|
21 | if not Configuration.indv_contest_mode? |
|
29 | if not Configuration.indv_contest_mode? |
|
22 | redirect_to :action => 'index' and return |
|
30 | redirect_to :action => 'index' and return |
|
23 | end |
|
31 | end |
|
24 |
|
32 | ||
|
25 | UserContestStat.delete_all() |
|
33 | UserContestStat.delete_all() |
|
26 | flash[:notice] = 'All start time statistic cleared.' |
|
34 | flash[:notice] = 'All start time statistic cleared.' |
|
27 | redirect_to :action => 'index' |
|
35 | redirect_to :action => 'index' |
|
28 | end |
|
36 | end |
|
29 |
|
37 | ||
|
30 | end |
|
38 | end |
@@ -11,25 +11,25 | |||||
|
11 | :class_name => "Message", |
|
11 | :class_name => "Message", |
|
12 | :foreign_key => "sender_id", |
|
12 | :foreign_key => "sender_id", |
|
13 | :order => 'created_at DESC' |
|
13 | :order => 'created_at DESC' |
|
14 |
|
14 | ||
|
15 | has_many :replied_messages, |
|
15 | has_many :replied_messages, |
|
16 | :class_name => "Message", |
|
16 | :class_name => "Message", |
|
17 | :foreign_key => "receiver_id", |
|
17 | :foreign_key => "receiver_id", |
|
18 | :order => 'created_at DESC' |
|
18 | :order => 'created_at DESC' |
|
19 |
|
19 | ||
|
20 | has_many :test_pair_assignments, :dependent => :delete_all |
|
20 | has_many :test_pair_assignments, :dependent => :delete_all |
|
21 | has_many :submission_statuses |
|
21 | has_many :submission_statuses |
|
22 |
|
22 | ||
|
23 | - has_one :contest_stat, :class_name => "UserContestStat" |
|
23 | + has_one :contest_stat, :class_name => "UserContestStat", :dependent => :destroy |
|
24 |
|
24 | ||
|
25 | belongs_to :site |
|
25 | belongs_to :site |
|
26 | belongs_to :country |
|
26 | belongs_to :country |
|
27 |
|
27 | ||
|
28 | # For Code Jom |
|
28 | # For Code Jom |
|
29 | has_one :codejom_status |
|
29 | has_one :codejom_status |
|
30 |
|
30 | ||
|
31 | named_scope :activated_users, :conditions => {:activated => true} |
|
31 | named_scope :activated_users, :conditions => {:activated => true} |
|
32 |
|
32 | ||
|
33 | validates_presence_of :login |
|
33 | validates_presence_of :login |
|
34 | validates_uniqueness_of :login |
|
34 | validates_uniqueness_of :login |
|
35 | validates_format_of :login, :with => /^[\_A-Za-z0-9]+$/ |
|
35 | validates_format_of :login, :with => /^[\_A-Za-z0-9]+$/ |
You need to be logged in to leave comments.
Login now