Description:
update problem stat to show all submissions
change view to haml
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r448:f7ee3d7bf71a - - 4 files changed: 36 inserted, 31 deleted
@@ -0,0 +1,34 | |||
|
1 | + :css | |
|
2 | + .fix-width { | |
|
3 | + font-family: "Consolas, Monaco, Droid Sans Mono,Mono, Monospace,Courier" | |
|
4 | + } | |
|
5 | + | |
|
6 | + %h1 Problem stat: #{@problem.name} | |
|
7 | + %h2 Overview | |
|
8 | + | |
|
9 | + %h2 Submissions | |
|
10 | + - if @submissions and @submissions.count > 0 | |
|
11 | + %table.info#main_table | |
|
12 | + %thead | |
|
13 | + %tr.info-head | |
|
14 | + %th ID | |
|
15 | + %th Login | |
|
16 | + %th Name | |
|
17 | + %th Submitted_at | |
|
18 | + %th Points | |
|
19 | + %th comment | |
|
20 | + %tbody | |
|
21 | + - row_odd,curr = true,'' | |
|
22 | + - @submissions.each do |sub| | |
|
23 | + - next unless sub.user | |
|
24 | + - row_odd,curr = !row_odd, sub.user if curr != sub.user | |
|
25 | + %tr{class: row_odd ? "info-odd" : "info-even"} | |
|
26 | + %td= link_to sub.id, controller: 'graders', action: 'submission', id: sub.id | |
|
27 | + %td= link_to sub.user.login, controller: :users, action: :profile, id: sub.user.id | |
|
28 | + %td= sub.user.full_name | |
|
29 | + %td= time_ago_in_words(sub.submitted_at) + " ago" | |
|
30 | + %td= sub.points | |
|
31 | + %td.fix-width= sub.grader_comment | |
|
32 | + - else | |
|
33 | + No submission | |
|
34 | + |
@@ -131,7 +131,7 | |||
|
131 | 131 | if !@problem.available |
|
132 | 132 | redirect_to :controller => 'main', :action => 'list' |
|
133 | 133 | else |
|
134 |
- @submissions = Submission. |
|
|
134 | + @submissions = Submission.includes(:user).where(problem_id: params[:id]).order(:user_id,:id) | |
|
135 | 135 | end |
|
136 | 136 | end |
|
137 | 137 |
@@ -25,7 +25,7 | |||
|
25 | 25 | |
|
26 | 26 | def self.find_all_last_by_problem(problem_id) |
|
27 | 27 | # need to put in SQL command, maybe there's a better way |
|
28 | - Submission.find_by_sql("SELECT * FROM submissions " + | |
|
28 | + Submission.includes(:user).find_by_sql("SELECT * FROM submissions " + | |
|
29 | 29 | "WHERE id = " + |
|
30 | 30 | "(SELECT MAX(id) FROM submissions AS subs " + |
|
31 | 31 | "WHERE subs.user_id = submissions.user_id AND " + |
deleted file |
You need to be logged in to leave comments.
Login now