diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -109,7 +109,7 @@ redirect_to :action => 'forget' end - def profile + def stat @user = User.find(params[:id]) @submission = Submission.includes(:problem).where(user_id: params[:id]) diff --git a/app/views/graders/list.html.haml b/app/views/graders/list.html.haml --- a/app/views/graders/list.html.haml +++ b/app/views/graders/list.html.haml @@ -53,9 +53,9 @@ %tbody - @submission.each do |sub| %tr.inactive - %td= link_to sub.id, controller: 'graders' ,action: 'submission', id: sub.id - %td= sub.try(:user).try(:full_name) - %td= sub.try(:problem).try(:full_name) + %td= link_to sub.id, submission_path(sub.id) + %td= link_to sub.try(:user).try(:full_name), stat_user_path(sub.user.id) + %td= link_to sub.try(:problem).try(:full_name), stat_problem_path(sub.problem.id) %td= "#{time_ago_in_words(sub.submitted_at)} ago" %td= sub.graded_at ? "#{time_ago_in_words(sub.graded_at)} ago" : " " %td= sub.grader_comment @@ -71,9 +71,9 @@ %tbody - @backlog_submission.each do |sub| %tr.inactive - %td= link_to sub.id, controller: 'graders' ,action: 'submission', id: sub.id - %td= sub.try(:user).try(:full_name) - %td= sub.try(:problem).try(:full_name) + %td= link_to sub.id, submission_path(sub.id) + %td= link_to sub.try(:user).try(:full_name), stat_user_path(sub.user.id) + %td= link_to sub.try(:problem).try(:full_name), stat_problem_path(sub.problem.id) %td= "#{time_ago_in_words(sub.submitted_at)} ago" %td= sub.graded_at ? "#{time_ago_in_words(sub.graded_at)} ago" : " " %td= sub.grader_comment diff --git a/app/views/problems/stat.html.haml b/app/views/problems/stat.html.haml --- a/app/views/problems/stat.html.haml +++ b/app/views/problems/stat.html.haml @@ -41,8 +41,8 @@ - next unless sub.user - row_odd,curr = !row_odd, sub.user if curr != sub.user %tr{class: row_odd ? "info-odd" : "info-even"} - %td= link_to sub.id, controller: 'graders', action: 'submission', id: sub.id - %td= link_to sub.user.login, controller: :users, action: :profile, id: sub.user.id + %td= link_to sub.id, submission_path(sub) + %td= link_to sub.user.login, stat_user_path(sub.user) %td= sub.user.full_name %td= time_ago_in_words(sub.submitted_at) + " ago" %td= sub.points diff --git a/app/views/submissions/show.html.haml b/app/views/submissions/show.html.haml --- a/app/views/submissions/show.html.haml +++ b/app/views/submissions/show.html.haml @@ -29,7 +29,7 @@ %strong User %td - if @submission.user - = link_to "(#{@submission.user.login})", controller: "users", action: "profile", id: @submission.user + = link_to "#{@submission.user.login}", stat_user_path(@submission.user) = @submission.user.full_name - else = "(n/a)" @@ -38,7 +38,7 @@ %strong Task %td - if @submission.problem!=nil - = link_to "(#{@submission.problem.name})", controller: "problems", action: "stat", id: @submission.problem + = link_to "[#{@submission.problem.name}]", stat_problem_path(@submission.problem) = @submission.problem.full_name - else = "(n/a)" diff --git a/app/views/users/profile.html.haml b/app/views/users/stat.html.haml rename from app/views/users/profile.html.haml rename to app/views/users/stat.html.haml --- a/app/views/users/profile.html.haml +++ b/app/views/users/stat.html.haml @@ -52,8 +52,8 @@ - @submission.each do |s| - next unless s.problem %tr - %td= link_to "#{s.id}", controller: "graders", action: "submission", id: s.id - %td= link_to s.problem.name, controller: "problems", action: "stat", id: s.problem + %td= link_to s.id, submission_path(s) + %td= link_to s.problem.name, stat_problem_path(s.problem) %td= s.problem.full_name %td= s.language.pretty_name %td #{s.submitted_at.strftime('%Y-%m-%d %H:%M')} (#{time_ago_in_words(s.submitted_at)} ago) diff --git a/config/routes.rb b/config/routes.rb --- a/config/routes.rb +++ b/config/routes.rb @@ -17,6 +17,7 @@ member do get 'toggle' get 'toggle_test' + get 'stat' end collection do get 'turn_all_off' @@ -31,6 +32,7 @@ resources :users do member do get 'toggle_activate', 'toggle_enable' + get 'stat' end end