Description:
allow ta to set model submission
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r857:aa5ee227f493 - - 4 files changed: 13 inserted, 10 deleted
@@ -88,13 +88,13 | |||||
|
88 |
|
88 | ||
|
89 | def admin? |
|
89 | def admin? |
|
90 | has_role?('admin') |
|
90 | has_role?('admin') |
|
91 | end |
|
91 | end |
|
92 |
|
92 | ||
|
93 | def has_role?(role) |
|
93 | def has_role?(role) |
|
94 | - self.roles.where(name: role).count > 0 |
|
94 | + self.roles.where(name: [role,'admin']).count > 0 |
|
95 | end |
|
95 | end |
|
96 |
|
96 | ||
|
97 | def email_for_editing |
|
97 | def email_for_editing |
|
98 | if self.email==nil |
|
98 | if self.email==nil |
|
99 | "(unknown)" |
|
99 | "(unknown)" |
|
100 | elsif self.email=='' |
|
100 | elsif self.email=='' |
@@ -51,18 +51,20 | |||||
|
51 | .card |
|
51 | .card |
|
52 | .card-body |
|
52 | .card-body |
|
53 | %h2.card-title Model submission |
|
53 | %h2.card-title Model submission |
|
54 | %table.table.table-hover |
|
54 | %table.table.table-hover |
|
55 | %thead |
|
55 | %thead |
|
56 | %tr |
|
56 | %tr |
|
57 | - %th #Sub |
|
57 | + %th #Sub (lang) |
|
58 | %th Author |
|
58 | %th Author |
|
59 | %tbody |
|
59 | %tbody |
|
60 | - @model_subs.each do |sub| |
|
60 | - @model_subs.each do |sub| |
|
61 | %tr |
|
61 | %tr |
|
62 | - %td= link_to "##{sub.id}", submission_path(sub) |
|
62 | + %td |
|
|
63 | + = link_to "##{sub.id}", submission_path(sub) | ||
|
|
64 | + = "(#{sub.language.pretty_name})" | ||
|
63 | %td= sub.user.full_name |
|
65 | %td= sub.user.full_name |
|
64 | .col-md-8 |
|
66 | .col-md-8 |
|
65 | - if @best |
|
67 | - if @best |
|
66 | .card |
|
68 | .card |
|
67 | .card-body |
|
69 | .card-body |
|
68 | %h2.card-title Top Submissions |
|
70 | %h2.card-title Top Submissions |
@@ -19,11 +19,12 | |||||
|
19 |
|
19 | ||
|
20 |
|
20 | ||
|
21 | - unless params[:id] |
|
21 | - unless params[:id] |
|
22 | /=render partial: 'all_time_hof' |
|
22 | /=render partial: 'all_time_hof' |
|
23 | Please select a problem. |
|
23 | Please select a problem. |
|
24 | - else |
|
24 | - else |
|
25 | - %h1 [#{Problem.find(params[:id]).name}] #{Problem.find(params[:id]).full_name} |
|
25 | + %h1 |
|
26 | - -# %h2 Submission History |
|
26 | + [#{Problem.find(params[:id]).name}] #{Problem.find(params[:id]).full_name} |
|
27 | - -# =render partial: 'application/bar_graph', locals: { histogram: @histogram } |
|
27 | + - if @current_user.has_role?('ta') |
|
|
28 | + %a{href:stat_problem_path(@problem)} (stat) | ||
|
28 | =render partial: 'task_hof' |
|
29 | =render partial: 'task_hof' |
|
29 |
|
30 |
@@ -91,30 +91,30 | |||||
|
91 | view |
|
91 | view |
|
92 | %tr |
|
92 | %tr |
|
93 | %td.text-right |
|
93 | %td.text-right |
|
94 | %strong Grading Task Status |
|
94 | %strong Grading Task Status |
|
95 | %td |
|
95 | %td |
|
96 | = @task.status_str if @task |
|
96 | = @task.status_str if @task |
|
97 |
- - if |
|
97 | + - if @current_user.admin? |
|
98 | = link_to "rejudge", rejudge_submission_path, data: {remote: true}, class: 'btn btn-info btn-xs' |
|
98 | = link_to "rejudge", rejudge_submission_path, data: {remote: true}, class: 'btn btn-info btn-xs' |
|
99 | - - if session[:admin] |
|
99 | + - if @current_user.has_role?('ta') |
|
100 | %tr |
|
100 | %tr |
|
101 | %td.text-right |
|
101 | %td.text-right |
|
102 | %strong IP |
|
102 | %strong IP |
|
103 | %td #{@submission.ip_address} |
|
103 | %td #{@submission.ip_address} |
|
104 | %tr |
|
104 | %tr |
|
105 | %td.text-right |
|
105 | %td.text-right |
|
106 | %strong Model solution |
|
106 | %strong Model solution |
|
107 | %td |
|
107 | %td |
|
108 | - if @submission.tag_model? |
|
108 | - if @submission.tag_model? |
|
109 | YES |
|
109 | YES |
|
110 |
- - if |
|
110 | + - if @current_user.has_role?('ta') |
|
111 | = link_to "remove model status", set_tag_submission_path(@submission, tag: :default), class: 'btn btn-warning btn-xs' |
|
111 | = link_to "remove model status", set_tag_submission_path(@submission, tag: :default), class: 'btn btn-warning btn-xs' |
|
112 | - else |
|
112 | - else |
|
113 | No |
|
113 | No |
|
114 |
- - if |
|
114 | + - if @current_user.has_role?('ta') |
|
115 | = link_to "set as model solution", set_tag_submission_path(@submission, tag: :model), class: 'btn btn-success btn-xs' |
|
115 | = link_to "set as model solution", set_tag_submission_path(@submission, tag: :model), class: 'btn btn-success btn-xs' |
|
116 |
|
116 | ||
|
117 |
|
117 | ||
|
118 | .modal.fade#compiler{tabindex: -1,role: 'dialog'} |
|
118 | .modal.fade#compiler{tabindex: -1,role: 'dialog'} |
|
119 | .modal-dialog.modal-lg{role:'document'} |
|
119 | .modal-dialog.modal-lg{role:'document'} |
|
120 | .modal-content |
|
120 | .modal-content |
You need to be logged in to leave comments.
Login now