Description:
merge with algo-bm
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r532:e19c25c6b241 - - 13 files changed: 122 inserted, 6 deleted
@@ -0,0 +1,3 | |||||
|
|
1 | + class SubmissionViewLog < 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 | + class AddLastIpToUser < ActiveRecord::Migration | ||
|
|
2 | + def change | ||
|
|
3 | + add_column :users, :last_ip, :string | ||
|
|
4 | + end | ||
|
|
5 | + 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 |
@@ -78,7 +78,7 | |||||
|
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) |
@@ -16,7 +16,7 | |||||
|
16 |
|
16 | ||
|
17 | def update |
|
17 | def update |
|
18 | @config = GraderConfiguration.find(params[:id]) |
|
18 | @config = GraderConfiguration.find(params[:id]) |
|
19 |
- User.clear_last_login if @config.key = |
|
19 | + User.clear_last_login if @config.key == GraderConfiguration::MULTIPLE_IP_LOGIN_KEY and @config.value == 'true' and params[:grader_configuration][:value] == 'false' |
|
20 | respond_to do |format| |
|
20 | respond_to do |format| |
|
21 | if @config.update_attributes(params[:grader_configuration]) |
|
21 | if @config.update_attributes(params[:grader_configuration]) |
|
22 | format.json { head :ok } |
|
22 | format.json { head :ok } |
@@ -86,6 +86,9 | |||||
|
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 | + user = User.find(session[:user_id]) | ||
|
|
90 | + SubmissionViewLog.create(user_id: session[:user_id],submission_id: @submission.id) unless user.admin? | ||
|
|
91 | + | ||
|
89 | end |
|
92 | end |
|
90 |
|
93 | ||
|
91 | # various grader controls |
|
94 | # various grader controls |
@@ -163,7 +163,7 | |||||
|
163 | @submissions.find_each do |sub| |
|
163 | @submissions.find_each do |sub| |
|
164 | d = (DateTime.now.in_time_zone - sub.submitted_at) / 24 / 60 / 60 |
|
164 | d = (DateTime.now.in_time_zone - sub.submitted_at) / 24 / 60 / 60 |
|
165 | @histogram[:data][d.to_i] += 1 if d < range |
|
165 | @histogram[:data][d.to_i] += 1 if d < range |
|
166 | - user[sub.user_id] = [user[sub.user_id], (sub.try(:points) >= @problem.full_score) ? 1 : 0].max |
|
166 | + user[sub.user_id] = [user[sub.user_id], ((sub.try(:points) || 0) >= @problem.full_score) ? 1 : 0].max |
|
167 | end |
|
167 | end |
|
168 | @histogram[:summary][:max] = [@histogram[:data].max,1].max |
|
168 | @histogram[:summary][:max] = [@histogram[:data].max,1].max |
|
169 |
|
169 |
@@ -125,7 +125,7 | |||||
|
125 |
|
125 | ||
|
126 | @summary[:count] += 1 |
|
126 | @summary[:count] += 1 |
|
127 | next unless sub.problem |
|
127 | next unless sub.problem |
|
128 | - problem[sub.problem] = [problem[sub.problem], (sub.points >= sub.problem.full_score) ? 1 : 0].max |
|
128 | + problem[sub.problem] = [problem[sub.problem], ( (sub.try(:points) || 0) >= sub.problem.full_score) ? 1 : 0].max |
|
129 | end |
|
129 | end |
|
130 |
|
130 | ||
|
131 | @histogram[:summary][:max] = [@histogram[:data].max,1].max |
|
131 | @histogram[:summary][:max] = [@histogram[:data].max,1].max |
@@ -9,6 +9,7 | |||||
|
9 | TEST_REQUEST_EARLY_TIMEOUT_KEY = 'contest.test_request.early_timeout' |
|
9 | TEST_REQUEST_EARLY_TIMEOUT_KEY = 'contest.test_request.early_timeout' |
|
10 | MULTICONTESTS_KEY = 'system.multicontests' |
|
10 | MULTICONTESTS_KEY = 'system.multicontests' |
|
11 | CONTEST_TIME_LIMIT_KEY = 'contest.time_limit' |
|
11 | CONTEST_TIME_LIMIT_KEY = 'contest.time_limit' |
|
|
12 | + MULTIPLE_IP_LOGIN_KEY = 'right.multiple_ip_login' | ||
|
12 |
|
13 | ||
|
13 | cattr_accessor :config_cache |
|
14 | cattr_accessor :config_cache |
|
14 | cattr_accessor :task_grading_info_cache |
|
15 | cattr_accessor :task_grading_info_cache |
@@ -58,7 +58,7 | |||||
|
58 | %td= s.language.pretty_name |
|
58 | %td= s.language.pretty_name |
|
59 | %td #{s.submitted_at.strftime('%Y-%m-%d %H:%M')} (#{time_ago_in_words(s.submitted_at)} ago) |
|
59 | %td #{s.submitted_at.strftime('%Y-%m-%d %H:%M')} (#{time_ago_in_words(s.submitted_at)} ago) |
|
60 | %td.fix-width= s.grader_comment |
|
60 | %td.fix-width= s.grader_comment |
|
61 |
- %td= (s.points*100 |
|
61 | + %td= ( s.try(:points) ? (s.points*100/s.problem.full_score) : '' ) |
|
62 | - if session[:admin] |
|
62 | - if session[:admin] |
|
63 | %td= s.ip_address |
|
63 | %td= s.ip_address |
|
64 |
|
64 |
@@ -11,7 +11,7 | |||||
|
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 => 20150827133841) 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" |
@@ -159,6 +159,13 | |||||
|
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" |
You need to be logged in to leave comments.
Login now