Description:
hall of fame bootrapized
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r560:aaf243e375da - - 5 files changed: 130 inserted, 107 deleted

@@ -24,4 +24,12
24 24 if log
25 25 alert log
26 26 return
27 + $(".go-button").on 'click', (event) ->
28 + link = $(this).attr("data-source")
29 + url = $(link).val()
30 + if url
31 + window.location.href = url
32 + return
27 33 return
34 +
35 +
@@ -1,3 +0,0
1 - # Place all the behaviors and hooks related to the matching controller here.
2 - # All this logic will automatically be available in application.js.
3 - # You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
@@ -1,14 +1,3
1 - - content_for :header do
2 - = javascript_include_tag 'local_jquery'
3 -
4 - :javascript
5 - $(document).ready( function() {
6 - $("#mem_remark").hover( function() {
7 - $("#mem_remark_box").show();
8 - }, function() {
9 - $("#mem_remark_box").hide();
10 - });
11 - });
12 1 :css
13 2 .hof_user { color: orangered; font-style: italic; }
14 3 .hof_language { color: green; font-style: italic; }
@@ -34,94 +23,114
34 23 overflow: auto;
35 24 }
36 25
37 - %h1 (#{Problem.find(params[:id]).name}) #{Problem.find(params[:id]).full_name}
38 26
39 - %h2 Problem Stat
40 - %table.info
41 - %thead
42 - %tr.info-head
43 - %th Stat
44 - %th Value
45 - %tbody
46 - %tr{class: cycle('info-even','info-odd')}
47 - %td.info_param Submissions
48 - %td= @summary[:count]
49 - %tr{class: cycle('info-even','info-odd')}
50 - %td.info_param Solved/Attempted User
51 - %td #{@summary[:solve]}/#{@summary[:attempt]} (#{(@summary[:solve]*100.0/@summary[:attempt]).round(1)}%)
52 - - if @best
53 - %tr{class: cycle('info-even','info-odd')}
54 - %td.info_param Best Runtime
55 - %td
56 - by #{link_to @best[:runtime][:user], controller:'users', action:'profile', id:@best[:memory][:user_id]}
57 - using <span class="hof_language">#{@best[:runtime][:lang]}</span>
58 - with <span class="hof_value">#{@best[:runtime][:value] * 1000} milliseconds</span>
59 - at submission
60 - = link_to("#" + @best[:runtime][:sub_id].to_s, controller: 'graders', action: 'submission', id:@best[:runtime][:sub_id])
27 + .container
28 + .row
29 + .col-md-4
30 + %h2 Overall Stat
31 + %table.table.table-hover
32 + %thead
33 + %tr
34 + %th
35 + %th
36 + %tbody
37 + %tr
38 + %td.info_param Submissions
39 + %td= @summary[:count]
40 + %tr
41 + %td.info_param Solved/Attempted User
42 + %td #{@summary[:solve]}/#{@summary[:attempt]} (#{(@summary[:solve]*100.0/@summary[:attempt]).round(1)}%)
43 + - if @best
44 + %tr
45 + %td.info_param Best Runtime
46 + %td
47 + by #{link_to @best[:runtime][:user], controller:'users', action:'profile', id:@best[:memory][:user_id]}
48 + %br
49 + using <span class="text-success">#{@best[:runtime][:lang]}</span>
50 + %br
51 + with <span class="text-success">#{@best[:runtime][:value] * 1000} milliseconds</span>
52 + %br
53 + at submission
54 + = link_to("#" + @best[:runtime][:sub_id].to_s, controller: 'graders', action: 'submission', id:@best[:runtime][:sub_id])
61 55
62 - %tr{class: cycle('info-even','info-odd')}
63 - %td.info_param
64 - Best Memory Usage
65 - %sup{ id: "mem_remark", style: "position:relative; color: blue;"}
66 - [?]
67 - %span.tooltip#mem_remark_box
68 - This counts only for submission with 100% score.
69 - Right now, java is excluded from memory usage competition. (Because it always uses 2GB memory...)
70 - %td
71 - by #{link_to @best[:memory][:user], controller:'users', action:'profile', id:@best[:memory][:user_id]}
72 - using <span class="hof_language">#{@best[:memory][:lang]}</span>
73 - with <span class="hof_value">#{number_with_delimiter(@best[:memory][:value])} kbytes </span>
74 - at submission
75 - = link_to("#" + @best[:memory][:sub_id].to_s, controller: 'graders' , action: 'submission', id:@best[:memory][:sub_id])
56 + %tr
57 + %td.info_param
58 + Best Memory Usage
59 + %sup{ id: "xmem_remark",
60 + style: "position:relative; color: blue;",
61 + data: {toggle: 'tooltip', placement: 'top', animation: 'false', delay: 20},
62 + title: "This counts only for submission with 100% score. Right now, java is excluded from memory usage competition. (Because it always uses 2GB memory...)"}
63 + [?]
64 + %td
65 + by #{link_to @best[:memory][:user], controller:'users', action:'profile', id:@best[:memory][:user_id]}
66 + %br
67 + using <span class="text-success">#{@best[:memory][:lang]}</span>
68 + %br
69 + with <span class="text-success">#{number_with_delimiter(@best[:memory][:value])} kbytes </span>
70 + %br
71 + at submission
72 + = link_to("#" + @best[:memory][:sub_id].to_s, controller: 'graders' , action: 'submission', id:@best[:memory][:sub_id])
76 73
77 - %tr{class: cycle('info-even','info-odd')}
78 - %td.info_param Shortest Code
79 - %td
80 - by #{link_to @best[:length][:user], controller:'users', action:'profile', id:@best[:length][:user_id]}
81 - using <span class="hof_language">#{@best[:length][:lang]}</span>
82 - with <span class="hof_value">#{@best[:length][:value]} bytes</span>
83 - at submission
84 - = link_to("#" + @best[:length][:sub_id].to_s, controller: 'graders' , action: 'submission', id: @best[:length][:sub_id])
85 -
86 - %tr{class: cycle('info-even','info-odd')}
87 - %td.info_param First solver
88 - %td
89 - #{link_to @best[:first][:user], controller:'users', action:'profile', id:@best[:first][:user_id]} is the first solver
90 - using <span class="hof_language">#{@best[:first][:lang]}</span>
91 - on <span class="hof_value">#{@best[:first][:value]}</span>
92 - at submission
93 - = link_to("#" + @best[:first][:sub_id].to_s, controller: 'graders' , action: 'submission', id: @best[:first][:sub_id])
94 -
95 - - if @best
96 - %h2 By language
74 + %tr
75 + %td.info_param Shortest Code
76 + %td
77 + by #{link_to @best[:length][:user], controller:'users', action:'profile', id:@best[:length][:user_id]}
78 + %br
79 + using <span class="text-success">#{@best[:length][:lang]}</span>
80 + %br
81 + with <span class="text-success">#{@best[:length][:value]} bytes</span>
82 + %br
83 + at submission
84 + = link_to("#" + @best[:length][:sub_id].to_s, controller: 'graders' , action: 'submission', id: @best[:length][:sub_id])
97 85
98 - %table.info
99 - %thead
100 - %tr.info-head
101 - %th Language
102 - %th Best runtime (ms)
103 - %th Best memory (kbytes)
104 - %th Shortest Code (bytes)
105 - %th First solver
106 - %tbody
107 - - @by_lang.each do |lang,value|
108 - %tr{class: cycle('info-even','info-odd')}
109 - %td= lang
110 - %td
111 - = link_to value[:runtime][:user], controller: 'users', action: 'profile', id: value[:runtime][:user_id]
112 - = "(#{(value[:runtime][:value] * 1000).to_i} @"
113 - = "#{link_to("#" + value[:runtime][:sub_id].to_s, controller: 'graders' , action: 'submission', id: value[:runtime][:sub_id])} )".html_safe
114 - %td
115 - = link_to value[:memory][:user], controller: 'users', action: 'profile', id: value[:memory][:user_id]
116 - = "(#{number_with_delimiter(value[:memory][:value])} @"
117 - = "#{link_to("#" + value[:memory][:sub_id].to_s, controller: 'graders' , action: 'submission', id: value[:memory][:sub_id])} )".html_safe
118 - %td
119 - = link_to value[:length][:user], controller: 'users', action: 'profile', id: value[:length][:user_id]
120 - = "(#{value[:length][:value]} @"
121 - = "#{link_to("#" + value[:length][:sub_id].to_s, controller: 'graders' , action: 'submission', id: value[:length][:sub_id])} )".html_safe
122 - %td
123 - - if value[:first][:user] != '(NULL)' #TODO: i know... this is wrong...
124 - = link_to value[:first][:user], controller: 'users', action: 'profile', id: value[:first][:user_id]
125 - = "(#{value[:first][:value]} @"
126 - = "#{link_to("#" + value[:first][:sub_id].to_s, controller: 'graders' , action: 'submission', id: value[:first][:sub_id])} )".html_safe
86 + %tr
87 + %td.info_param First solver
88 + %td
89 + - if @best[:first][:user] != '(NULL)'
90 + #{link_to @best[:first][:user], controller:'users', action:'profile', id:@best[:first][:user_id]} is the first solver
91 + %br
92 + using <span class="text-success">#{@best[:first][:lang]}</span>
93 + %br
94 + on <span class="text-success">#{@best[:first][:value]}</span>
95 + %br
96 + at submission
97 + = link_to("#" + @best[:first][:sub_id].to_s, controller: 'graders' , action: 'submission', id: @best[:first][:sub_id])
98 + - else
99 + no first solver
100 + .col-md-8
101 + - if @best
102 + %h2 By Language
103 + %table.table.table-hover
104 + %thead
105 + %tr
106 + %th Language
107 + %th Best runtime (ms)
108 + %th Best memory (kbytes)
109 + %th Shortest Code (bytes)
110 + %th First solver
111 + %tbody
112 + - @by_lang.each do |lang,value|
113 + %tr
114 + %td= lang
115 + %td
116 + = link_to value[:runtime][:user], controller: 'users', action: 'profile', id: value[:runtime][:user_id]
117 + %br
118 + = "(#{(value[:runtime][:value] * 1000).to_i} @"
119 + = "#{link_to("#" + value[:runtime][:sub_id].to_s, controller: 'graders' , action: 'submission', id: value[:runtime][:sub_id])} )".html_safe
120 + %td
121 + = link_to value[:memory][:user], controller: 'users', action: 'profile', id: value[:memory][:user_id]
122 + %br
123 + = "(#{number_with_delimiter(value[:memory][:value])} @"
124 + = "#{link_to("#" + value[:memory][:sub_id].to_s, controller: 'graders' , action: 'submission', id: value[:memory][:sub_id])} )".html_safe
125 + %td
126 + = link_to value[:length][:user], controller: 'users', action: 'profile', id: value[:length][:user_id]
127 + %br
128 + = "(#{value[:length][:value]} @"
129 + = "#{link_to("#" + value[:length][:sub_id].to_s, controller: 'graders' , action: 'submission', id: value[:length][:sub_id])} )".html_safe
130 + %td
131 + - if value[:first][:user] != '(NULL)' #TODO: i know... this is wrong...
132 + = link_to value[:first][:user], controller: 'users', action: 'profile', id: value[:first][:user_id]
133 + %br
134 + = "(#{value[:first][:value]} @"
135 + = "#{link_to("#" + value[:first][:sub_id].to_s, controller: 'graders' , action: 'submission', id: value[:first][:sub_id])} )".html_safe
127 136
@@ -5,19 +5,25
5 5 /- else
6 6 / %h1 All-Time Hall of Fame
7 7
8 + .panel.panel-info
9 + .panel-heading
10 + Select Task
11 + .panel-body
12 + .form-inline
13 + = select 'report',
14 + 'problem_id',
15 + @problems.collect {|p| ["[#{p.name}] #{p.full_name}", report_problem_hof_url(p.id)]},
16 + {:selected => report_problem_hof_url(@problem)},
17 + { class: 'select2 form-control' }
18 + %button.btn.btn-primary.btn-sm.go-button#problem_go{data: {source: "#report_problem_id"}} Go
8 19
9 - %h1 Hall of Fame
10 - .task-menu
11 - Tasks
12 - %br/
13 - - @problems.each do |prob|
14 - = link_to( "[#{prob.name}]", {id: prob.id})
15 20
16 21 - unless params[:id]
17 22 /=render partial: 'all_time_hof'
18 23 Please select a problem.
19 24 - else
20 - =render partial: 'task_hof'
25 + %h1 [#{Problem.find(params[:id]).name}] #{Problem.find(params[:id]).full_name}
21 26 %h2 Submission History
22 27 =render partial: 'application/bar_graph', locals: { histogram: @histogram }
28 + =render partial: 'task_hof'
23 29
@@ -22,6 +22,9
22 22 get "main/list"
23 23 get 'main/submission(/:id)', to: 'main#submission', as: 'main_submission'
24 24
25 + #report
26 + get 'report/problem_hof(/:id)', to: 'report#problem_hof', as: 'report_problem_hof'
27 +
25 28 # See how all your routes lay out with "rake routes"
26 29
27 30 # This is a legacy wild controller route that's not recommended for RESTful applications.
You need to be logged in to leave comments. Login now