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 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
32 + return
27 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,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 :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; }
@@ -34,94 +23,114
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
41 - %thead
29 + .col-md-4
42 - %tr.info-head
30 + %h2 Overall Stat
43 - %th Stat
31 + %table.table.table-hover
44 - %th Value
32 + %thead
45 - %tbody
33 + %tr
46 - %tr{class: cycle('info-even','info-odd')}
34 + %th
47 - %td.info_param Submissions
35 + %th
48 - %td= @summary[:count]
36 + %tbody
49 - %tr{class: cycle('info-even','info-odd')}
37 + %tr
50 - %td.info_param Solved/Attempted User
38 + %td.info_param Submissions
51 - %td #{@summary[:solve]}/#{@summary[:attempt]} (#{(@summary[:solve]*100.0/@summary[:attempt]).round(1)}%)
39 + %td= @summary[:count]
52 - - if @best
40 + %tr
53 - %tr{class: cycle('info-even','info-odd')}
41 + %td.info_param Solved/Attempted User
54 - %td.info_param Best Runtime
42 + %td #{@summary[:solve]}/#{@summary[:attempt]} (#{(@summary[:solve]*100.0/@summary[:attempt]).round(1)}%)
55 - %td
43 + - if @best
56 - by #{link_to @best[:runtime][:user], controller:'users', action:'profile', id:@best[:memory][:user_id]}
44 + %tr
57 - using <span class="hof_language">#{@best[:runtime][:lang]}</span>
45 + %td.info_param Best Runtime
58 - with <span class="hof_value">#{@best[:runtime][:value] * 1000} milliseconds</span>
46 + %td
59 - at submission
47 + by #{link_to @best[:runtime][:user], controller:'users', action:'profile', id:@best[:memory][:user_id]}
60 - = link_to("#" + @best[:runtime][:sub_id].to_s, controller: 'graders', action: 'submission', id:@best[:runtime][:sub_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')}
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",
66 - [?]
60 + style: "position:relative; color: blue;",
67 - %span.tooltip#mem_remark_box
61 + data: {toggle: 'tooltip', placement: 'top', animation: 'false', delay: 20},
68 - This counts only for submission with 100% score.
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...)"}
69 - Right now, java is excluded from memory usage competition. (Because it always uses 2GB memory...)
63 + [?]
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>
74 - at submission
68 + %br
75 - = link_to("#" + @best[:memory][:sub_id].to_s, controller: 'graders' , action: 'submission', id:@best[:memory][:sub_id])
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')}
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>
83 - at submission
80 + %br
84 - = link_to("#" + @best[:length][:sub_id].to_s, controller: 'graders' , action: 'submission', id: @best[:length][:sub_id])
81 + with <span class="text-success">#{@best[:length][:value]} bytes</span>
85 -
82 + %br
86 - %tr{class: cycle('info-even','info-odd')}
83 + at submission
87 - %td.info_param First solver
84 + = link_to("#" + @best[:length][:sub_id].to_s, controller: 'graders' , action: 'submission', id: @best[:length][:sub_id])
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
97
85
98 - %table.info
86 + %tr
99 - %thead
87 + %td.info_param First solver
100 - %tr.info-head
88 + %td
101 - %th Language
89 + - if @best[:first][:user] != '(NULL)'
102 - %th Best runtime (ms)
90 + #{link_to @best[:first][:user], controller:'users', action:'profile', id:@best[:first][:user_id]} is the first solver
103 - %th Best memory (kbytes)
91 + %br
104 - %th Shortest Code (bytes)
92 + using <span class="text-success">#{@best[:first][:lang]}</span>
105 - %th First solver
93 + %br
106 - %tbody
94 + on <span class="text-success">#{@best[:first][:value]}</span>
107 - - @by_lang.each do |lang,value|
95 + %br
108 - %tr{class: cycle('info-even','info-odd')}
96 + at submission
109 - %td= lang
97 + = link_to("#" + @best[:first][:sub_id].to_s, controller: 'graders' , action: 'submission', id: @best[:first][:sub_id])
110 - %td
98 + - else
111 - = link_to value[:runtime][:user], controller: 'users', action: 'profile', id: value[:runtime][:user_id]
99 + no first solver
112 - = "(#{(value[:runtime][:value] * 1000).to_i} @"
100 + .col-md-8
113 - = "#{link_to("#" + value[:runtime][:sub_id].to_s, controller: 'graders' , action: 'submission', id: value[:runtime][:sub_id])} )".html_safe
101 + - if @best
114 - %td
102 + %h2 By Language
115 - = link_to value[:memory][:user], controller: 'users', action: 'profile', id: value[:memory][:user_id]
103 + %table.table.table-hover
116 - = "(#{number_with_delimiter(value[:memory][:value])} @"
104 + %thead
117 - = "#{link_to("#" + value[:memory][:sub_id].to_s, controller: 'graders' , action: 'submission', id: value[:memory][:sub_id])} )".html_safe
105 + %tr
118 - %td
106 + %th Language
119 - = link_to value[:length][:user], controller: 'users', action: 'profile', id: value[:length][:user_id]
107 + %th Best runtime (ms)
120 - = "(#{value[:length][:value]} @"
108 + %th Best memory (kbytes)
121 - = "#{link_to("#" + value[:length][:sub_id].to_s, controller: 'graders' , action: 'submission', id: value[:length][:sub_id])} )".html_safe
109 + %th Shortest Code (bytes)
122 - %td
110 + %th First solver
123 - - if value[:first][:user] != '(NULL)' #TODO: i know... this is wrong...
111 + %tbody
124 - = link_to value[:first][:user], controller: 'users', action: 'profile', id: value[:first][:user_id]
112 + - @by_lang.each do |lang,value|
125 - = "(#{value[:first][:value]} @"
113 + %tr
126 - = "#{link_to("#" + value[:first][:sub_id].to_s, controller: 'graders' , action: 'submission', id: value[:first][:sub_id])} )".html_safe
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 /- 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
@@ -22,6 +22,9
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.
You need to be logged in to leave comments. Login now