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: 74 inserted, 51 deleted

@@ -21,7 +21,15
21 if input.length
21 if input.length
22 input.val log
22 input.val log
23 else
23 else
24 if log
24 if log
25 alert log
25 alert log
26 return
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
27 return
32 return
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,17 +1,6
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 :css
1 :css
13 .hof_user { color: orangered; font-style: italic; }
2 .hof_user { color: orangered; font-style: italic; }
14 .hof_language { color: green; font-style: italic; }
3 .hof_language { color: green; font-style: italic; }
15 .hof_value { color: deeppink;font-style: italic; }
4 .hof_value { color: deeppink;font-style: italic; }
16 .info_param { font-weight: bold;text-align: right; }
5 .info_param { font-weight: bold;text-align: right; }
17 .tooltip {
6 .tooltip {
@@ -31,97 +20,117
31 background-color: #FFF;
20 background-color: #FFF;
32 word-wrap: break-word;
21 word-wrap: break-word;
33 z-index: 9999;
22 z-index: 9999;
34 overflow: auto;
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
27 + .container
40 - %table.info
28 + .row
29 + .col-md-4
30 + %h2 Overall Stat
31 + %table.table.table-hover
41 %thead
32 %thead
42 - %tr.info-head
33 + %tr
43 - %th Stat
34 + %th
44 - %th Value
35 + %th
45 %tbody
36 %tbody
46 - %tr{class: cycle('info-even','info-odd')}
37 + %tr
47 %td.info_param Submissions
38 %td.info_param Submissions
48 %td= @summary[:count]
39 %td= @summary[:count]
49 - %tr{class: cycle('info-even','info-odd')}
40 + %tr
50 %td.info_param Solved/Attempted User
41 %td.info_param Solved/Attempted User
51 %td #{@summary[:solve]}/#{@summary[:attempt]} (#{(@summary[:solve]*100.0/@summary[:attempt]).round(1)}%)
42 %td #{@summary[:solve]}/#{@summary[:attempt]} (#{(@summary[:solve]*100.0/@summary[:attempt]).round(1)}%)
52 - if @best
43 - if @best
53 - %tr{class: cycle('info-even','info-odd')}
44 + %tr
54 %td.info_param Best Runtime
45 %td.info_param Best Runtime
55 %td
46 %td
56 by #{link_to @best[:runtime][:user], controller:'users', action:'profile', id:@best[:memory][:user_id]}
47 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>
48 + %br
58 - with <span class="hof_value">#{@best[:runtime][:value] * 1000} milliseconds</span>
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
59 at submission
53 at submission
60 = link_to("#" + @best[:runtime][:sub_id].to_s, controller: 'graders', action: 'submission', id:@best[:runtime][:sub_id])
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')}
56 + %tr
63 %td.info_param
57 %td.info_param
64 Best Memory Usage
58 Best Memory Usage
65 - %sup{ id: "mem_remark", style: "position:relative; color: blue;"}
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...)"}
66 [?]
63 [?]
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
64 %td
71 by #{link_to @best[:memory][:user], controller:'users', action:'profile', id:@best[:memory][:user_id]}
65 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>
66 + %br
73 - with <span class="hof_value">#{number_with_delimiter(@best[:memory][:value])} kbytes </span>
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
74 at submission
71 at submission
75 = link_to("#" + @best[:memory][:sub_id].to_s, controller: 'graders' , action: 'submission', id:@best[:memory][:sub_id])
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')}
74 + %tr
78 %td.info_param Shortest Code
75 %td.info_param Shortest Code
79 %td
76 %td
80 by #{link_to @best[:length][:user], controller:'users', action:'profile', id:@best[:length][:user_id]}
77 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>
78 + %br
82 - with <span class="hof_value">#{@best[:length][:value]} bytes</span>
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
83 at submission
84 = link_to("#" + @best[:length][:sub_id].to_s, controller: 'graders' , action: 'submission', id: @best[:length][:sub_id])
84 = link_to("#" + @best[:length][:sub_id].to_s, controller: 'graders' , action: 'submission', id: @best[:length][:sub_id])
85
85
86 - %tr{class: cycle('info-even','info-odd')}
86 + %tr
87 %td.info_param First solver
87 %td.info_param First solver
88 %td
88 %td
89 + - if @best[:first][:user] != '(NULL)'
89 #{link_to @best[:first][:user], controller:'users', action:'profile', id:@best[:first][:user_id]} is the first solver
90 #{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 + %br
91 - on <span class="hof_value">#{@best[:first][:value]}</span>
92 + using <span class="text-success">#{@best[:first][:lang]}</span>
93 + %br
94 + on <span class="text-success">#{@best[:first][:value]}</span>
95 + %br
92 at submission
96 at submission
93 = link_to("#" + @best[:first][:sub_id].to_s, controller: 'graders' , action: 'submission', id: @best[:first][:sub_id])
97 = link_to("#" + @best[:first][:sub_id].to_s, controller: 'graders' , action: 'submission', id: @best[:first][:sub_id])
94 -
98 + - else
99 + no first solver
100 + .col-md-8
95 - if @best
101 - if @best
96 - %h2 By language
102 + %h2 By Language
97 -
103 + %table.table.table-hover
98 - %table.info
99 %thead
104 %thead
100 - %tr.info-head
105 + %tr
101 %th Language
106 %th Language
102 %th Best runtime (ms)
107 %th Best runtime (ms)
103 %th Best memory (kbytes)
108 %th Best memory (kbytes)
104 %th Shortest Code (bytes)
109 %th Shortest Code (bytes)
105 %th First solver
110 %th First solver
106 %tbody
111 %tbody
107 - @by_lang.each do |lang,value|
112 - @by_lang.each do |lang,value|
108 - %tr{class: cycle('info-even','info-odd')}
113 + %tr
109 %td= lang
114 %td= lang
110 %td
115 %td
111 = link_to value[:runtime][:user], controller: 'users', action: 'profile', id: value[:runtime][:user_id]
116 = link_to value[:runtime][:user], controller: 'users', action: 'profile', id: value[:runtime][:user_id]
117 + %br
112 = "(#{(value[:runtime][:value] * 1000).to_i} @"
118 = "(#{(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
119 = "#{link_to("#" + value[:runtime][:sub_id].to_s, controller: 'graders' , action: 'submission', id: value[:runtime][:sub_id])} )".html_safe
114 %td
120 %td
115 = link_to value[:memory][:user], controller: 'users', action: 'profile', id: value[:memory][:user_id]
121 = link_to value[:memory][:user], controller: 'users', action: 'profile', id: value[:memory][:user_id]
122 + %br
116 = "(#{number_with_delimiter(value[:memory][:value])} @"
123 = "(#{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
124 = "#{link_to("#" + value[:memory][:sub_id].to_s, controller: 'graders' , action: 'submission', id: value[:memory][:sub_id])} )".html_safe
118 %td
125 %td
119 = link_to value[:length][:user], controller: 'users', action: 'profile', id: value[:length][:user_id]
126 = link_to value[:length][:user], controller: 'users', action: 'profile', id: value[:length][:user_id]
127 + %br
120 = "(#{value[:length][:value]} @"
128 = "(#{value[:length][:value]} @"
121 = "#{link_to("#" + value[:length][:sub_id].to_s, controller: 'graders' , action: 'submission', id: value[:length][:sub_id])} )".html_safe
129 = "#{link_to("#" + value[:length][:sub_id].to_s, controller: 'graders' , action: 'submission', id: value[:length][:sub_id])} )".html_safe
122 %td
130 %td
123 - if value[:first][:user] != '(NULL)' #TODO: i know... this is wrong...
131 - 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]
132 = link_to value[:first][:user], controller: 'users', action: 'profile', id: value[:first][:user_id]
133 + %br
125 = "(#{value[:first][:value]} @"
134 = "(#{value[:first][:value]} @"
126 = "#{link_to("#" + value[:first][:sub_id].to_s, controller: 'graders' , action: 'submission', id: value[:first][:sub_id])} )".html_safe
135 = "#{link_to("#" + value[:first][:sub_id].to_s, controller: 'graders' , action: 'submission', id: value[:first][:sub_id])} )".html_safe
127
136
@@ -2,22 +2,28
2 /- if params[:id]
2 /- if params[:id]
3 / %h1 Tasks Hall of Fame
3 / %h1 Tasks Hall of Fame
4 / = link_to('[back to All-Time Hall of Fame]', action: 'problem_hof', id: nil )
4 / = link_to('[back to All-Time Hall of Fame]', action: 'problem_hof', id: nil )
5 /- else
5 /- else
6 / %h1 All-Time Hall of Fame
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 - unless params[:id]
21 - unless params[:id]
17 /=render partial: 'all_time_hof'
22 /=render partial: 'all_time_hof'
18 Please select a problem.
23 Please select a problem.
19 - else
24 - else
20 - =render partial: 'task_hof'
25 + %h1 [#{Problem.find(params[:id]).name}] #{Problem.find(params[:id]).full_name}
21 %h2 Submission History
26 %h2 Submission History
22 =render partial: 'application/bar_graph', locals: { histogram: @histogram }
27 =render partial: 'application/bar_graph', locals: { histogram: @histogram }
28 + =render partial: 'task_hof'
23
29
@@ -19,12 +19,15
19 match 'heartbeat/:id/edit' => 'heartbeat#edit'
19 match 'heartbeat/:id/edit' => 'heartbeat#edit'
20
20
21 #main
21 #main
22 get "main/list"
22 get "main/list"
23 get 'main/submission(/:id)', to: 'main#submission', as: 'main_submission'
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 # See how all your routes lay out with "rake routes"
28 # See how all your routes lay out with "rake routes"
26
29
27 # This is a legacy wild controller route that's not recommended for RESTful applications.
30 # This is a legacy wild controller route that's not recommended for RESTful applications.
28 # Note: This route will make all actions in every controller accessible via GET requests.
31 # Note: This route will make all actions in every controller accessible via GET requests.
29 match ':controller(/:action(/:id))(.:format)'
32 match ':controller(/:action(/:id))(.:format)'
30 end
33 end
You need to be logged in to leave comments. Login now