Description:
keep all heartbeat instead of only the latest one
(grafted from 0bdf62fde5fdb94d6f94c2b8b8ebc58ffbe8d2f9)
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r544:63ac076b653a - - 2 files changed: 24 inserted, 23 deleted
@@ -5,23 +5,24 | |||||
|
5 | @user = User.find_by_login(params[:id]) |
|
5 | @user = User.find_by_login(params[:id]) |
|
6 | unless @user |
|
6 | unless @user |
|
7 | render text: "LOGIN_NOT_FOUND" |
|
7 | render text: "LOGIN_NOT_FOUND" |
|
8 | return |
|
8 | return |
|
9 | end |
|
9 | end |
|
10 |
|
10 | ||
|
11 | - hb = HeartBeat.where(user_id: @user.id, ip_address: request.remote_ip).first |
|
11 | + #hb = HeartBeat.where(user_id: @user.id, ip_address: request.remote_ip).first |
|
12 | - puts "status = #{params[:status]}" |
|
12 | + #puts "status = #{params[:status]}" |
|
13 | - if hb |
|
13 | + #if hb |
|
14 | - if params[:status] |
|
14 | + # if params[:status] |
|
15 | - hb.status = params[:status] |
|
15 | + # hb.status = params[:status] |
|
16 | - hb.save |
|
16 | + # hb.save |
|
17 | - end |
|
17 | + # end |
|
18 | - hb.touch |
|
18 | + # hb.touch |
|
19 | - else |
|
19 | + #else |
|
20 | - HeartBeat.creae(user_id: @user.id, ip_address: request.remote_ip) |
|
20 | + # HeartBeat.creae(user_id: @user.id, ip_address: request.remote_ip) |
|
21 | - end |
|
21 | + #end |
|
|
22 | + HeartBeat.create(user_id: @user.id, ip_address: request.remote_ip, status: params[:status]) | ||
|
22 | render text: "OK" |
|
23 | render text: "OK" |
|
23 | end |
|
24 | end |
|
24 |
|
25 | ||
|
25 | def index |
|
26 | def index |
|
26 | @hb = HeartBeat.includes(:user).order(:user_id).all |
|
27 | @hb = HeartBeat.includes(:user).order(:user_id).all |
|
27 | @num = HeartBeat.where("updated_at >= ?",Time.zone.now-5.minutes).count |
|
28 | @num = HeartBeat.where("updated_at >= ?",Time.zone.now-5.minutes).count |
@@ -12,13 +12,13 | |||||
|
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 => 20150914223258) do |
|
14 | ActiveRecord::Schema.define(:version => 20150914223258) 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" |
|
19 | t.boolean "published" |
|
19 | t.boolean "published" |
|
20 |
t.datetime "created_at", |
|
20 | t.datetime "created_at", :null => false |
|
21 |
t.datetime "updated_at", |
|
21 | t.datetime "updated_at", :null => false |
|
22 |
t.boolean "frontpage", |
|
22 | t.boolean "frontpage", :default => false |
|
23 |
t.boolean "contest_only", |
|
23 | t.boolean "contest_only", :default => false |
|
24 | t.string "title" |
|
24 | 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" |
|
54 | t.boolean "markdowned" |
|
54 | t.boolean "markdowned" |
|
55 |
t.datetime "created_at", |
|
55 | t.datetime "created_at", :null => false |
|
56 |
t.datetime "updated_at", |
|
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", |
|
63 | t.datetime "created_at", :null => false |
|
64 |
t.datetime "updated_at", |
|
64 | t.datetime "updated_at", :null => false |
|
65 |
- t.text "description" |
|
65 | + t.text "description" |
|
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" |
@@ -102,13 +102,13 | |||||
|
102 | end |
|
102 | end |
|
103 |
|
103 | ||
|
104 | create_table "messages", :force => true do |t| |
|
104 | create_table "messages", :force => true do |t| |
|
105 | t.integer "sender_id" |
|
105 | t.integer "sender_id" |
|
106 | t.integer "receiver_id" |
|
106 | t.integer "receiver_id" |
|
107 | t.integer "replying_message_id" |
|
107 | t.integer "replying_message_id" |
|
108 | - t.text "body", :limit => 16777215 |
|
108 | + t.text "body" |
|
109 | t.boolean "replied" |
|
109 | t.boolean "replied" |
|
110 |
t.datetime "created_at", |
|
110 | t.datetime "created_at", :null => false |
|
111 |
t.datetime "updated_at", |
|
111 | t.datetime "updated_at", :null => false |
|
112 | end |
|
112 | end |
|
113 |
|
113 | ||
|
114 | create_table "problems", :force => true do |t| |
|
114 | create_table "problems", :force => true do |t| |
@@ -147,13 +147,13 | |||||
|
147 | end |
|
147 | end |
|
148 |
|
148 | ||
|
149 | add_index "roles_users", ["user_id"], :name => "index_roles_users_on_user_id" |
|
149 | add_index "roles_users", ["user_id"], :name => "index_roles_users_on_user_id" |
|
150 |
|
150 | ||
|
151 | create_table "sessions", :force => true do |t| |
|
151 | create_table "sessions", :force => true do |t| |
|
152 | t.string "session_id" |
|
152 | t.string "session_id" |
|
153 |
- t.text "data" |
|
153 | + t.text "data" |
|
154 | t.datetime "updated_at" |
|
154 | t.datetime "updated_at" |
|
155 | end |
|
155 | end |
|
156 |
|
156 | ||
|
157 | add_index "sessions", ["session_id"], :name => "index_sessions_on_session_id" |
|
157 | add_index "sessions", ["session_id"], :name => "index_sessions_on_session_id" |
|
158 | add_index "sessions", ["updated_at"], :name => "index_sessions_on_updated_at" |
|
158 | add_index "sessions", ["updated_at"], :name => "index_sessions_on_updated_at" |
|
159 |
|
159 | ||
@@ -175,20 +175,20 | |||||
|
175 | end |
|
175 | end |
|
176 |
|
176 | ||
|
177 | create_table "submissions", :force => true do |t| |
|
177 | create_table "submissions", :force => true do |t| |
|
178 | t.integer "user_id" |
|
178 | t.integer "user_id" |
|
179 | t.integer "problem_id" |
|
179 | t.integer "problem_id" |
|
180 | t.integer "language_id" |
|
180 | t.integer "language_id" |
|
181 | - t.text "source", :limit => 16777215 |
|
181 | + t.text "source" |
|
182 | t.binary "binary" |
|
182 | t.binary "binary" |
|
183 | t.datetime "submitted_at" |
|
183 | t.datetime "submitted_at" |
|
184 | t.datetime "compiled_at" |
|
184 | t.datetime "compiled_at" |
|
185 |
- t.text "compiler_message" |
|
185 | + t.text "compiler_message" |
|
186 | t.datetime "graded_at" |
|
186 | t.datetime "graded_at" |
|
187 | t.integer "points" |
|
187 | t.integer "points" |
|
188 |
- t.text "grader_comment" |
|
188 | + t.text "grader_comment" |
|
189 | t.integer "number" |
|
189 | t.integer "number" |
|
190 | t.string "source_filename" |
|
190 | t.string "source_filename" |
|
191 | t.float "max_runtime" |
|
191 | t.float "max_runtime" |
|
192 | t.integer "peak_memory" |
|
192 | t.integer "peak_memory" |
|
193 | t.integer "effective_code_length" |
|
193 | t.integer "effective_code_length" |
|
194 | t.string "ip_address" |
|
194 | t.string "ip_address" |
@@ -203,14 +203,14 | |||||
|
203 | t.integer "status" |
|
203 | t.integer "status" |
|
204 | t.datetime "updated_at" |
|
204 | t.datetime "updated_at" |
|
205 | end |
|
205 | end |
|
206 |
|
206 | ||
|
207 | create_table "test_pairs", :force => true do |t| |
|
207 | create_table "test_pairs", :force => true do |t| |
|
208 | t.integer "problem_id" |
|
208 | t.integer "problem_id" |
|
209 |
- t.text "input", :limit => |
|
209 | + t.text "input", :limit => 16777215 |
|
210 |
- t.text "solution", :limit => |
|
210 | + t.text "solution", :limit => 16777215 |
|
211 |
t.datetime "created_at", |
|
211 | t.datetime "created_at", :null => false |
|
212 |
t.datetime "updated_at", |
|
212 | t.datetime "updated_at", :null => false |
|
213 | end |
|
213 | end |
|
214 |
|
214 | ||
|
215 | create_table "test_requests", :force => true do |t| |
|
215 | create_table "test_requests", :force => true do |t| |
|
216 | t.integer "user_id" |
|
216 | t.integer "user_id" |
@@ -220,13 +220,13 | |||||
|
220 | t.string "output_file_name" |
|
220 | t.string "output_file_name" |
|
221 | t.string "running_stat" |
|
221 | t.string "running_stat" |
|
222 | t.integer "status" |
|
222 | t.integer "status" |
|
223 |
t.datetime "updated_at", |
|
223 | t.datetime "updated_at", :null => false |
|
224 | t.datetime "submitted_at" |
|
224 | t.datetime "submitted_at" |
|
225 | t.datetime "compiled_at" |
|
225 | t.datetime "compiled_at" |
|
226 |
- t.text "compiler_message" |
|
226 | + t.text "compiler_message" |
|
227 | t.datetime "graded_at" |
|
227 | t.datetime "graded_at" |
|
228 | t.string "grader_comment" |
|
228 | t.string "grader_comment" |
|
229 |
t.datetime "created_at", |
|
229 | t.datetime "created_at", :null => false |
|
230 | t.float "running_time" |
|
230 | t.float "running_time" |
|
231 | t.string "exit_status" |
|
231 | t.string "exit_status" |
|
232 | t.integer "memory_usage" |
|
232 | t.integer "memory_usage" |
@@ -251,15 +251,15 | |||||
|
251 | t.string "email" |
|
251 | t.string "email" |
|
252 | t.integer "site_id" |
|
252 | t.integer "site_id" |
|
253 | t.integer "country_id" |
|
253 | t.integer "country_id" |
|
254 | t.boolean "activated", :default => false |
|
254 | t.boolean "activated", :default => false |
|
255 | t.datetime "created_at" |
|
255 | t.datetime "created_at" |
|
256 | t.datetime "updated_at" |
|
256 | t.datetime "updated_at" |
|
257 | - t.string "section" |
|
||
|
258 | t.boolean "enabled", :default => true |
|
257 | t.boolean "enabled", :default => true |
|
259 | t.string "remark" |
|
258 | t.string "remark" |
|
260 | t.string "last_ip" |
|
259 | t.string "last_ip" |
|
|
260 | + t.string "section" | ||
|
261 | end |
|
261 | end |
|
262 |
|
262 | ||
|
263 | add_index "users", ["login"], :name => "index_users_on_login", :unique => true |
|
263 | add_index "users", ["login"], :name => "index_users_on_login", :unique => true |
|
264 |
|
264 | ||
|
265 | end |
|
265 | end |
You need to be logged in to leave comments.
Login now