diff --git a/app/assets/javascripts/custom.js.coffee b/app/assets/javascripts/custom.js.coffee
--- a/app/assets/javascripts/custom.js.coffee
+++ b/app/assets/javascripts/custom.js.coffee
@@ -24,4 +24,12 @@
if log
alert log
return
+ $(".go-button").on 'click', (event) ->
+ link = $(this).attr("data-source")
+ url = $(link).val()
+ if url
+ window.location.href = url
+ return
return
+
+
diff --git a/app/assets/javascripts/report.js.coffee b/app/assets/javascripts/report.js.coffee
--- a/app/assets/javascripts/report.js.coffee
+++ b/app/assets/javascripts/report.js.coffee
@@ -1,3 +0,0 @@
-# Place all the behaviors and hooks related to the matching controller here.
-# All this logic will automatically be available in application.js.
-# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
diff --git a/app/views/report/_task_hof.html.haml b/app/views/report/_task_hof.html.haml
--- a/app/views/report/_task_hof.html.haml
+++ b/app/views/report/_task_hof.html.haml
@@ -1,14 +1,3 @@
-- content_for :header do
- = javascript_include_tag 'local_jquery'
-
-:javascript
- $(document).ready( function() {
- $("#mem_remark").hover( function() {
- $("#mem_remark_box").show();
- }, function() {
- $("#mem_remark_box").hide();
- });
- });
:css
.hof_user { color: orangered; font-style: italic; }
.hof_language { color: green; font-style: italic; }
@@ -34,94 +23,114 @@
overflow: auto;
}
-%h1 (#{Problem.find(params[:id]).name}) #{Problem.find(params[:id]).full_name}
-%h2 Problem Stat
-%table.info
- %thead
- %tr.info-head
- %th Stat
- %th Value
- %tbody
- %tr{class: cycle('info-even','info-odd')}
- %td.info_param Submissions
- %td= @summary[:count]
- %tr{class: cycle('info-even','info-odd')}
- %td.info_param Solved/Attempted User
- %td #{@summary[:solve]}/#{@summary[:attempt]} (#{(@summary[:solve]*100.0/@summary[:attempt]).round(1)}%)
- - if @best
- %tr{class: cycle('info-even','info-odd')}
- %td.info_param Best Runtime
- %td
- by #{link_to @best[:runtime][:user], controller:'users', action:'profile', id:@best[:memory][:user_id]}
- using #{@best[:runtime][:lang]}
- with #{@best[:runtime][:value] * 1000} milliseconds
- at submission
- = link_to("#" + @best[:runtime][:sub_id].to_s, controller: 'graders', action: 'submission', id:@best[:runtime][:sub_id])
+.container
+ .row
+ .col-md-4
+ %h2 Overall Stat
+ %table.table.table-hover
+ %thead
+ %tr
+ %th
+ %th
+ %tbody
+ %tr
+ %td.info_param Submissions
+ %td= @summary[:count]
+ %tr
+ %td.info_param Solved/Attempted User
+ %td #{@summary[:solve]}/#{@summary[:attempt]} (#{(@summary[:solve]*100.0/@summary[:attempt]).round(1)}%)
+ - if @best
+ %tr
+ %td.info_param Best Runtime
+ %td
+ by #{link_to @best[:runtime][:user], controller:'users', action:'profile', id:@best[:memory][:user_id]}
+ %br
+ using #{@best[:runtime][:lang]}
+ %br
+ with #{@best[:runtime][:value] * 1000} milliseconds
+ %br
+ at submission
+ = link_to("#" + @best[:runtime][:sub_id].to_s, controller: 'graders', action: 'submission', id:@best[:runtime][:sub_id])
- %tr{class: cycle('info-even','info-odd')}
- %td.info_param
- Best Memory Usage
- %sup{ id: "mem_remark", style: "position:relative; color: blue;"}
- [?]
- %span.tooltip#mem_remark_box
- This counts only for submission with 100% score.
- Right now, java is excluded from memory usage competition. (Because it always uses 2GB memory...)
- %td
- by #{link_to @best[:memory][:user], controller:'users', action:'profile', id:@best[:memory][:user_id]}
- using #{@best[:memory][:lang]}
- with #{number_with_delimiter(@best[:memory][:value])} kbytes
- at submission
- = link_to("#" + @best[:memory][:sub_id].to_s, controller: 'graders' , action: 'submission', id:@best[:memory][:sub_id])
+ %tr
+ %td.info_param
+ Best Memory Usage
+ %sup{ id: "xmem_remark",
+ style: "position:relative; color: blue;",
+ data: {toggle: 'tooltip', placement: 'top', animation: 'false', delay: 20},
+ title: "This counts only for submission with 100% score. Right now, java is excluded from memory usage competition. (Because it always uses 2GB memory...)"}
+ [?]
+ %td
+ by #{link_to @best[:memory][:user], controller:'users', action:'profile', id:@best[:memory][:user_id]}
+ %br
+ using #{@best[:memory][:lang]}
+ %br
+ with #{number_with_delimiter(@best[:memory][:value])} kbytes
+ %br
+ at submission
+ = link_to("#" + @best[:memory][:sub_id].to_s, controller: 'graders' , action: 'submission', id:@best[:memory][:sub_id])
- %tr{class: cycle('info-even','info-odd')}
- %td.info_param Shortest Code
- %td
- by #{link_to @best[:length][:user], controller:'users', action:'profile', id:@best[:length][:user_id]}
- using #{@best[:length][:lang]}
- with #{@best[:length][:value]} bytes
- at submission
- = link_to("#" + @best[:length][:sub_id].to_s, controller: 'graders' , action: 'submission', id: @best[:length][:sub_id])
-
- %tr{class: cycle('info-even','info-odd')}
- %td.info_param First solver
- %td
- #{link_to @best[:first][:user], controller:'users', action:'profile', id:@best[:first][:user_id]} is the first solver
- using #{@best[:first][:lang]}
- on #{@best[:first][:value]}
- at submission
- = link_to("#" + @best[:first][:sub_id].to_s, controller: 'graders' , action: 'submission', id: @best[:first][:sub_id])
-
-- if @best
- %h2 By language
+ %tr
+ %td.info_param Shortest Code
+ %td
+ by #{link_to @best[:length][:user], controller:'users', action:'profile', id:@best[:length][:user_id]}
+ %br
+ using #{@best[:length][:lang]}
+ %br
+ with #{@best[:length][:value]} bytes
+ %br
+ at submission
+ = link_to("#" + @best[:length][:sub_id].to_s, controller: 'graders' , action: 'submission', id: @best[:length][:sub_id])
- %table.info
- %thead
- %tr.info-head
- %th Language
- %th Best runtime (ms)
- %th Best memory (kbytes)
- %th Shortest Code (bytes)
- %th First solver
- %tbody
- - @by_lang.each do |lang,value|
- %tr{class: cycle('info-even','info-odd')}
- %td= lang
- %td
- = link_to value[:runtime][:user], controller: 'users', action: 'profile', id: value[:runtime][:user_id]
- = "(#{(value[:runtime][:value] * 1000).to_i} @"
- = "#{link_to("#" + value[:runtime][:sub_id].to_s, controller: 'graders' , action: 'submission', id: value[:runtime][:sub_id])} )".html_safe
- %td
- = link_to value[:memory][:user], controller: 'users', action: 'profile', id: value[:memory][:user_id]
- = "(#{number_with_delimiter(value[:memory][:value])} @"
- = "#{link_to("#" + value[:memory][:sub_id].to_s, controller: 'graders' , action: 'submission', id: value[:memory][:sub_id])} )".html_safe
- %td
- = link_to value[:length][:user], controller: 'users', action: 'profile', id: value[:length][:user_id]
- = "(#{value[:length][:value]} @"
- = "#{link_to("#" + value[:length][:sub_id].to_s, controller: 'graders' , action: 'submission', id: value[:length][:sub_id])} )".html_safe
- %td
- - if value[:first][:user] != '(NULL)' #TODO: i know... this is wrong...
- = link_to value[:first][:user], controller: 'users', action: 'profile', id: value[:first][:user_id]
- = "(#{value[:first][:value]} @"
- = "#{link_to("#" + value[:first][:sub_id].to_s, controller: 'graders' , action: 'submission', id: value[:first][:sub_id])} )".html_safe
+ %tr
+ %td.info_param First solver
+ %td
+ - if @best[:first][:user] != '(NULL)'
+ #{link_to @best[:first][:user], controller:'users', action:'profile', id:@best[:first][:user_id]} is the first solver
+ %br
+ using #{@best[:first][:lang]}
+ %br
+ on #{@best[:first][:value]}
+ %br
+ at submission
+ = link_to("#" + @best[:first][:sub_id].to_s, controller: 'graders' , action: 'submission', id: @best[:first][:sub_id])
+ - else
+ no first solver
+ .col-md-8
+ - if @best
+ %h2 By Language
+ %table.table.table-hover
+ %thead
+ %tr
+ %th Language
+ %th Best runtime (ms)
+ %th Best memory (kbytes)
+ %th Shortest Code (bytes)
+ %th First solver
+ %tbody
+ - @by_lang.each do |lang,value|
+ %tr
+ %td= lang
+ %td
+ = link_to value[:runtime][:user], controller: 'users', action: 'profile', id: value[:runtime][:user_id]
+ %br
+ = "(#{(value[:runtime][:value] * 1000).to_i} @"
+ = "#{link_to("#" + value[:runtime][:sub_id].to_s, controller: 'graders' , action: 'submission', id: value[:runtime][:sub_id])} )".html_safe
+ %td
+ = link_to value[:memory][:user], controller: 'users', action: 'profile', id: value[:memory][:user_id]
+ %br
+ = "(#{number_with_delimiter(value[:memory][:value])} @"
+ = "#{link_to("#" + value[:memory][:sub_id].to_s, controller: 'graders' , action: 'submission', id: value[:memory][:sub_id])} )".html_safe
+ %td
+ = link_to value[:length][:user], controller: 'users', action: 'profile', id: value[:length][:user_id]
+ %br
+ = "(#{value[:length][:value]} @"
+ = "#{link_to("#" + value[:length][:sub_id].to_s, controller: 'graders' , action: 'submission', id: value[:length][:sub_id])} )".html_safe
+ %td
+ - if value[:first][:user] != '(NULL)' #TODO: i know... this is wrong...
+ = link_to value[:first][:user], controller: 'users', action: 'profile', id: value[:first][:user_id]
+ %br
+ = "(#{value[:first][:value]} @"
+ = "#{link_to("#" + value[:first][:sub_id].to_s, controller: 'graders' , action: 'submission', id: value[:first][:sub_id])} )".html_safe
diff --git a/app/views/report/problem_hof.html.haml b/app/views/report/problem_hof.html.haml
--- a/app/views/report/problem_hof.html.haml
+++ b/app/views/report/problem_hof.html.haml
@@ -5,19 +5,25 @@
/- else
/ %h1 All-Time Hall of Fame
+.panel.panel-info
+ .panel-heading
+ Select Task
+ .panel-body
+ .form-inline
+ = select 'report',
+ 'problem_id',
+ @problems.collect {|p| ["[#{p.name}] #{p.full_name}", report_problem_hof_url(p.id)]},
+ {:selected => report_problem_hof_url(@problem)},
+ { class: 'select2 form-control' }
+ %button.btn.btn-primary.btn-sm.go-button#problem_go{data: {source: "#report_problem_id"}} Go
-%h1 Hall of Fame
-.task-menu
- Tasks
- %br/
- - @problems.each do |prob|
- = link_to( "[#{prob.name}]", {id: prob.id})
- unless params[:id]
/=render partial: 'all_time_hof'
Please select a problem.
- else
- =render partial: 'task_hof'
+ %h1 [#{Problem.find(params[:id]).name}] #{Problem.find(params[:id]).full_name}
%h2 Submission History
=render partial: 'application/bar_graph', locals: { histogram: @histogram }
+ =render partial: 'task_hof'
diff --git a/config/routes.rb b/config/routes.rb
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -22,6 +22,9 @@
get "main/list"
get 'main/submission(/:id)', to: 'main#submission', as: 'main_submission'
+ #report
+ get 'report/problem_hof(/:id)', to: 'report#problem_hof', as: 'report_problem_hof'
+
# See how all your routes lay out with "rake routes"
# This is a legacy wild controller route that's not recommended for RESTful applications.