Description:
NOT WORKING
add submission view log
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r528:dfe79b5eef35 - - 7 files changed: 137 inserted, 28 deleted
@@ -0,0 +1,3 | |||||
|
|
1 | + class SubmissionViewLogs < ActiveRecord::Base | ||
|
|
2 | + attr_accessible :submission_id, :user_id | ||
|
|
3 | + end |
@@ -0,0 +1,82 | |||||
|
|
1 | + - content_for :header do | ||
|
|
2 | + = stylesheet_link_tag 'tablesorter-theme.cafe' | ||
|
|
3 | + = javascript_include_tag 'local_jquery' | ||
|
|
4 | + | ||
|
|
5 | + %script{:type=>"text/javascript"} | ||
|
|
6 | + $(function () { | ||
|
|
7 | + $('#since_datetime').datetimepicker({ showButtonPanel: true, dateFormat: "yy-mm-dd", controlType: "slider"} ); | ||
|
|
8 | + $('#until_datetime').datetimepicker({ showButtonPanel: true, dateFormat: "yy-mm-dd", controlType: "slider"} ); | ||
|
|
9 | + $('#my_table').tablesorter({widthFixed: true, widgets: ['zebra']}); | ||
|
|
10 | + $('#my_table2').tablesorter({widthFixed: true, widgets: ['zebra']}); | ||
|
|
11 | + $('#sub_table').tablesorter({widthFixed: true, widgets: ['zebra']}); | ||
|
|
12 | + }); | ||
|
|
13 | + | ||
|
|
14 | + %h1 Login status | ||
|
|
15 | + | ||
|
|
16 | + =render partial: 'report_menu' | ||
|
|
17 | + | ||
|
|
18 | + | ||
|
|
19 | + = form_tag({session: :url }) do | ||
|
|
20 | + .submitbox | ||
|
|
21 | + %table | ||
|
|
22 | + %tr | ||
|
|
23 | + %td{colspan: 6, style: 'font-weight: bold'}= 'Query login & submit in the range' | ||
|
|
24 | + %tr | ||
|
|
25 | + %td{style: 'width: 120px; font-weight: bold'}= 'Login date range' | ||
|
|
26 | + %td{align: 'right'} since: | ||
|
|
27 | + %td= text_field_tag 'since_datetime', @since_time | ||
|
|
28 | + %tr | ||
|
|
29 | + %td | ||
|
|
30 | + %td{align: 'right'} until: | ||
|
|
31 | + %td= text_field_tag 'until_datetime', @until_time | ||
|
|
32 | + %tr | ||
|
|
33 | + %td | ||
|
|
34 | + %td | ||
|
|
35 | + %td Blank mean no condition | ||
|
|
36 | + %tr | ||
|
|
37 | + %td{style: 'width: 120px; font-weight: bold'}= "ID" | ||
|
|
38 | + %td{colspan: 2}= text_field_tag 'SID', @sid, size: 40 | ||
|
|
39 | + %tr | ||
|
|
40 | + %td | ||
|
|
41 | + %td | ||
|
|
42 | + %td= submit_tag 'query' | ||
|
|
43 | + | ||
|
|
44 | + | ||
|
|
45 | + %h2 Logs | ||
|
|
46 | + | ||
|
|
47 | + - if @sid | ||
|
|
48 | + %table | ||
|
|
49 | + %tbody | ||
|
|
50 | + - @sid.each do |id| | ||
|
|
51 | + - user = User.where("login = ?",id).first | ||
|
|
52 | + %tr | ||
|
|
53 | + //%td= link_to id, controller: :user, action: :profile, id: id | ||
|
|
54 | + %td= link_to id, "https://www.nattee.net/java/users/profile/#{user.id}" | ||
|
|
55 | + %td= user.full_name | ||
|
|
56 | + | ||
|
|
57 | + //%table.tablesorter-cafe#my_table | ||
|
|
58 | + %table.info | ||
|
|
59 | + %thead | ||
|
|
60 | + %tr.info-head | ||
|
|
61 | + %th Time | ||
|
|
62 | + %th Action | ||
|
|
63 | + %th IP | ||
|
|
64 | + %th login | ||
|
|
65 | + %th name | ||
|
|
66 | + %th problem | ||
|
|
67 | + %th score | ||
|
|
68 | + %tbody | ||
|
|
69 | + - if @logs | ||
|
|
70 | + - @logs.each do |l| | ||
|
|
71 | + %tr{class: cycle('info-even','info-odd')} | ||
|
|
72 | + %td= l[:submitted_at].strftime "%Y.%b.%d %H:%M:%S" | ||
|
|
73 | + //%td= l[:id] == -1 ? "LOGIN" : link_to("submit #{l[:id]}", controller: 'graders' , action: 'submission', id: l[:id]) | ||
|
|
74 | + %td= l[:id] == -1 ? "LOGIN" : link_to( "submit #{l[:id]}", "https://www.nattee.net/java/graders/submission/#{l[:id]}") | ||
|
|
75 | + %td= l[:ip_address] | ||
|
|
76 | + //%td= link_to l[:login], controller: 'users', action: 'profile', id: l[:id] | ||
|
|
77 | + %td= link_to( l[:login], "https://www.nattee.net/java/users/profile/#{l.user_id}") | ||
|
|
78 | + %td= l[:full_name] | ||
|
|
79 | + %td= l[:id] == -1 ? "" : l.problem.name | ||
|
|
80 | + %td= l[:id] == -1 ? "" : l.points * 100/ l.problem.full_score | ||
|
|
81 | + | ||
|
|
82 | + |
@@ -0,0 +1,10 | |||||
|
|
1 | + class CreateSubmissionViewLogs < ActiveRecord::Migration | ||
|
|
2 | + def change | ||
|
|
3 | + create_table :submission_view_logs do |t| | ||
|
|
4 | + t.integer :user_id | ||
|
|
5 | + t.integer :submission_id | ||
|
|
6 | + | ||
|
|
7 | + t.timestamps | ||
|
|
8 | + end | ||
|
|
9 | + end | ||
|
|
10 | + end |
@@ -0,0 +1,5 | |||||
|
|
1 | + require 'spec_helper' | ||
|
|
2 | + | ||
|
|
3 | + describe SubmissionViewLogs do | ||
|
|
4 | + pending "add some examples to (or delete) #{__FILE__}" | ||
|
|
5 | + end |
@@ -75,13 +75,13 | |||||
|
75 | json (1.8.2) |
|
75 | json (1.8.2) |
|
76 | mail (2.5.4) |
|
76 | mail (2.5.4) |
|
77 | mime-types (~> 1.16) |
|
77 | mime-types (~> 1.16) |
|
78 | treetop (~> 1.4.8) |
|
78 | treetop (~> 1.4.8) |
|
79 | mime-types (1.25.1) |
|
79 | mime-types (1.25.1) |
|
80 | multi_json (1.10.1) |
|
80 | multi_json (1.10.1) |
|
81 |
- mysql2 (0.3. |
|
81 | + mysql2 (0.3.20) |
|
82 | polyglot (0.3.5) |
|
82 | polyglot (0.3.5) |
|
83 | power_assert (0.2.2) |
|
83 | power_assert (0.2.2) |
|
84 | prototype-rails (3.2.1) |
|
84 | prototype-rails (3.2.1) |
|
85 | rails (~> 3.2) |
|
85 | rails (~> 3.2) |
|
86 | rack (1.4.5) |
|
86 | rack (1.4.5) |
|
87 | rack-cache (1.2) |
|
87 | rack-cache (1.2) |
@@ -83,12 +83,14 | |||||
|
83 | when "java" then Rouge::Lexers::Java.new |
|
83 | when "java" then Rouge::Lexers::Java.new |
|
84 | when "php" then Rouge::Lexers::PHP.new |
|
84 | when "php" then Rouge::Lexers::PHP.new |
|
85 | end |
|
85 | end |
|
86 | @formatted_code = formatter.format(lexer.lex(@submission.source)) |
|
86 | @formatted_code = formatter.format(lexer.lex(@submission.source)) |
|
87 | @css_style = Rouge::Themes::ThankfulEyes.render(scope: '.highlight') |
|
87 | @css_style = Rouge::Themes::ThankfulEyes.render(scope: '.highlight') |
|
88 |
|
88 | ||
|
|
89 | + SubmissionLogView.create(user_id: user.id,submission_id: @submission.id) | ||
|
|
90 | + | ||
|
89 | end |
|
91 | end |
|
90 |
|
92 | ||
|
91 | # various grader controls |
|
93 | # various grader controls |
|
92 |
|
94 | ||
|
93 | def stop |
|
95 | def stop |
|
94 | grader_proc = GraderProcess.find(params[:id]) |
|
96 | grader_proc = GraderProcess.find(params[:id]) |
@@ -8,22 +8,22 | |||||
|
8 | # system, you should be using db:schema:load, not running all the migrations |
|
8 | # system, you should be using db:schema:load, not running all the migrations |
|
9 | # from scratch. The latter is a flawed and unsustainable approach (the more migrations |
|
9 | # from scratch. The latter is a flawed and unsustainable approach (the more migrations |
|
10 | # you'll amass, the slower it'll run and the greater likelihood for issues). |
|
10 | # you'll amass, the slower it'll run and the greater likelihood for issues). |
|
11 | # |
|
11 | # |
|
12 | # It's strongly recommended to check this file into your version control system. |
|
12 | # It's strongly recommended to check this file into your version control system. |
|
13 |
|
13 | ||
|
14 |
- ActiveRecord::Schema.define(:version => 20150 |
|
14 | + ActiveRecord::Schema.define(:version => 20150827131927) do |
|
15 |
|
15 | ||
|
16 | create_table "announcements", :force => true do |t| |
|
16 | create_table "announcements", :force => true do |t| |
|
17 | t.string "author" |
|
17 | t.string "author" |
|
18 | - t.text "body" |
|
18 | + t.text "body", :limit => 16777215 |
|
19 | t.boolean "published" |
|
19 | t.boolean "published" |
|
20 | - t.datetime "created_at", :null => false |
|
20 | + t.datetime "created_at", :null => false |
|
21 | - t.datetime "updated_at", :null => false |
|
21 | + t.datetime "updated_at", :null => false |
|
22 | - t.boolean "frontpage", :default => false |
|
22 | + t.boolean "frontpage", :default => false |
|
23 | - t.boolean "contest_only", :default => false |
|
23 | + t.boolean "contest_only", :default => false |
|
24 | t.string "title" |
|
24 | t.string "title" |
|
25 | t.string "notes" |
|
25 | t.string "notes" |
|
26 | end |
|
26 | end |
|
27 |
|
27 | ||
|
28 | create_table "contests", :force => true do |t| |
|
28 | create_table "contests", :force => true do |t| |
|
29 | t.string "title" |
|
29 | t.string "title" |
@@ -47,25 +47,25 | |||||
|
47 | t.string "name" |
|
47 | t.string "name" |
|
48 | t.datetime "created_at", :null => false |
|
48 | t.datetime "created_at", :null => false |
|
49 | t.datetime "updated_at", :null => false |
|
49 | t.datetime "updated_at", :null => false |
|
50 | end |
|
50 | end |
|
51 |
|
51 | ||
|
52 | create_table "descriptions", :force => true do |t| |
|
52 | create_table "descriptions", :force => true do |t| |
|
53 | - t.text "body" |
|
53 | + t.text "body", :limit => 16777215 |
|
54 | t.boolean "markdowned" |
|
54 | t.boolean "markdowned" |
|
55 | - t.datetime "created_at", :null => false |
|
55 | + t.datetime "created_at", :null => false |
|
56 | - t.datetime "updated_at", :null => false |
|
56 | + t.datetime "updated_at", :null => false |
|
57 | end |
|
57 | end |
|
58 |
|
58 | ||
|
59 | create_table "grader_configurations", :force => true do |t| |
|
59 | create_table "grader_configurations", :force => true do |t| |
|
60 | t.string "key" |
|
60 | t.string "key" |
|
61 | t.string "value_type" |
|
61 | t.string "value_type" |
|
62 | t.string "value" |
|
62 | t.string "value" |
|
63 | - t.datetime "created_at", :null => false |
|
63 | + t.datetime "created_at", :null => false |
|
64 | - t.datetime "updated_at", :null => false |
|
64 | + t.datetime "updated_at", :null => false |
|
65 | - t.text "description" |
|
65 | + t.text "description", :limit => 16777215 |
|
66 | end |
|
66 | end |
|
67 |
|
67 | ||
|
68 | create_table "grader_processes", :force => true do |t| |
|
68 | create_table "grader_processes", :force => true do |t| |
|
69 | t.string "host", :limit => 20 |
|
69 | t.string "host", :limit => 20 |
|
70 | t.integer "pid" |
|
70 | t.integer "pid" |
|
71 | t.string "mode" |
|
71 | t.string "mode" |
@@ -94,16 +94,16 | |||||
|
94 | end |
|
94 | end |
|
95 |
|
95 | ||
|
96 | create_table "messages", :force => true do |t| |
|
96 | create_table "messages", :force => true do |t| |
|
97 | t.integer "sender_id" |
|
97 | t.integer "sender_id" |
|
98 | t.integer "receiver_id" |
|
98 | t.integer "receiver_id" |
|
99 | t.integer "replying_message_id" |
|
99 | t.integer "replying_message_id" |
|
100 | - t.text "body" |
|
100 | + t.text "body", :limit => 16777215 |
|
101 | t.boolean "replied" |
|
101 | t.boolean "replied" |
|
102 | - t.datetime "created_at", :null => false |
|
102 | + t.datetime "created_at", :null => false |
|
103 | - t.datetime "updated_at", :null => false |
|
103 | + t.datetime "updated_at", :null => false |
|
104 | end |
|
104 | end |
|
105 |
|
105 | ||
|
106 | create_table "problems", :force => true do |t| |
|
106 | create_table "problems", :force => true do |t| |
|
107 | t.string "name", :limit => 30 |
|
107 | t.string "name", :limit => 30 |
|
108 | t.string "full_name" |
|
108 | t.string "full_name" |
|
109 | t.integer "full_score" |
|
109 | t.integer "full_score" |
@@ -139,13 +139,13 | |||||
|
139 | end |
|
139 | end |
|
140 |
|
140 | ||
|
141 | add_index "roles_users", ["user_id"], :name => "index_roles_users_on_user_id" |
|
141 | add_index "roles_users", ["user_id"], :name => "index_roles_users_on_user_id" |
|
142 |
|
142 | ||
|
143 | create_table "sessions", :force => true do |t| |
|
143 | create_table "sessions", :force => true do |t| |
|
144 | t.string "session_id" |
|
144 | t.string "session_id" |
|
145 | - t.text "data" |
|
145 | + t.text "data", :limit => 16777215 |
|
146 | t.datetime "updated_at" |
|
146 | t.datetime "updated_at" |
|
147 | end |
|
147 | end |
|
148 |
|
148 | ||
|
149 | add_index "sessions", ["session_id"], :name => "index_sessions_on_session_id" |
|
149 | add_index "sessions", ["session_id"], :name => "index_sessions_on_session_id" |
|
150 | add_index "sessions", ["updated_at"], :name => "index_sessions_on_updated_at" |
|
150 | add_index "sessions", ["updated_at"], :name => "index_sessions_on_updated_at" |
|
151 |
|
151 | ||
@@ -156,24 +156,31 | |||||
|
156 | t.datetime "created_at", :null => false |
|
156 | t.datetime "created_at", :null => false |
|
157 | t.datetime "updated_at", :null => false |
|
157 | t.datetime "updated_at", :null => false |
|
158 | t.integer "country_id" |
|
158 | t.integer "country_id" |
|
159 | t.string "password" |
|
159 | t.string "password" |
|
160 | end |
|
160 | end |
|
161 |
|
161 | ||
|
|
162 | + create_table "submission_view_logs", :force => true do |t| | ||
|
|
163 | + t.integer "user_id" | ||
|
|
164 | + t.integer "submission_id" | ||
|
|
165 | + t.datetime "created_at", :null => false | ||
|
|
166 | + t.datetime "updated_at", :null => false | ||
|
|
167 | + end | ||
|
|
168 | + | ||
|
162 | create_table "submissions", :force => true do |t| |
|
169 | create_table "submissions", :force => true do |t| |
|
163 | t.integer "user_id" |
|
170 | t.integer "user_id" |
|
164 | t.integer "problem_id" |
|
171 | t.integer "problem_id" |
|
165 | t.integer "language_id" |
|
172 | t.integer "language_id" |
|
166 | - t.text "source" |
|
173 | + t.text "source", :limit => 16777215 |
|
167 | t.binary "binary" |
|
174 | t.binary "binary" |
|
168 | t.datetime "submitted_at" |
|
175 | t.datetime "submitted_at" |
|
169 | t.datetime "compiled_at" |
|
176 | t.datetime "compiled_at" |
|
170 | - t.text "compiler_message" |
|
177 | + t.text "compiler_message", :limit => 16777215 |
|
171 | t.datetime "graded_at" |
|
178 | t.datetime "graded_at" |
|
172 | t.integer "points" |
|
179 | t.integer "points" |
|
173 | - t.text "grader_comment" |
|
180 | + t.text "grader_comment", :limit => 16777215 |
|
174 | t.integer "number" |
|
181 | t.integer "number" |
|
175 | t.string "source_filename" |
|
182 | t.string "source_filename" |
|
176 | t.float "max_runtime" |
|
183 | t.float "max_runtime" |
|
177 | t.integer "peak_memory" |
|
184 | t.integer "peak_memory" |
|
178 | t.integer "effective_code_length" |
|
185 | t.integer "effective_code_length" |
|
179 | t.string "ip_address" |
|
186 | t.string "ip_address" |
@@ -188,33 +195,33 | |||||
|
188 | t.integer "status" |
|
195 | t.integer "status" |
|
189 | t.datetime "updated_at" |
|
196 | t.datetime "updated_at" |
|
190 | end |
|
197 | end |
|
191 |
|
198 | ||
|
192 | create_table "test_pairs", :force => true do |t| |
|
199 | create_table "test_pairs", :force => true do |t| |
|
193 | t.integer "problem_id" |
|
200 | t.integer "problem_id" |
|
194 |
- t.text "input", :limit => |
|
201 | + t.text "input", :limit => 2147483647 |
|
195 |
- t.text "solution", :limit => |
|
202 | + t.text "solution", :limit => 2147483647 |
|
196 | - t.datetime "created_at", :null => false |
|
203 | + t.datetime "created_at", :null => false |
|
197 | - t.datetime "updated_at", :null => false |
|
204 | + t.datetime "updated_at", :null => false |
|
198 | end |
|
205 | end |
|
199 |
|
206 | ||
|
200 | create_table "test_requests", :force => true do |t| |
|
207 | create_table "test_requests", :force => true do |t| |
|
201 | t.integer "user_id" |
|
208 | t.integer "user_id" |
|
202 | t.integer "problem_id" |
|
209 | t.integer "problem_id" |
|
203 | t.integer "submission_id" |
|
210 | t.integer "submission_id" |
|
204 | t.string "input_file_name" |
|
211 | t.string "input_file_name" |
|
205 | t.string "output_file_name" |
|
212 | t.string "output_file_name" |
|
206 | t.string "running_stat" |
|
213 | t.string "running_stat" |
|
207 | t.integer "status" |
|
214 | t.integer "status" |
|
208 | - t.datetime "updated_at", :null => false |
|
215 | + t.datetime "updated_at", :null => false |
|
209 | t.datetime "submitted_at" |
|
216 | t.datetime "submitted_at" |
|
210 | t.datetime "compiled_at" |
|
217 | t.datetime "compiled_at" |
|
211 | - t.text "compiler_message" |
|
218 | + t.text "compiler_message", :limit => 16777215 |
|
212 | t.datetime "graded_at" |
|
219 | t.datetime "graded_at" |
|
213 | t.string "grader_comment" |
|
220 | t.string "grader_comment" |
|
214 | - t.datetime "created_at", :null => false |
|
221 | + t.datetime "created_at", :null => false |
|
215 | t.float "running_time" |
|
222 | t.float "running_time" |
|
216 | t.string "exit_status" |
|
223 | t.string "exit_status" |
|
217 | t.integer "memory_usage" |
|
224 | t.integer "memory_usage" |
|
218 | end |
|
225 | end |
|
219 |
|
226 | ||
|
220 | add_index "test_requests", ["user_id", "problem_id"], :name => "index_test_requests_on_user_id_and_problem_id" |
|
227 | add_index "test_requests", ["user_id", "problem_id"], :name => "index_test_requests_on_user_id_and_problem_id" |
@@ -236,14 +243,14 | |||||
|
236 | t.string "email" |
|
243 | t.string "email" |
|
237 | t.integer "site_id" |
|
244 | t.integer "site_id" |
|
238 | t.integer "country_id" |
|
245 | t.integer "country_id" |
|
239 | t.boolean "activated", :default => false |
|
246 | t.boolean "activated", :default => false |
|
240 | t.datetime "created_at" |
|
247 | t.datetime "created_at" |
|
241 | t.datetime "updated_at" |
|
248 | t.datetime "updated_at" |
|
|
249 | + t.string "section" | ||
|
242 | t.boolean "enabled", :default => true |
|
250 | t.boolean "enabled", :default => true |
|
243 | t.string "remark" |
|
251 | t.string "remark" |
|
244 | - t.string "last_ip" |
|
||
|
245 | end |
|
252 | end |
|
246 |
|
253 | ||
|
247 | add_index "users", ["login"], :name => "index_users_on_login", :unique => true |
|
254 | add_index "users", ["login"], :name => "index_users_on_login", :unique => true |
|
248 |
|
255 | ||
|
249 | end |
|
256 | end |
You need to be logged in to leave comments.
Login now