|
|
|
|
|
:css
|
|
|
.fix-width {
|
|
|
font-family: Droid Sans Mono,Consolas, monospace, mono, Courier New, Courier;
|
|
|
}
|
|
|
|
|
|
%h1 User stats
|
|
|
%h5.text-secondary= @user.login
|
|
|
|
|
|
.row.my-3
|
|
|
.col-md-8
|
|
|
.card
|
|
|
.card-body
|
|
|
%h2.card-title Sub Info
|
|
|
%canvas#chart{height: '50px'}
|
|
|
|
|
|
.col-md-4
|
|
|
.card
|
|
|
.card-body
|
|
|
%h2.card-title General Info
|
|
|
.row
|
|
|
.col-sm-6.fw-bold
|
|
|
Login
|
|
|
.col-sm-6
|
|
|
= @user.login
|
|
|
.row
|
|
|
.col-sm-6.fw-bold
|
|
|
Full name
|
|
|
.col-sm-6
|
|
|
= @user.full_name
|
|
|
.row
|
|
|
.col-sm-6.fw-bold
|
|
|
Subs
|
|
|
.col-sm-6
|
|
|
= @summary[:count]
|
|
|
.row
|
|
|
.col-sm-6.fw-bold
|
|
|
Solved/Attempted Problem
|
|
|
.col-sm-6
|
|
|
#{@summary[:solve]}/#{@summary[:attempt]} (#{(@summary[:solve]*100.0/@summary[:attempt]).round(1)}%)
|
|
|
|
|
|
|
|
|
%table#main_table.table.table-striped
|
|
|
%thead
|
|
|
%tr
|
|
|
%th ID
|
|
|
%th Problem code
|
|
|
%th Problem full name
|
|
|
%th Language
|
|
|
%th Submitted at
|
|
|
%th Result
|
|
|
%th Score
|
|
|
- if session[:admin]
|
|
|
%th IP
|
|
|
%tbody
|
|
|
- @submission.each do |s|
|
|
|
- next unless s.problem
|
|
|
%tr
|
|
|
%td= link_to s.id, submission_path(s)
|
|
|
%td= link_to s.problem.name, stat_problem_path(s.problem)
|
|
|
%td= s.problem.full_name
|
|
|
%td= s.language.pretty_name
|
|
|
%td #{s.submitted_at.strftime('%Y-%m-%d %H:%M')} (#{time_ago_in_words(s.submitted_at)} ago)
|
|
|
%td.fix-width= s.grader_comment
|
|
|
%td= ( s.try(:points) ? (s.points*100/s.problem.full_score) : '' )
|
|
|
- if session[:admin]
|
|
|
%td= s.ip_address
|
|
|
|
|
|
|
|
|
|
|
|
:javascript
|
|
|
$(document).on('import-map-loaded',(e) => {
|
|
|
//init datatable
|
|
|
$("#main_table").DataTable({
|
|
|
paging: false
|
|
|
});
|
|
|
|
|
|
//history graph
|
|
|
data = #{@chart_dataset}
|
|
|
config = {
|
|
|
type: 'bar',
|
|
|
data: data,
|
|
|
options: {
|
|
|
plugins: {
|
|
|
legend: {
|
|
|
display: false
|
|
|
},
|
|
|
},
|
|
|
}
|
|
|
}
|
|
|
Chart.defaults.font.size = 15
|
|
|
//Chart.defaults.font.family = 'Sarabun Light'
|
|
|
chart = new Chart($('#chart'),config)
|
|
|
});
|
|
|
|
|
|
|