Description:
update cheat scrutinize
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r793:8cbec24011e9 - - 4 files changed: 112 inserted, 87 deleted

@@ -0,0 +1,107
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 + .panel.panel-primary
17 + .panel-heading
18 + User ID and time rnage
19 + .panel-body
20 + = form_tag({session: :url }) do
21 + .row.form-group
22 + .col-md-2
23 + From Date:
24 + .col-md-4
25 + .input-group.date
26 + = text_field_tag :since_datetime, @since_time, class: 'form-control'
27 + %span.input-group-addon
28 + %span.glyphicon.glyphicon-calendar
29 + .row.form-group
30 + .col-md-2
31 + Until Date:
32 + .col-md-4
33 + .input-group.date
34 + = text_field_tag :until_datetime, @until_time, class: 'form-control'
35 + %span.input-group-addon
36 + %span.glyphicon.glyphicon-calendar
37 + .row.form-group
38 + .col-md-2
39 + IDs (separated by space):
40 + .col-md-10
41 + = text_field_tag 'SID', @sid, size: 40, class: 'form-control'
42 + .row.form-group
43 + .col-md-2
44 + .col-md-10
45 + =submit_tag 'query', class: 'btn btn-primary'
46 +
47 + -#
48 + %table
49 + %tr
50 + %td{style: 'width: 120px; font-weight: bold'}= 'Login date range'
51 + %td{align: 'right'} since:
52 + %td= text_field_tag 'since_datetime', @since_time, class: 'form-control datetimepicker'
53 + %tr
54 + %td
55 + %td{align: 'right'} until:
56 + %td= text_field_tag 'until_datetime', @until_time
57 + %tr
58 + %td
59 + %td
60 + %td Blank mean no condition
61 + %tr
62 + %td{style: 'width: 120px; font-weight: bold'}= "ID"
63 + %td{colspan: 2}= text_field_tag 'SID', @sid, size: 40
64 + %tr
65 + %td
66 + %td
67 + %td= submit_tag 'query'
68 +
69 +
70 + %h2 Logs
71 +
72 + - if @sid
73 + %table
74 + %tbody
75 + - @sid.each do |id|
76 + - user = User.where("login = ?",id).first
77 + %tr
78 + //%td= link_to id, controller: :user, action: :profile, id: id
79 + %td= link_to id, "https://www.nattee.net/java/users/profile/#{user.id}"
80 + %td= user.full_name
81 +
82 + //%table.tablesorter-cafe#my_table
83 + %table.info
84 + %thead
85 + %tr.info-head
86 + %th Time
87 + %th Action
88 + %th IP
89 + %th login
90 + %th name
91 + %th problem
92 + %th score
93 + %tbody
94 + - if @logs
95 + - @logs.each do |l|
96 + %tr{class: cycle('info-even','info-odd')}
97 + %td= l[:submitted_at].strftime "%Y.%b.%d %H:%M:%S"
98 + //%td= l[:id] == -1 ? "LOGIN" : link_to("submit #{l[:id]}", controller: 'graders' , action: 'submission', id: l[:id])
99 + %td= l[:id] == -1 ? "LOGIN" : link_to( "submit #{l[:id]}", "https://www.nattee.net/java/graders/submission/#{l[:id]}")
100 + %td= l[:ip_address]
101 + //%td= link_to l[:login], controller: 'users', action: 'profile', id: l[:id]
102 + %td= link_to( l[:login], "https://www.nattee.net/java/users/profile/#{l.user_id}")
103 + %td= l[:full_name]
104 + %td= l[:id] == -1 ? "" : l.problem.name
105 + %td= l[:id] == -1 ? "" : l.points * 100/ l.problem.full_score
106 +
107 +
@@ -3,13 +3,13
3 3 class ReportController < ApplicationController
4 4
5 5 before_action :check_valid_login
6 6
7 7 before_action :admin_authorization, only: [:login_stat,:submission, :submission_query,
8 8 :login, :login_detail_query, :login_summary_query,
9 - :stuck, :cheat_report, :cheat_scruntinize, :show_max_score, :current_score]
9 + :stuck, :cheat_report, :cheat_scrutinize, :show_max_score, :current_score]
10 10
11 11 before_action(only: [:problem_hof]) { |c|
12 12 return false unless check_valid_login
13 13
14 14 admin_authorization unless GraderConfiguration["right.user_view_submission"]
15 15 }
@@ -450,13 +450,13
450 450 @since_time,@until_time,
451 451 @since_time,@until_time,
452 452 @since_time,@until_time])
453 453
454 454 end
455 455
456 - def cheat_scruntinize
456 + def cheat_scrutinize
457 457 #convert date & time
458 458 date_and_time = '%Y-%m-%d %H:%M'
459 459 begin
460 460 md = params[:since_datetime].match(/(\d+)-(\d+)-(\d+) (\d+):(\d+)/)
461 461 @since_time = Time.zone.local(md[1].to_i,md[2].to_i,md[3].to_i,md[4].to_i,md[5].to_i)
462 462 rescue
@@ -470,13 +470,13
470 470 end
471 471
472 472 #convert sid
473 473 @sid = params[:SID].split(/[,\s]/) if params[:SID]
474 474 unless @sid and @sid.size > 0
475 475 return
476 - redirect_to actoin: :cheat_scruntinize
476 + redirect_to actoin: :cheat_scrutinize
477 477 flash[:notice] = 'Please enter at least 1 student id'
478 478 end
479 479 mark = Array.new(@sid.size,'?')
480 480 condition = "(u.login = " + mark.join(' OR u.login = ') + ')'
481 481
482 482 @st = <<-SQL
@@ -147,14 +147,14
147 147 get 'current_score(/:group_id)', action: 'current_score', as: 'current_score'
148 148 get 'max_score'
149 149 post 'show_max_score'
150 150 get 'stuck'
151 151 get 'cheat_report'
152 152 post 'cheat_report'
153 - get 'cheat_scruntinize'
154 - post 'cheat_scruntinize'
153 + get 'cheat_scrutinize'
154 + post 'cheat_scrutinize'
155 155 get 'submission'
156 156 post 'submission_query'
157 157 get 'login_stat'
158 158 post 'login_stat'
159 159 get 'login'
160 160 post 'login_summary_query'
deleted file
You need to be logged in to leave comments. Login now