Description:
- change user_admin default action from list to index
- remove duplicate button in grader control
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r588:8bdb0ec71018 - - 4 files changed: 21 inserted, 23 deleted
@@ -12,48 +12,49 | |||
|
12 | 12 | } |
|
13 | 13 | |
|
14 | 14 | verify :method => :post, :only => ['clear_all', |
|
15 | 15 | 'start_exam', |
|
16 | 16 | 'start_grading', |
|
17 | 17 | 'stop_all', |
|
18 | 18 | 'clear_terminated'], |
|
19 | 19 | :redirect_to => {:action => 'index'} |
|
20 | 20 | |
|
21 | 21 | def index |
|
22 | 22 | redirect_to :action => 'list' |
|
23 | 23 | end |
|
24 | 24 | |
|
25 | 25 | def list |
|
26 | 26 | @grader_processes = GraderProcess.find_running_graders |
|
27 | 27 | @stalled_processes = GraderProcess.find_stalled_process |
|
28 | 28 | |
|
29 | 29 | @terminated_processes = GraderProcess.find_terminated_graders |
|
30 | 30 | |
|
31 | 31 | @last_task = Task.find(:first, |
|
32 | 32 | :order => 'created_at DESC') |
|
33 | 33 | @last_test_request = TestRequest.find(:first, |
|
34 | 34 | :order => 'created_at DESC') |
|
35 | 35 | @submission = Submission.order("id desc").limit(20) |
|
36 | + @backlog_submission = Submission.where('graded_at is null') | |
|
36 | 37 | end |
|
37 | 38 | |
|
38 | 39 | def clear |
|
39 | 40 | grader_proc = GraderProcess.find(params[:id]) |
|
40 | 41 | grader_proc.destroy if grader_proc!=nil |
|
41 | 42 | redirect_to :action => 'list' |
|
42 | 43 | end |
|
43 | 44 | |
|
44 | 45 | def clear_terminated |
|
45 | 46 | GraderProcess.find_terminated_graders.each do |p| |
|
46 | 47 | p.destroy |
|
47 | 48 | end |
|
48 | 49 | redirect_to :action => 'list' |
|
49 | 50 | end |
|
50 | 51 | |
|
51 | 52 | def clear_all |
|
52 | 53 | GraderProcess.find(:all).each do |p| |
|
53 | 54 | p.destroy |
|
54 | 55 | end |
|
55 | 56 | redirect_to :action => 'list' |
|
56 | 57 | end |
|
57 | 58 | |
|
58 | 59 | def view |
|
59 | 60 | if params[:type]=='Task' |
@@ -1,47 +1,42 | |||
|
1 | 1 | require 'csv' |
|
2 | 2 | |
|
3 | 3 | class UserAdminController < ApplicationController |
|
4 | 4 | |
|
5 | 5 | include MailHelperMethods |
|
6 | 6 | |
|
7 | 7 | before_filter :admin_authorization |
|
8 | 8 | |
|
9 | 9 | # GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html) |
|
10 | 10 | verify :method => :post, :only => [ :destroy, |
|
11 | 11 | :create, :create_from_list, |
|
12 | 12 | :update, |
|
13 | 13 | :manage_contest, |
|
14 | 14 | :bulk_mail |
|
15 | 15 | ], |
|
16 | 16 | :redirect_to => { :action => :list } |
|
17 | 17 | |
|
18 | 18 | def index |
|
19 | - list | |
|
20 | - render :action => 'list' | |
|
21 | - end | |
|
22 | - | |
|
23 | - def list | |
|
24 | 19 | @user_count = User.count |
|
25 | 20 | if params[:page] == 'all' |
|
26 | 21 | @users = User.all |
|
27 | 22 | @paginated = false |
|
28 | 23 | else |
|
29 | 24 | @users = User.paginate :page => params[:page] |
|
30 | 25 | @paginated = true |
|
31 | 26 | end |
|
32 | 27 | @hidden_columns = ['hashed_password', 'salt', 'created_at', 'updated_at'] |
|
33 | 28 | @contests = Contest.enabled |
|
34 | 29 | end |
|
35 | 30 | |
|
36 | 31 | def active |
|
37 | 32 | sessions = ActiveRecord::SessionStore::Session.find(:all, :conditions => ["updated_at >= ?", 60.minutes.ago]) |
|
38 | 33 | @users = [] |
|
39 | 34 | sessions.each do |session| |
|
40 | 35 | if session.data[:user_id] |
|
41 | 36 | @users << User.find(session.data[:user_id]) |
|
42 | 37 | end |
|
43 | 38 | end |
|
44 | 39 | end |
|
45 | 40 | |
|
46 | 41 | def show |
|
47 | 42 | @user = User.find(params[:id]) |
@@ -1,27 +1,28 | |||
|
1 | 1 | # Methods added to this helper will be available to all templates in the application. |
|
2 | 2 | module ApplicationHelper |
|
3 | 3 | |
|
4 | + #new bootstrap header | |
|
4 | 5 | def navbar_user_header |
|
5 | 6 | left_menu = '' |
|
6 | 7 | right_menu = '' |
|
7 | 8 | user = User.find(session[:user_id]) |
|
8 | 9 | |
|
9 | 10 | if (user!=nil) and (GraderConfiguration.show_tasks_to?(user)) |
|
10 | 11 | left_menu << add_menu("#{I18n.t 'menu.tasks'}", 'tasks', 'list') |
|
11 | 12 | left_menu << add_menu("#{I18n.t 'menu.submissions'}", 'main', 'submission') |
|
12 | 13 | left_menu << add_menu("#{I18n.t 'menu.test'}", 'test', 'index') |
|
13 | 14 | end |
|
14 | 15 | |
|
15 | 16 | if GraderConfiguration['right.user_hall_of_fame'] |
|
16 | 17 | left_menu << add_menu("#{I18n.t 'menu.hall_of_fame'}", 'report', 'problem_hof') |
|
17 | 18 | end |
|
18 | 19 | |
|
19 | 20 | right_menu << add_menu("#{content_tag(:span,'',class: 'glyphicon glyphicon-question-sign')}".html_safe, 'main', 'help') |
|
20 | 21 | right_menu << add_menu("#{content_tag(:span,'',class: 'glyphicon glyphicon-comment')}".html_safe, 'messages', 'list', {title: I18n.t('menu.messages'), data: {toggle: 'tooltip'}}) |
|
21 | 22 | if GraderConfiguration['system.user_setting_enabled'] |
|
22 | 23 | right_menu << add_menu("#{content_tag(:span,'',class: 'glyphicon glyphicon-cog')}".html_safe, 'users', 'index', {title: I18n.t('menu.settings'), data: {toggle: 'tooltip'}}) |
|
23 | 24 | end |
|
24 | 25 | right_menu << add_menu("#{content_tag(:span,'',class: 'glyphicon glyphicon-log-out')} #{user.full_name}".html_safe, 'main', 'login', {title: I18n.t('menu.log_out'), data: {toggle: 'tooltip'}}) |
|
25 | 26 | |
|
26 | 27 | |
|
27 | 28 | result = content_tag(:ul,left_menu.html_safe,class: 'nav navbar-nav') + content_tag(:ul,right_menu.html_safe,class: 'nav navbar-nav navbar-right') |
@@ -1,81 +1,82 | |||
|
1 | 1 | - content_for :head do |
|
2 | 2 | <meta http-equiv ="refresh" content="60"/> |
|
3 | 3 | |
|
4 | 4 | %h1 Grader information |
|
5 | 5 | |
|
6 | 6 | %p |
|
7 | 7 | = link_to 'Refresh', { :action => 'list' }, class: 'btn btn-info' |
|
8 | 8 | |
|
9 | 9 | .panel.panel-primary |
|
10 | 10 | .panel-heading |
|
11 | 11 | Grader control: |
|
12 | 12 | .panel-body |
|
13 | 13 | =link_to 'Start Graders in grading env', { action: 'start_grading'}, class: 'btn btn-default', method: 'post' |
|
14 | 14 | =link_to 'Start Graders in exam env', { action: 'start_exam'}, class: 'btn btn-default', method: 'post' |
|
15 | 15 | =link_to 'Stop all running Graders', { action: 'stop_all'}, class: 'btn btn-default', method: 'post' |
|
16 | 16 | =link_to 'Clear all data', { action: 'clear_all'}, class: 'btn btn-default', method: 'post' |
|
17 | 17 | |
|
18 | - .submitbox | |
|
19 | - .item | |
|
20 | - Grader control: | |
|
21 | - .item | |
|
22 | - = form_for :clear, :url => {:action => 'start_grading'} do |f| | |
|
23 | - = submit_tag 'Start graders in grading env' | |
|
24 | - .item | |
|
25 | - = form_for :clear, :url => {:action => 'start_exam'} do |f| | |
|
26 | - = submit_tag 'Start graders in exam env' | |
|
27 | - .item | |
|
28 | - = form_for :clear, :url => {:action => 'stop_all'} do |f| | |
|
29 | - = submit_tag 'Stop all running graders' | |
|
30 | - .item | |
|
31 | - = form_for :clear, :url => {:action => 'clear_all'} do |f| | |
|
32 | - = submit_tag 'Clear all data' | |
|
33 | - %br{:style => 'clear:both'}/ | |
|
34 | - | |
|
35 | 18 | .row |
|
36 | 19 | .col-md-6 |
|
37 | 20 | - if @last_task |
|
38 | 21 | Last task: |
|
39 | 22 | = link_to "#{@last_task.id}", :action => 'view', :id => @last_task.id, :type => 'Task' |
|
40 | 23 | |
|
41 | 24 | %br/ |
|
42 | 25 | |
|
43 | 26 | - if @last_test_request |
|
44 | 27 | Last test_request: |
|
45 | 28 | = link_to "#{@last_test_request.id}", :action => 'view', :id => @last_test_request.id, :type => 'TestRequest' |
|
46 | 29 | |
|
47 | 30 | %h2 Current graders |
|
48 | 31 | |
|
49 | 32 | = render :partial => 'grader_list', :locals => {:grader_list => @grader_processes} |
|
50 | 33 | |
|
51 | 34 | %h2 Stalled graders |
|
52 | 35 | |
|
53 | 36 | = render :partial => 'grader_list', :locals => {:grader_list => @stalled_processes} |
|
54 | 37 | |
|
55 | 38 | %h2 Terminated graders |
|
56 | 39 | |
|
57 | 40 | %p= link_to 'Clear data for terminated graders', { action: 'clear_terminated'}, class: 'btn btn-default', method: 'post' |
|
58 | 41 | |
|
59 | 42 | = render :partial => 'grader_list', :locals => {:grader_list => @terminated_processes} |
|
60 | 43 | .col-md-6 |
|
61 | 44 | %h2 Last 20 submissions |
|
62 | 45 | %table.table.table-striped.table-condensed |
|
63 | 46 | %thead |
|
64 | 47 | %th ID |
|
65 | 48 | %th User |
|
66 | 49 | %th Problem |
|
67 | 50 | %th Submitted |
|
68 | 51 | %th Graded |
|
69 | 52 | %th Result |
|
70 | - %th | |
|
71 | 53 | %tbody |
|
72 | 54 | - @submission.each do |sub| |
|
73 | 55 | %tr.inactive |
|
74 | 56 | %td= link_to sub.id, controller: 'graders' ,action: 'submission', id: sub.id |
|
75 | 57 | %td= sub.try(:user).try(:full_name) |
|
76 | 58 | %td= sub.try(:problem).try(:full_name) |
|
77 | 59 | %td= "#{time_ago_in_words(sub.submitted_at)} ago" |
|
78 | 60 | %td= sub.graded_at ? "#{time_ago_in_words(sub.graded_at)} ago" : " " |
|
79 | 61 | %td= sub.grader_comment |
|
62 | + %h2 Ungraded submission | |
|
63 | + %table.table.table-striped.table-condensed | |
|
64 | + %thead | |
|
65 | + %th ID | |
|
66 | + %th User | |
|
67 | + %th Problem | |
|
68 | + %th Submitted | |
|
69 | + %th Graded | |
|
70 | + %th Result | |
|
71 | + %tbody | |
|
72 | + - @backlog_submission.each do |sub| | |
|
73 | + %tr.inactive | |
|
74 | + %td= link_to sub.id, controller: 'graders' ,action: 'submission', id: sub.id | |
|
75 | + %td= sub.try(:user).try(:full_name) | |
|
76 | + %td= sub.try(:problem).try(:full_name) | |
|
77 | + %td= "#{time_ago_in_words(sub.submitted_at)} ago" | |
|
78 | + %td= sub.graded_at ? "#{time_ago_in_words(sub.graded_at)} ago" : " " | |
|
79 | + %td= sub.grader_comment | |
|
80 | 80 | |
|
81 | 81 | |
|
82 | + |
You need to be logged in to leave comments.
Login now