Description:
add get_latest_submission_status for submission
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

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}})}")
@@ -14,4 +14,14
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
17 end
25 end
26 + end
27 + end
@@ -8,9 +8,9
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-7
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-5
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
@@ -25,3 +25,10
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 }
@@ -34,8 +34,10
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'
You need to be logged in to leave comments. Login now