Description:
Merge pull request #19 from nattee/master
upstream merge from nattee/cafe-grader-web
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r717:6d7ccf388baa - - 10 files changed: 12 inserted, 12 deleted
@@ -225,7 +225,7 | |||||
|
225 | @by_lang[lang.pretty_name][:memory] = { avail: true, user_id: sub.user_id, value: sub.peak_memory, sub_id: sub.id } |
|
225 | @by_lang[lang.pretty_name][:memory] = { avail: true, user_id: sub.user_id, value: sub.peak_memory, sub_id: sub.id } |
|
226 | end |
|
226 | end |
|
227 |
|
227 | ||
|
228 | - if sub.submitted_at and sub.submitted_at < @by_lang[lang.pretty_name][:first][:value] and |
|
228 | + if sub.submitted_at and sub.submitted_at < @by_lang[lang.pretty_name][:first][:value] and sub.user and |
|
229 | !sub.user.admin? |
|
229 | !sub.user.admin? |
|
230 | @by_lang[lang.pretty_name][:first] = { avail: true, user_id: sub.user_id, value: sub.submitted_at, sub_id: sub.id } |
|
230 | @by_lang[lang.pretty_name][:first] = { avail: true, user_id: sub.user_id, value: sub.submitted_at, sub_id: sub.id } |
|
231 | end |
|
231 | end |
@@ -111,7 +111,8 | |||||
|
111 |
|
111 | ||
|
112 | def stat |
|
112 | def stat |
|
113 | @user = User.find(params[:id]) |
|
113 | @user = User.find(params[:id]) |
|
114 |
- @submission = Submission.in |
|
114 | + @submission = Submission.joins(:problem).where(user_id: params[:id]) |
|
|
115 | + @submission = @submission.where('problems.available = true') unless current_user.admin? | ||
|
115 |
|
116 | ||
|
116 | range = 120 |
|
117 | range = 120 |
|
117 | @histogram = { data: Array.new(range,0), summary: {} } |
|
118 | @histogram = { data: Array.new(range,0), summary: {} } |
@@ -3,7 +3,7 | |||||
|
3 | add_column :languages, :ext, :string, :limit => 10 |
|
3 | add_column :languages, :ext, :string, :limit => 10 |
|
4 |
|
4 | ||
|
5 | Language.reset_column_information |
|
5 | Language.reset_column_information |
|
6 |
- langs = Language. |
|
6 | + langs = Language.all |
|
7 | langs.each do |l| |
|
7 | langs.each do |l| |
|
8 | l.ext = l.name |
|
8 | l.ext = l.name |
|
9 | l.save |
|
9 | l.save |
@@ -4,7 +4,7 | |||||
|
4 | add_column :tasks, :updated_at, :datetime |
|
4 | add_column :tasks, :updated_at, :datetime |
|
5 |
|
5 | ||
|
6 | Task.reset_column_information |
|
6 | Task.reset_column_information |
|
7 |
- Task. |
|
7 | + Task.all.each do |task| |
|
8 | task.status_complete |
|
8 | task.status_complete |
|
9 | task.save |
|
9 | task.save |
|
10 | end |
|
10 | end |
@@ -9,8 +9,7 | |||||
|
9 | last_problem_id = nil |
|
9 | last_problem_id = nil |
|
10 | current_number = 0 |
|
10 | current_number = 0 |
|
11 |
|
11 | ||
|
12 | - Submission.find(:all, |
|
12 | + Submission.order('user_id, problem_id, submitted_at').each do |submission| |
|
13 | - :order => 'user_id, problem_id, submitted_at').each do |submission| |
|
||
|
14 | if submission.user_id==last_user_id and submission.problem_id==last_problem_id |
|
13 | if submission.user_id==last_user_id and submission.problem_id==last_problem_id |
|
15 | current_number += 1 |
|
14 | current_number += 1 |
|
16 | else |
|
15 | else |
@@ -7,7 +7,7 | |||||
|
7 | add_column :users, :site_id, :integer |
|
7 | add_column :users, :site_id, :integer |
|
8 | User.reset_column_information |
|
8 | User.reset_column_information |
|
9 |
|
9 | ||
|
10 |
- User. |
|
10 | + User.all.each do |user| |
|
11 |
|
11 | ||
|
12 | class << user |
|
12 | class << user |
|
13 | def valid? |
|
13 | def valid? |
@@ -3,7 +3,7 | |||||
|
3 | add_column :problems, :description_id, :integer |
|
3 | add_column :problems, :description_id, :integer |
|
4 | Problem.reset_column_information |
|
4 | Problem.reset_column_information |
|
5 |
|
5 | ||
|
6 |
- Problem. |
|
6 | + Problem.all.each do |problem| |
|
7 | if problem.body!=nil |
|
7 | if problem.body!=nil |
|
8 | description = Description.new |
|
8 | description = Description.new |
|
9 | description.body = problem.body |
|
9 | description.body = problem.body |
@@ -21,7 +21,7 | |||||
|
21 | add_column :problems, :body, :text |
|
21 | add_column :problems, :body, :text |
|
22 | Problem.reset_column_information |
|
22 | Problem.reset_column_information |
|
23 |
|
23 | ||
|
24 |
- Problem. |
|
24 | + Problem.all.each do |problem| |
|
25 | if problem.description_id != nil |
|
25 | if problem.description_id != nil |
|
26 | problem.body = Description.find(problem.description_id).body |
|
26 | problem.body = Description.find(problem.description_id).body |
|
27 | problem.save |
|
27 | problem.save |
@@ -3,7 +3,7 | |||||
|
3 | add_column :problems, :test_allowed, :boolean |
|
3 | add_column :problems, :test_allowed, :boolean |
|
4 | Problem.reset_column_information |
|
4 | Problem.reset_column_information |
|
5 |
|
5 | ||
|
6 |
- Problem. |
|
6 | + Problem.all.each do |problem| |
|
7 | problem.test_allowed = true |
|
7 | problem.test_allowed = true |
|
8 | problem.save |
|
8 | problem.save |
|
9 | end |
|
9 | end |
@@ -4,7 +4,7 | |||||
|
4 |
|
4 | ||
|
5 | User.reset_column_information |
|
5 | User.reset_column_information |
|
6 |
|
6 | ||
|
7 |
- User. |
|
7 | + User.all.each do |user| |
|
8 |
|
8 | ||
|
9 | # disable validation |
|
9 | # disable validation |
|
10 | class <<user |
|
10 | class <<user |
@@ -11,7 +11,7 | |||||
|
11 | 'cpp' => 'cpp,cc', |
|
11 | 'cpp' => 'cpp,cc', |
|
12 | 'pas' => 'pas' |
|
12 | 'pas' => 'pas' |
|
13 | } |
|
13 | } |
|
14 |
- Language. |
|
14 | + Language.all.each do |lang| |
|
15 | lang.common_ext = common_ext[lang.name] |
|
15 | lang.common_ext = common_ext[lang.name] |
|
16 | lang.save |
|
16 | lang.save |
|
17 | end |
|
17 | end |
You need to be logged in to leave comments.
Login now