Description:
reorder submission and remove duplicate code for submission
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r644:6431e2ef4265 - - 6 files changed: 7 inserted, 54 deleted
@@ -121,29 +121,12 | |||||
|
121 | else |
|
121 | else |
|
122 | flash[:notice] = 'Error viewing source' |
|
122 | flash[:notice] = 'Error viewing source' |
|
123 | redirect_to :action => 'list' |
|
123 | redirect_to :action => 'list' |
|
124 | end |
|
124 | end |
|
125 | end |
|
125 | end |
|
126 |
|
126 | ||
|
127 | - def submission |
|
||
|
128 | - @user = User.find(session[:user_id]) |
|
||
|
129 | - @problems = @user.available_problems |
|
||
|
130 | - if params[:id]==nil |
|
||
|
131 | - @problem = nil |
|
||
|
132 | - @submissions = nil |
|
||
|
133 | - else |
|
||
|
134 | - @problem = Problem.find_by_id(params[:id]) |
|
||
|
135 | - if (@problem == nil) or (not @problem.available) |
|
||
|
136 | - redirect_to :action => 'list' |
|
||
|
137 | - flash[:notice] = 'Error: submissions for that problem are not viewable.' |
|
||
|
138 | - return |
|
||
|
139 | - end |
|
||
|
140 | - @submissions = Submission.find_all_by_user_problem(@user.id, @problem.id) |
|
||
|
141 | - end |
|
||
|
142 | - end |
|
||
|
143 | - |
|
||
|
144 | def result |
|
127 | def result |
|
145 | if !GraderConfiguration.show_grading_result |
|
128 | if !GraderConfiguration.show_grading_result |
|
146 | redirect_to :action => 'list' and return |
|
129 | redirect_to :action => 'list' and return |
|
147 | end |
|
130 | end |
|
148 | @user = User.find(session[:user_id]) |
|
131 | @user = User.find(session[:user_id]) |
|
149 | @submission = Submission.find(params[:id]) |
|
132 | @submission = Submission.find(params[:id]) |
@@ -16,13 +16,13 | |||||
|
16 | @problem = Problem.find_by_id(params[:problem_id]) |
|
16 | @problem = Problem.find_by_id(params[:problem_id]) |
|
17 | if (@problem == nil) or (not @problem.available) |
|
17 | if (@problem == nil) or (not @problem.available) |
|
18 | redirect_to main_list_path |
|
18 | redirect_to main_list_path |
|
19 | flash[:notice] = 'Error: submissions for that problem are not viewable.' |
|
19 | flash[:notice] = 'Error: submissions for that problem are not viewable.' |
|
20 | return |
|
20 | return |
|
21 | end |
|
21 | end |
|
22 | - @submissions = Submission.find_all_by_user_problem(@user.id, @problem.id) |
|
22 | + @submissions = Submission.find_all_by_user_problem(@user.id, @problem.id).order(id: :desc) |
|
23 | end |
|
23 | end |
|
24 | end |
|
24 | end |
|
25 |
|
25 | ||
|
26 | # GET /submissions/1 |
|
26 | # GET /submissions/1 |
|
27 | # GET /submissions/1.json |
|
27 | # GET /submissions/1.json |
|
28 | def show |
|
28 | def show |
@@ -1,11 +1,11 | |||||
|
1 |
|
1 | ||
|
2 | %tr |
|
2 | %tr |
|
3 | %td{:align => "center"} |
|
3 | %td{:align => "center"} |
|
4 |
- = submission |
|
4 | + = submission.number |
|
5 | - %td{:align => "center"} |
|
5 | + %td.text-right |
|
6 | = link_to "##{submission.id}", submission_path(submission.id) |
|
6 | = link_to "##{submission.id}", submission_path(submission.id) |
|
7 | %td |
|
7 | %td |
|
8 | = l submission.submitted_at, format: :long |
|
8 | = l submission.submitted_at, format: :long |
|
9 | = "( #{time_ago_in_words(submission.submitted_at)} ago)" |
|
9 | = "( #{time_ago_in_words(submission.submitted_at)} ago)" |
|
10 | %td |
|
10 | %td |
|
11 | = submission.source_filename |
|
11 | = submission.source_filename |
@@ -9,21 +9,22 | |||||
|
9 | %span.icon-bar |
|
9 | %span.icon-bar |
|
10 | %a.navbar-brand{href: main_list_path} |
|
10 | %a.navbar-brand{href: main_list_path} |
|
11 | %span.glyphicon.glyphicon-home |
|
11 | %span.glyphicon.glyphicon-home |
|
12 | MAIN |
|
12 | MAIN |
|
13 | .collapse.navbar-collapse#navbar-collapse |
|
13 | .collapse.navbar-collapse#navbar-collapse |
|
14 | %ul.nav.navbar-nav |
|
14 | %ul.nav.navbar-nav |
|
|
15 | + / submission | ||
|
15 | - if (@current_user!=nil) and (GraderConfiguration.show_tasks_to?(@current_user)) |
|
16 | - if (@current_user!=nil) and (GraderConfiguration.show_tasks_to?(@current_user)) |
|
16 | - //= add_menu("#{I18n.t 'menu.tasks'}", 'tasks', 'list') |
|
||
|
17 | %li.dropdown |
|
17 | %li.dropdown |
|
18 | %a.dropdown-toggle{href: '#', data: {toggle:'dropdown'}, aria: {haspopup:"true", expanded:"false"}, role: "button"} |
|
18 | %a.dropdown-toggle{href: '#', data: {toggle:'dropdown'}, aria: {haspopup:"true", expanded:"false"}, role: "button"} |
|
19 | = "#{I18n.t 'menu.submissions'}" |
|
19 | = "#{I18n.t 'menu.submissions'}" |
|
20 | %span.caret |
|
20 | %span.caret |
|
21 | %ul.dropdown-menu |
|
21 | %ul.dropdown-menu |
|
22 |
- = add_menu("View", ' |
|
22 | + = add_menu("View", 'submissions', 'index') |
|
23 | = add_menu("Self Test", 'test', 'index') |
|
23 | = add_menu("Self Test", 'test', 'index') |
|
|
24 | + / hall of fame | ||
|
24 | - if GraderConfiguration['right.user_hall_of_fame'] |
|
25 | - if GraderConfiguration['right.user_hall_of_fame'] |
|
25 | = add_menu("#{I18n.t 'menu.hall_of_fame'}", 'report', 'problem_hof') |
|
26 | = add_menu("#{I18n.t 'menu.hall_of_fame'}", 'report', 'problem_hof') |
|
26 | / display MODE button (with countdown in contest mode) |
|
27 | / display MODE button (with countdown in contest mode) |
|
27 | - if GraderConfiguration.analysis_mode? |
|
28 | - if GraderConfiguration.analysis_mode? |
|
28 | %div.navbar-btn.btn.btn-success#countdown= "ANALYSIS MODE" |
|
29 | %div.navbar-btn.btn.btn-success#countdown= "ANALYSIS MODE" |
|
29 | - elsif GraderConfiguration.time_limit_mode? |
|
30 | - elsif GraderConfiguration.time_limit_mode? |
@@ -15,13 +15,13 | |||||
|
15 |
|
15 | ||
|
16 | - if @submissions!=nil |
|
16 | - if @submissions!=nil |
|
17 | - if @submissions.length>0 |
|
17 | - if @submissions.length>0 |
|
18 | %table.table |
|
18 | %table.table |
|
19 | %thead |
|
19 | %thead |
|
20 | %th No. |
|
20 | %th No. |
|
21 | - %th # |
|
21 | + %th.text-right # |
|
22 | %th At |
|
22 | %th At |
|
23 | %th Source |
|
23 | %th Source |
|
24 | %th Result |
|
24 | %th Result |
|
25 | %th{:width => "300px"} Compiler message |
|
25 | %th{:width => "300px"} Compiler message |
|
26 | %th |
|
26 | %th |
|
27 | = render :partial => 'submission', :collection => @submissions |
|
27 | = render :partial => 'submission', :collection => @submissions |
deleted file |
You need to be logged in to leave comments.
Login now