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: 74 inserted, 51 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 | |
|
27 | 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,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 |
|
|
13 | 2 | .hof_user { color: orangered; font-style: italic; } |
|
14 | 3 | .hof_language { color: green; font-style: italic; } |
@@ -34,70 +23,86 | |||
|
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 | |
|
27 | + .container | |
|
28 | + .row | |
|
29 | + .col-md-4 | |
|
30 | + %h2 Overall Stat | |
|
31 | + %table.table.table-hover | |
|
41 | 32 | %thead |
|
42 | - %tr.info-head | |
|
43 |
- %th |
|
|
44 |
- %th |
|
|
33 | + %tr | |
|
34 | + %th | |
|
35 | + %th | |
|
45 | 36 | %tbody |
|
46 | - %tr{class: cycle('info-even','info-odd')} | |
|
37 | + %tr | |
|
47 | 38 | %td.info_param Submissions |
|
48 | 39 | %td= @summary[:count] |
|
49 | - %tr{class: cycle('info-even','info-odd')} | |
|
40 | + %tr | |
|
50 | 41 | %td.info_param Solved/Attempted User |
|
51 | 42 | %td #{@summary[:solve]}/#{@summary[:attempt]} (#{(@summary[:solve]*100.0/@summary[:attempt]).round(1)}%) |
|
52 | 43 | - if @best |
|
53 | - %tr{class: cycle('info-even','info-odd')} | |
|
44 | + %tr | |
|
54 | 45 | %td.info_param Best Runtime |
|
55 | 46 | %td |
|
56 | 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> | |
|
58 |
- |
|
|
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 | |
|
59 | 53 | at submission |
|
60 | 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 | 57 | %td.info_param |
|
64 | 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 | 64 | %td |
|
71 | 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> | |
|
73 |
- |
|
|
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 | |
|
74 | 71 | at submission |
|
75 | 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 | 75 | %td.info_param Shortest Code |
|
79 | 76 | %td |
|
80 | 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> | |
|
82 |
- |
|
|
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 | 83 | at submission |
|
84 | 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 | 87 | %td.info_param First solver |
|
88 | 88 | %td |
|
89 | + - if @best[:first][:user] != '(NULL)' | |
|
89 | 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 |
- |
|
|
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 | |
|
92 | 96 | at submission |
|
93 | 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 | 101 | - if @best |
|
96 |
- %h2 By |
|
|
97 | - | |
|
98 | - %table.info | |
|
102 | + %h2 By Language | |
|
103 | + %table.table.table-hover | |
|
99 | 104 | %thead |
|
100 | - %tr.info-head | |
|
105 | + %tr | |
|
101 | 106 | %th Language |
|
102 | 107 | %th Best runtime (ms) |
|
103 | 108 | %th Best memory (kbytes) |
@@ -105,23 +110,27 | |||
|
105 | 110 | %th First solver |
|
106 | 111 | %tbody |
|
107 | 112 | - @by_lang.each do |lang,value| |
|
108 | - %tr{class: cycle('info-even','info-odd')} | |
|
113 | + %tr | |
|
109 | 114 | %td= lang |
|
110 | 115 | %td |
|
111 | 116 | = link_to value[:runtime][:user], controller: 'users', action: 'profile', id: value[:runtime][:user_id] |
|
117 | + %br | |
|
112 | 118 | = "(#{(value[:runtime][:value] * 1000).to_i} @" |
|
113 | 119 | = "#{link_to("#" + value[:runtime][:sub_id].to_s, controller: 'graders' , action: 'submission', id: value[:runtime][:sub_id])} )".html_safe |
|
114 | 120 | %td |
|
115 | 121 | = link_to value[:memory][:user], controller: 'users', action: 'profile', id: value[:memory][:user_id] |
|
122 | + %br | |
|
116 | 123 | = "(#{number_with_delimiter(value[:memory][:value])} @" |
|
117 | 124 | = "#{link_to("#" + value[:memory][:sub_id].to_s, controller: 'graders' , action: 'submission', id: value[:memory][:sub_id])} )".html_safe |
|
118 | 125 | %td |
|
119 | 126 | = link_to value[:length][:user], controller: 'users', action: 'profile', id: value[:length][:user_id] |
|
127 | + %br | |
|
120 | 128 | = "(#{value[:length][:value]} @" |
|
121 | 129 | = "#{link_to("#" + value[:length][:sub_id].to_s, controller: 'graders' , action: 'submission', id: value[:length][:sub_id])} )".html_safe |
|
122 | 130 | %td |
|
123 | 131 | - if value[:first][:user] != '(NULL)' #TODO: i know... this is wrong... |
|
124 | 132 | = link_to value[:first][:user], controller: 'users', action: 'profile', id: value[:first][:user_id] |
|
133 | + %br | |
|
125 | 134 | = "(#{value[:first][:value]} @" |
|
126 | 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