Description:
hall of fame bootrapized
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r560:aaf243e375da - - 5 files changed: 130 inserted, 107 deleted
@@ -15,13 +15,21 | |||
|
15 | 15 | $(".select2").select2() |
|
16 | 16 | #$(".bootstrap-switch").bootstrapSwitch() |
|
17 | 17 | $(".bootstrap-toggle").bootstrapToggle() |
|
18 | 18 | $('.btn-file :file').on 'fileselect', (event, numFiles, label) -> |
|
19 | 19 | input = $(this).parents('.input-group').find(':text') |
|
20 | 20 | log = if numFiles > 1 then numFiles + ' files selected' else label |
|
21 | 21 | if input.length |
|
22 | 22 | input.val log |
|
23 | 23 | else |
|
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,23 +1,12 | |||
|
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 |
|
|
13 | 2 | .hof_user { color: orangered; font-style: italic; } |
|
14 | 3 | .hof_language { color: green; font-style: italic; } |
|
15 | 4 | .hof_value { color: deeppink;font-style: italic; } |
|
16 | 5 | .info_param { font-weight: bold;text-align: right; } |
|
17 | 6 | .tooltip { |
|
18 | 7 | font-family: Verdana,sans-serif; |
|
19 | 8 | font-weight: normal; |
|
20 | 9 | text-align: left; |
|
21 | 10 | font-size: 1.0em; |
|
22 | 11 | color: black; |
|
23 | 12 | line-height: 1.1; |
@@ -25,103 +14,123 | |||
|
25 | 14 | min-width: 20em; |
|
26 | 15 | position: absolute; |
|
27 | 16 | left: 25px; |
|
28 | 17 | bottom: 5px; |
|
29 | 18 | border: 1px solid; |
|
30 | 19 | padding: 5px; |
|
31 | 20 | background-color: #FFF; |
|
32 | 21 | word-wrap: break-word; |
|
33 | 22 | z-index: 9999; |
|
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 |
- |
|
|
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 S |
|
|
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 |
- |
|
|
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 |
- |
|
|
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 |
- |
|
|
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 |
@@ -1,23 +1,29 | |||
|
1 | 1 | |
|
2 | 2 | /- if params[:id] |
|
3 | 3 | / %h1 Tasks Hall of Fame |
|
4 | 4 | / = link_to('[back to All-Time Hall of Fame]', action: 'problem_hof', id: nil ) |
|
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 |
@@ -13,18 +13,21 | |||
|
13 | 13 | resources :problem |
|
14 | 14 | |
|
15 | 15 | resources :grader_configuration, controller: 'configurations' |
|
16 | 16 | |
|
17 | 17 | match 'tasks/view/:file.:ext' => 'tasks#view' |
|
18 | 18 | match 'tasks/download/:id/:file.:ext' => 'tasks#download' |
|
19 | 19 | match 'heartbeat/:id/edit' => 'heartbeat#edit' |
|
20 | 20 | |
|
21 | 21 | #main |
|
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. |
|
28 | 31 | # Note: This route will make all actions in every controller accessible via GET requests. |
|
29 | 32 | match ':controller(/:action(/:id))(.:format)' |
|
30 | 33 | end |
You need to be logged in to leave comments.
Login now