Description:
- clean up link to problem stat and user stat
(grafted from 45d1e12e9794a23a5431222fe2f4c7461d73a529)
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r657:c28f8e937d0d - - 6 files changed: 15 inserted, 13 deleted
@@ -100,25 +100,25 | |||||
|
100 | else |
|
100 | else |
|
101 | user.password = user.password_confirmation = User.random_password |
|
101 | user.password = user.password_confirmation = User.random_password |
|
102 | user.save |
|
102 | user.save |
|
103 | send_new_password_email(user) |
|
103 | send_new_password_email(user) |
|
104 | flash[:notice] = 'New password has been mailed to you.' |
|
104 | flash[:notice] = 'New password has been mailed to you.' |
|
105 | end |
|
105 | end |
|
106 | else |
|
106 | else |
|
107 | flash[:notice] = I18n.t 'registration.password_retrieval.no_email' |
|
107 | flash[:notice] = I18n.t 'registration.password_retrieval.no_email' |
|
108 | end |
|
108 | end |
|
109 | redirect_to :action => 'forget' |
|
109 | redirect_to :action => 'forget' |
|
110 | end |
|
110 | end |
|
111 |
|
111 | ||
|
112 | - def profile |
|
112 | + def stat |
|
113 | @user = User.find(params[:id]) |
|
113 | @user = User.find(params[:id]) |
|
114 | @submission = Submission.includes(:problem).where(user_id: params[:id]) |
|
114 | @submission = Submission.includes(:problem).where(user_id: params[:id]) |
|
115 |
|
115 | ||
|
116 | range = 120 |
|
116 | range = 120 |
|
117 | @histogram = { data: Array.new(range,0), summary: {} } |
|
117 | @histogram = { data: Array.new(range,0), summary: {} } |
|
118 | @summary = {count: 0, solve: 0, attempt: 0} |
|
118 | @summary = {count: 0, solve: 0, attempt: 0} |
|
119 | problem = Hash.new(0) |
|
119 | problem = Hash.new(0) |
|
120 |
|
120 | ||
|
121 | @submission.find_each do |sub| |
|
121 | @submission.find_each do |sub| |
|
122 | #histogram |
|
122 | #histogram |
|
123 | d = (DateTime.now.in_time_zone - sub.submitted_at) / 24 / 60 / 60 |
|
123 | d = (DateTime.now.in_time_zone - sub.submitted_at) / 24 / 60 / 60 |
|
124 | @histogram[:data][d.to_i] += 1 if d < range |
|
124 | @histogram[:data][d.to_i] += 1 if d < range |
@@ -44,39 +44,39 | |||||
|
44 | %h2 Last 20 submissions |
|
44 | %h2 Last 20 submissions |
|
45 | %table.table.table-striped.table-condensed |
|
45 | %table.table.table-striped.table-condensed |
|
46 | %thead |
|
46 | %thead |
|
47 | %th ID |
|
47 | %th ID |
|
48 | %th User |
|
48 | %th User |
|
49 | %th Problem |
|
49 | %th Problem |
|
50 | %th Submitted |
|
50 | %th Submitted |
|
51 | %th Graded |
|
51 | %th Graded |
|
52 | %th Result |
|
52 | %th Result |
|
53 | %tbody |
|
53 | %tbody |
|
54 | - @submission.each do |sub| |
|
54 | - @submission.each do |sub| |
|
55 | %tr.inactive |
|
55 | %tr.inactive |
|
56 |
- %td= link_to sub.id, |
|
56 | + %td= link_to sub.id, submission_path(sub.id) |
|
57 | - %td= sub.try(:user).try(:full_name) |
|
57 | + %td= link_to sub.try(:user).try(:full_name), stat_user_path(sub.user.id) |
|
58 | - %td= sub.try(:problem).try(:full_name) |
|
58 | + %td= link_to sub.try(:problem).try(:full_name), stat_problem_path(sub.problem.id) |
|
59 | %td= "#{time_ago_in_words(sub.submitted_at)} ago" |
|
59 | %td= "#{time_ago_in_words(sub.submitted_at)} ago" |
|
60 | %td= sub.graded_at ? "#{time_ago_in_words(sub.graded_at)} ago" : " " |
|
60 | %td= sub.graded_at ? "#{time_ago_in_words(sub.graded_at)} ago" : " " |
|
61 | %td= sub.grader_comment |
|
61 | %td= sub.grader_comment |
|
62 | %h2 Ungraded submission |
|
62 | %h2 Ungraded submission |
|
63 | %table.table.table-striped.table-condensed |
|
63 | %table.table.table-striped.table-condensed |
|
64 | %thead |
|
64 | %thead |
|
65 | %th ID |
|
65 | %th ID |
|
66 | %th User |
|
66 | %th User |
|
67 | %th Problem |
|
67 | %th Problem |
|
68 | %th Submitted |
|
68 | %th Submitted |
|
69 | %th Graded |
|
69 | %th Graded |
|
70 | %th Result |
|
70 | %th Result |
|
71 | %tbody |
|
71 | %tbody |
|
72 | - @backlog_submission.each do |sub| |
|
72 | - @backlog_submission.each do |sub| |
|
73 | %tr.inactive |
|
73 | %tr.inactive |
|
74 |
- %td= link_to sub.id, |
|
74 | + %td= link_to sub.id, submission_path(sub.id) |
|
75 | - %td= sub.try(:user).try(:full_name) |
|
75 | + %td= link_to sub.try(:user).try(:full_name), stat_user_path(sub.user.id) |
|
76 | - %td= sub.try(:problem).try(:full_name) |
|
76 | + %td= link_to sub.try(:problem).try(:full_name), stat_problem_path(sub.problem.id) |
|
77 | %td= "#{time_ago_in_words(sub.submitted_at)} ago" |
|
77 | %td= "#{time_ago_in_words(sub.submitted_at)} ago" |
|
78 | %td= sub.graded_at ? "#{time_ago_in_words(sub.graded_at)} ago" : " " |
|
78 | %td= sub.graded_at ? "#{time_ago_in_words(sub.graded_at)} ago" : " " |
|
79 | %td= sub.grader_comment |
|
79 | %td= sub.grader_comment |
|
80 |
|
80 | ||
|
81 |
|
81 | ||
|
82 |
|
82 |
@@ -32,22 +32,22 | |||||
|
32 | %th Login |
|
32 | %th Login |
|
33 | %th Name |
|
33 | %th Name |
|
34 | %th Submitted_at |
|
34 | %th Submitted_at |
|
35 | %th Points |
|
35 | %th Points |
|
36 | %th comment |
|
36 | %th comment |
|
37 | %th IP |
|
37 | %th IP |
|
38 | %tbody |
|
38 | %tbody |
|
39 | - row_odd,curr = true,'' |
|
39 | - row_odd,curr = true,'' |
|
40 | - @submissions.each do |sub| |
|
40 | - @submissions.each do |sub| |
|
41 | - next unless sub.user |
|
41 | - next unless sub.user |
|
42 | - row_odd,curr = !row_odd, sub.user if curr != sub.user |
|
42 | - row_odd,curr = !row_odd, sub.user if curr != sub.user |
|
43 | %tr{class: row_odd ? "info-odd" : "info-even"} |
|
43 | %tr{class: row_odd ? "info-odd" : "info-even"} |
|
44 |
- %td= link_to sub.id, |
|
44 | + %td= link_to sub.id, submission_path(sub) |
|
45 |
- %td= link_to sub.user.login, |
|
45 | + %td= link_to sub.user.login, stat_user_path(sub.user) |
|
46 | %td= sub.user.full_name |
|
46 | %td= sub.user.full_name |
|
47 | %td= time_ago_in_words(sub.submitted_at) + " ago" |
|
47 | %td= time_ago_in_words(sub.submitted_at) + " ago" |
|
48 | %td= sub.points |
|
48 | %td= sub.points |
|
49 | %td.fix-width= sub.grader_comment |
|
49 | %td.fix-width= sub.grader_comment |
|
50 | %td= sub.ip_address |
|
50 | %td= sub.ip_address |
|
51 | - else |
|
51 | - else |
|
52 | No submission |
|
52 | No submission |
|
53 |
|
53 |
@@ -20,34 +20,34 | |||||
|
20 | e.setOptions({ maxLines: Infinity }) |
|
20 | e.setOptions({ maxLines: Infinity }) |
|
21 | e.setValue($("#data").text()) |
|
21 | e.setValue($("#data").text()) |
|
22 | e.gotoLine(1) |
|
22 | e.gotoLine(1) |
|
23 | e.getSession().setMode("#{get_ace_mode(@submission.language)}") |
|
23 | e.getSession().setMode("#{get_ace_mode(@submission.language)}") |
|
24 | e.setReadOnly(true) |
|
24 | e.setReadOnly(true) |
|
25 | .col-md-5 |
|
25 | .col-md-5 |
|
26 | %table.table.table-striped |
|
26 | %table.table.table-striped |
|
27 | %tr |
|
27 | %tr |
|
28 | %td.text-right |
|
28 | %td.text-right |
|
29 | %strong User |
|
29 | %strong User |
|
30 | %td |
|
30 | %td |
|
31 | - if @submission.user |
|
31 | - if @submission.user |
|
32 |
- = link_to " |
|
32 | + = link_to "#{@submission.user.login}", stat_user_path(@submission.user) |
|
33 | = @submission.user.full_name |
|
33 | = @submission.user.full_name |
|
34 | - else |
|
34 | - else |
|
35 | = "(n/a)" |
|
35 | = "(n/a)" |
|
36 | %tr |
|
36 | %tr |
|
37 | %td.text-right |
|
37 | %td.text-right |
|
38 | %strong Task |
|
38 | %strong Task |
|
39 | %td |
|
39 | %td |
|
40 | - if @submission.problem!=nil |
|
40 | - if @submission.problem!=nil |
|
41 |
- = link_to " |
|
41 | + = link_to "[#{@submission.problem.name}]", stat_problem_path(@submission.problem) |
|
42 | = @submission.problem.full_name |
|
42 | = @submission.problem.full_name |
|
43 | - else |
|
43 | - else |
|
44 | = "(n/a)" |
|
44 | = "(n/a)" |
|
45 | %tr |
|
45 | %tr |
|
46 | %td.text-right |
|
46 | %td.text-right |
|
47 | %strong Tries |
|
47 | %strong Tries |
|
48 | %td= @submission.number |
|
48 | %td= @submission.number |
|
49 | %tr |
|
49 | %tr |
|
50 | %td.text-right |
|
50 | %td.text-right |
|
51 | %strong Language |
|
51 | %strong Language |
|
52 | %td= @submission.language.pretty_name |
|
52 | %td= @submission.language.pretty_name |
|
53 | %tr |
|
53 | %tr |
@@ -43,24 +43,24 | |||||
|
43 | %th Problem code |
|
43 | %th Problem code |
|
44 | %th Problem full name |
|
44 | %th Problem full name |
|
45 | %th Language |
|
45 | %th Language |
|
46 | %th Submitted at |
|
46 | %th Submitted at |
|
47 | %th Result |
|
47 | %th Result |
|
48 | %th Score |
|
48 | %th Score |
|
49 | - if session[:admin] |
|
49 | - if session[:admin] |
|
50 | %th IP |
|
50 | %th IP |
|
51 | %tbody |
|
51 | %tbody |
|
52 | - @submission.each do |s| |
|
52 | - @submission.each do |s| |
|
53 | - next unless s.problem |
|
53 | - next unless s.problem |
|
54 | %tr |
|
54 | %tr |
|
55 | - %td= link_to "#{s.id}", controller: "graders", action: "submission", id: s.id |
|
55 | + %td= link_to s.id, submission_path(s) |
|
56 |
- %td= link_to s.problem.name, |
|
56 | + %td= link_to s.problem.name, stat_problem_path(s.problem) |
|
57 | %td= s.problem.full_name |
|
57 | %td= s.problem.full_name |
|
58 | %td= s.language.pretty_name |
|
58 | %td= s.language.pretty_name |
|
59 | %td #{s.submitted_at.strftime('%Y-%m-%d %H:%M')} (#{time_ago_in_words(s.submitted_at)} ago) |
|
59 | %td #{s.submitted_at.strftime('%Y-%m-%d %H:%M')} (#{time_ago_in_words(s.submitted_at)} ago) |
|
60 | %td.fix-width= s.grader_comment |
|
60 | %td.fix-width= s.grader_comment |
|
61 | %td= ( s.try(:points) ? (s.points*100/s.problem.full_score) : '' ) |
|
61 | %td= ( s.try(:points) ? (s.points*100/s.problem.full_score) : '' ) |
|
62 | - if session[:admin] |
|
62 | - if session[:admin] |
|
63 | %td= s.ip_address |
|
63 | %td= s.ip_address |
|
64 |
|
64 | ||
|
65 |
|
65 | ||
|
66 |
|
66 |
@@ -8,38 +8,40 | |||||
|
8 | resources :sites |
|
8 | resources :sites |
|
9 |
|
9 | ||
|
10 | resources :announcements do |
|
10 | resources :announcements do |
|
11 | member do |
|
11 | member do |
|
12 | get 'toggle','toggle_front' |
|
12 | get 'toggle','toggle_front' |
|
13 | end |
|
13 | end |
|
14 | end |
|
14 | end |
|
15 |
|
15 | ||
|
16 | resources :problems do |
|
16 | resources :problems do |
|
17 | member do |
|
17 | member do |
|
18 | get 'toggle' |
|
18 | get 'toggle' |
|
19 | get 'toggle_test' |
|
19 | get 'toggle_test' |
|
|
20 | + get 'stat' | ||
|
20 | end |
|
21 | end |
|
21 | collection do |
|
22 | collection do |
|
22 | get 'turn_all_off' |
|
23 | get 'turn_all_off' |
|
23 | get 'turn_all_on' |
|
24 | get 'turn_all_on' |
|
24 | get 'import' |
|
25 | get 'import' |
|
25 | get 'manage' |
|
26 | get 'manage' |
|
26 | end |
|
27 | end |
|
27 | end |
|
28 | end |
|
28 |
|
29 | ||
|
29 | resources :grader_configuration, controller: 'configurations' |
|
30 | resources :grader_configuration, controller: 'configurations' |
|
30 |
|
31 | ||
|
31 | resources :users do |
|
32 | resources :users do |
|
32 | member do |
|
33 | member do |
|
33 | get 'toggle_activate', 'toggle_enable' |
|
34 | get 'toggle_activate', 'toggle_enable' |
|
|
35 | + get 'stat' | ||
|
34 | end |
|
36 | end |
|
35 | end |
|
37 | end |
|
36 |
|
38 | ||
|
37 | resources :submissions do |
|
39 | resources :submissions do |
|
38 | collection do |
|
40 | collection do |
|
39 | get 'prob/:problem_id', to: 'submissions#index', as: 'problem' |
|
41 | get 'prob/:problem_id', to: 'submissions#index', as: 'problem' |
|
40 | get 'direct_edit_problem/:problem_id', to: 'submissions#direct_edit_problem', as: 'direct_edit_problem' |
|
42 | get 'direct_edit_problem/:problem_id', to: 'submissions#direct_edit_problem', as: 'direct_edit_problem' |
|
41 | get 'get_latest_submission_status/:uid/:pid', to: 'submissions#get_latest_submission_status', as: 'get_latest_submission_status' |
|
43 | get 'get_latest_submission_status/:uid/:pid', to: 'submissions#get_latest_submission_status', as: 'get_latest_submission_status' |
|
42 | end |
|
44 | end |
|
43 | end |
|
45 | end |
|
44 |
|
46 | ||
|
45 | match 'tasks/view/:file.:ext' => 'tasks#view' |
|
47 | match 'tasks/view/:file.:ext' => 'tasks#view' |
You need to be logged in to leave comments.
Login now