Description:
add get_latest_submission_status for submission
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r581:11a43c5a5a46 - - 5 files changed: 49 inserted, 2 deleted
@@ -0,0 +1,26 | |||||
|
|
1 | + | ||
|
|
2 | + - if submission.nil? | ||
|
|
3 | + = "-" | ||
|
|
4 | + - else | ||
|
|
5 | + - if submission.graded_at.nil? | ||
|
|
6 | + =t 'main.submitted_at' | ||
|
|
7 | + = format_short_time(submission.submitted_at.localtime) | ||
|
|
8 | + - else | ||
|
|
9 | + = t 'main.graded_at' | ||
|
|
10 | + = "#{format_short_time(submission.graded_at.localtime)}, " | ||
|
|
11 | + - if GraderConfiguration['ui.show_score'] | ||
|
|
12 | + = t 'main.score' | ||
|
|
13 | + = "#{(submission.points*100/submission.problem.full_score).to_i} " | ||
|
|
14 | + = " [" | ||
|
|
15 | + %tt | ||
|
|
16 | + = submission.grader_comment | ||
|
|
17 | + = "]" | ||
|
|
18 | + - if GraderConfiguration.show_grading_result | ||
|
|
19 | + = " | " | ||
|
|
20 | + = link_to '[detailed result]', :action => 'result', :id => submission.id | ||
|
|
21 | + = " | " | ||
|
|
22 | + = link_to("[#{t 'main.cmp_msg'}]", {:action => 'compiler_msg', :id => submission.id}, {:popup => true}) | ||
|
|
23 | + = " | " | ||
|
|
24 | + = link_to("[#{t 'main.src_link'}]",{:action => 'source', :id => submission.id}) | ||
|
|
25 | + //= " | " | ||
|
|
26 | + //= link_to "[#{t 'main.submissions_link'}]", main_submission_path(submission.problem.id) |
@@ -0,0 +1,2 | |||||
|
|
1 | + :javascript | ||
|
|
2 | + $("#latest_status").html("#{j render({partial: 'submission_short', locals: {submission: @submission, problem_name: @problem.name}})}") |
@@ -11,7 +11,17 | |||||
|
11 | @source = @submission.source.to_s |
|
11 | @source = @submission.source.to_s |
|
12 | @problem = @submission.problem |
|
12 | @problem = @submission.problem |
|
13 | @lang_id = @submission.language.id |
|
13 | @lang_id = @submission.language.id |
|
14 | render 'direct_edit' |
|
14 | render 'direct_edit' |
|
15 | end |
|
15 | end |
|
16 |
|
16 | ||
|
|
17 | + def get_latest_submission_status | ||
|
|
18 | + @problem = Problem.find(params[:pid]) | ||
|
|
19 | + @submission = Submission.find_last_by_user_and_problem(params[:uid],params[:pid]) | ||
|
|
20 | + puts User.find(params[:uid]).login | ||
|
|
21 | + puts Problem.find(params[:pid]).name | ||
|
|
22 | + puts 'nil' unless @submission | ||
|
|
23 | + respond_to do |format| | ||
|
|
24 | + format.js | ||
|
|
25 | + end | ||
|
|
26 | + end | ||
|
17 | end |
|
27 | end |
@@ -5,15 +5,15 | |||||
|
5 | .container |
|
5 | .container |
|
6 | .row |
|
6 | .row |
|
7 | .col-md-12 |
|
7 | .col-md-12 |
|
8 | .alert.alert-info |
|
8 | .alert.alert-info |
|
9 | Write your code in the following box, choose language, and click submit button when finished |
|
9 | Write your code in the following box, choose language, and click submit button when finished |
|
10 | .row |
|
10 | .row |
|
11 |
- .col-md- |
|
11 | + .col-md-8 |
|
12 | %div#editor{style: 'height: 500px; border-radius: 7px; font-size: 14px;'} |
|
12 | %div#editor{style: 'height: 500px; border-radius: 7px; font-size: 14px;'} |
|
13 |
- .col-md- |
|
13 | + .col-md-4 |
|
14 | = form_tag({controller: :main, :action => 'submit'}, :multipart => true, class: 'form') do |
|
14 | = form_tag({controller: :main, :action => 'submit'}, :multipart => true, class: 'form') do |
|
15 |
|
15 | ||
|
16 | = hidden_field_tag 'editor_text', @source |
|
16 | = hidden_field_tag 'editor_text', @source |
|
17 | = hidden_field_tag 'submission[problem_id]', @problem.id |
|
17 | = hidden_field_tag 'submission[problem_id]', @problem.id |
|
18 | .form-group |
|
18 | .form-group |
|
19 | = label_tag "Task:" |
|
19 | = label_tag "Task:" |
@@ -22,6 +22,13 | |||||
|
22 | .form-group |
|
22 | .form-group |
|
23 | = label_tag 'Language' |
|
23 | = label_tag 'Language' |
|
24 | = select_tag 'language_id', options_from_collection_for_select(Language.all, 'id', 'pretty_name', @lang_id || Language.find_by_pretty_name("Python").id || Language.first.id), class: 'form-control select', style: "width: 100px" |
|
24 | = select_tag 'language_id', options_from_collection_for_select(Language.all, 'id', 'pretty_name', @lang_id || Language.find_by_pretty_name("Python").id || Language.first.id), class: 'form-control select', style: "width: 100px" |
|
25 | .form-group |
|
25 | .form-group |
|
26 | = submit_tag 'Submit', class: 'btn btn-success', id: 'live_submit', |
|
26 | = submit_tag 'Submit', class: 'btn btn-success', id: 'live_submit', |
|
27 | data: {confirm: "Submitting this source code for task #{@problem.long_name}?"} |
|
27 | data: {confirm: "Submitting this source code for task #{@problem.long_name}?"} |
|
|
28 | + .panel.panel-info | ||
|
|
29 | + .panel-heading | ||
|
|
30 | + Latest Submission Status | ||
|
|
31 | + .panel-body | ||
|
|
32 | + - if @submission | ||
|
|
33 | + = render :partial => 'submission_short', | ||
|
|
34 | + :locals => {:submission => @submission, :problem_name => @problem.name } |
@@ -31,14 +31,16 | |||||
|
31 | resources :users do |
|
31 | resources :users do |
|
32 | member do |
|
32 | member do |
|
33 | get 'toggle_activate', 'toggle_enable' |
|
33 | get 'toggle_activate', 'toggle_enable' |
|
34 | end |
|
34 | end |
|
35 | end |
|
35 | end |
|
36 |
|
36 | ||
|
|
37 | + #source code edit | ||
|
37 | get 'sources/direct_edit/:pid', to: 'sources#direct_edit', as: 'direct_edit' |
|
38 | get 'sources/direct_edit/:pid', to: 'sources#direct_edit', as: 'direct_edit' |
|
38 | get 'sources/direct_edit_submission/:sid', to: 'sources#direct_edit_submission', as: 'direct_edit_submission' |
|
39 | get 'sources/direct_edit_submission/:sid', to: 'sources#direct_edit_submission', as: 'direct_edit_submission' |
|
|
40 | + get 'sources/get_latest_submission_status/:uid/:pid', to: 'sources#get_latest_submission_status', as: 'get_latest_submission_status' | ||
|
39 |
|
41 | ||
|
40 |
|
42 | ||
|
41 | match 'tasks/view/:file.:ext' => 'tasks#view' |
|
43 | match 'tasks/view/:file.:ext' => 'tasks#view' |
|
42 | match 'tasks/download/:id/:file.:ext' => 'tasks#download' |
|
44 | match 'tasks/download/:id/:file.:ext' => 'tasks#download' |
|
43 | match 'heartbeat/:id/edit' => 'heartbeat#edit' |
|
45 | match 'heartbeat/:id/edit' => 'heartbeat#edit' |
|
44 |
|
46 |
You need to be logged in to leave comments.
Login now