diff --git a/app/assets/javascripts/debates.js.coffee b/app/assets/javascripts/debates.js.coffee
new file mode 100644
index 000000000..761567942
--- /dev/null
+++ b/app/assets/javascripts/debates.js.coffee
@@ -0,0 +1,3 @@
+# Place all the behaviors and hooks related to the matching controller here.
+# All this logic will automatically be available in application.js.
+# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
diff --git a/app/assets/stylesheets/debates.css.scss b/app/assets/stylesheets/debates.css.scss
new file mode 100644
index 000000000..6c45b3be9
--- /dev/null
+++ b/app/assets/stylesheets/debates.css.scss
@@ -0,0 +1,3 @@
+// Place all the styles related to the debates controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
diff --git a/app/controllers/challenges_controller.rb b/app/controllers/challenges_controller.rb
index aef0170ff..375596075 100644
--- a/app/controllers/challenges_controller.rb
+++ b/app/controllers/challenges_controller.rb
@@ -132,6 +132,8 @@ class ChallengesController < ApplicationController
end
end
@index = params[:position].to_i - 1
+ # 发起重置请求
+ shixun_modify_status_without_publish(@shixun, 1)
respond_to do |format|
format.js
end
@@ -157,6 +159,8 @@ class ChallengesController < ApplicationController
answer = params[:choice][:answer][index] == "0" ? false : true
ChallengeQuestion.create(:option_name => test, :challenge_choose_id => @challenge_choose.id, :position => index, :right_key => answer)
end
+ # 发起重置请求
+ shixun_modify_status_without_publish(@shixun, 1)
@challenge_choose.challenge_tags.delete_all unless @challenge_choose.challenge_tags.blank?
unless params[:knowledge].blank?
params[:knowledge][:input].each do |input|
@@ -197,7 +201,8 @@ class ChallengesController < ApplicationController
def destroy_challenge_choose
@challenge_choose = ChallengeChoose.where(:id => params[:choose_id]).first
@challenge_choose.destroy
-
+ # 发起重置请求
+ shixun_modify_status_without_publish(@shixun, 1)
redirect_to edit_shixun_challenge_path(@challenge, :shixun_id => @shixun)
end
@@ -255,7 +260,7 @@ class ChallengesController < ApplicationController
end
end
# 向jenkins端发送请求,构建公共测试用例
- add_shixun_modify_status(@shixun, 1)
+ shixun_modify_status_publish(@shixun, 1)
elsif params[:tab].to_i == 5
@challenge_tags.delete_all unless @challenge_tags.blank?
unless params[:knowledge].blank?
diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb
index 887b24d06..9eef2c48f 100644
--- a/app/controllers/courses_controller.rb
+++ b/app/controllers/courses_controller.rb
@@ -36,8 +36,9 @@ class CoursesController < ApplicationController
before_filter :require_login, :only => [:join, :unjoin]
#before_filter :allow_join, :only => [:join]
require 'bundler/setup'
- require 'simple_xlsx_reader'
-
+ if RUBY_PLATFORM =~ /linux/
+ require 'simple_xlsx_reader'
+ end
# params[:search] 搜索课程的名称
# params[:select] "join" "create" "all" 参与的 创建的 所有的课程
#
@@ -103,6 +104,17 @@ class CoursesController < ApplicationController
@import_attachments = Attachment.where(:container_id => @course.id, :container_type => "ImportStudent")
end
+ def shixun_statistics
+ @homeworks = @course.homework_commons.where("homework_type = 4").order("created_at asc")
+ filename="#{format_date(Time.now)}_#{@course.teacher.show_real_name.to_s}_#{@course.name}_实训数据报告";
+
+ respond_to do |format|
+ format.xls {
+ send_data(shixun_xls(@homeworks,@course), :type => 'application/octet-stream', :filename => filename_for_content_disposition("#{filename}.xls"))
+ }
+ end
+ end
+
# REDO:性能需要优化,这块是管理员后台任务,不影响用户使用
def sync_students
school_id = User.find(@course.tea_id).try(:user_extensions).try(:school_id)
@@ -1988,6 +2000,87 @@ class CoursesController < ApplicationController
@results = paginateHelper @results, @limit
end
+ def shixun_xls homeworks, course
+ xls_report = StringIO.new
+ book = Spreadsheet::Workbook.new
+ blue = Spreadsheet::Format.new :color => :blue, :weight => :bold, :size => 10
+ black = Spreadsheet::Format.new :color => :black, :weight => :bold, :size => 10
+ current_row = 0
+ homeworks.each_with_index do |homework, i|
+ sheet = book.create_worksheet :name => "第#{i+1}次作业"
+ sheet.row(0).default_format = blue
+ sheet[0,0] = "课堂编号"
+ sheet[0,1] = "主讲老师"
+ sheet[0,2] = "课堂名称"
+ sheet[0,3] = "作业编号"
+ sheet[0,4] = "作业/实训名称"
+ sheet[0,5] = "关卡"
+ sheet[0,6] = "学生id"
+ sheet[0,7] = "学生姓名"
+ sheet[0,8] = "经验值"
+ sheet[0,9] = "金币"
+ sheet[0,10] = "评测历史"
+ sheet[0,11] = "评测时间"
+ sheet[0,12] = "评测结果"
+ sheet[1,0] = course.id
+ sheet[1,1] = course.teacher.show_real_name
+ sheet[1,2] = course.name
+ sheet[1,3] = "# #{i + 1}"
+ sheet[1,4] = homework.name
+ current_row = 1
+ shixun = homework.homework_commons_shixuns.shixun if homework.homework_commons_shixuns
+ if shixun
+ shixun.challenges.each_with_index do |challenge, j|
+ sheet[current_row,5] = "第#{j+1}关"
+ games = Game.where(:challenge_id => challenge.id, :user_id => homework.student_works.where("work_status != 0").map(&:user_id))
+ count_exp_score = 0
+ count_gold_score = 0
+ count_test = 0
+ count_time = 0
+ if games.count > 0
+ games.each do |game|
+ user = game.user
+ sheet[current_row,6] = user.login
+ sheet[current_row,7] = user.show_real_name
+ sheet[current_row,8] = game.final_score ? "+#{game.final_score.to_s} 经验值" : "--"
+ count_exp_score = count_exp_score + (game.final_score ? game.final_score.to_i : 0)
+ sheet[current_row,9] = game.final_score ? (game.answer_open? ? "#{-challenge.score.to_i} 金币" : "+#{game.final_score.to_i} 金币") : "--"
+ count_gold_score = count_gold_score + (game.final_score ? (game.answer_open? ? -challenge.score.to_i : game.final_score.to_i) : 0)
+
+ count = game.outputs.count
+ if count > 0
+ outputs = game.outputs.where(:test_set_position => 1).order("created_at asc")
+ outputs.each_with_index do |output, k|
+ count_test = count_test + 1
+ sheet[current_row,10] = "第#{k+1}次评测"
+ sheet[current_row,11] = k == 0 ? game_spend_time((output.created_at - game.created_at).to_i) : game_spend_time((output.created_at - outputs[k-1].created_at).to_i)
+ count_time = count_time + (k == 0 ? (output.created_at - game.created_at).to_i : (output.created_at - outputs[k-1].created_at).to_i)
+ sheet[current_row,12] = game.outputs.where(:query_index => output.query_index).select{|ou| ou.result == false}.count > 0 ? "失败" : "成功"
+ current_row = current_row + 1
+ end
+ else
+ current_row = current_row + 1
+ end
+ end
+ else
+ current_row = current_row + 1
+ end
+
+ sheet[current_row,6] = "合计"
+ sheet[current_row,7] = games.count.to_s + "人"
+ sheet[current_row,8] = count_exp_score >= 0 ? "+#{count_exp_score} 经验值" : "-#{count_exp_score} 经验值"
+ sheet[current_row,9] = count_gold_score >= 0 ? "+#{count_gold_score} 金币" : "-#{count_gold_score} 金币"
+ sheet[current_row,10] = "共#{count_test}次评测"
+ sheet[current_row,11] = game_spend_time((count_time == 0 ? 0 : (count_time / count_test)).to_i)+"/次"
+ sheet.row(current_row).default_format = black
+ current_row = current_row + 1
+ end
+ end
+ end
+ book.write xls_report
+ xls_report.string
+ end
+
def member_to_xls homeworks, course, members,groups
xls_report = StringIO.new
book = Spreadsheet::Workbook.new
diff --git a/app/controllers/debates_controller.rb b/app/controllers/debates_controller.rb
new file mode 100644
index 000000000..5e442e4bb
--- /dev/null
+++ b/app/controllers/debates_controller.rb
@@ -0,0 +1,2 @@
+class DebatesController < ApplicationController
+end
diff --git a/app/controllers/forums_controller.rb b/app/controllers/forums_controller.rb
index ed646354c..337f951aa 100644
--- a/app/controllers/forums_controller.rb
+++ b/app/controllers/forums_controller.rb
@@ -119,8 +119,10 @@ class ForumsController < ApplicationController
end
def index
- order = ""
+ order = "sticky desc, created_at desc"
@order_str = ""
+ @user = User.current
+=begin
if(params[:reorder_complex])
order = "replies_count #{params[:reorder_complex]}, #{Memo.table_name}.created_at #{params[:reorder_complex]}"
@order_str = "reorder_complex="+params[:reorder_complex]
@@ -134,6 +136,7 @@ class ForumsController < ApplicationController
order = "#{Memo.table_name}.updated_at desc"
@order_str = "reorder_time=desc"
end
+=end
@memo = Memo.new(:forum => @forum)
@memos = Memo.where("parent_id is null")
@topic_count = @memos.count
@@ -148,10 +151,13 @@ class ForumsController < ApplicationController
@my_forums_count = Memo.where("author_id =? and parent_id is null", User.current.id).count
@my_memos_count = Memo.where("author_id =? and parent_id is not null", User.current.id).count
@errors = params[:errors]
+ memos_id = Memo.where("author_id =?", User.current.id).map(&:id)
+ @memos_praise_count = PraiseTread.where(:praise_tread_object_id => memos_id, :praise_tread_object_type => "Memo").count
+
respond_to do |format|
format.js
format.html {
- render :layout => 'base_new_forum'
+ render :layout => 'base_edu'
}# show.html.erb
format.json { render json: @forum }
end
@@ -181,13 +187,10 @@ class ForumsController < ApplicationController
end
@memo = Memo.new(:forum => @forum)
@topic_count = @forum.topics.count
- @topic_pages = Paginator.new @topic_count, per_page_option, params['page']
- @memos = @forum.topics.includes(:last_reply).
- limit(@topic_pages.per_page).
- offset(@topic_pages.offset).
- reorder(order).
- preload(:author, {:last_reply => :author}).
- all
+ @limit = 20
+ @is_remote = true
+ @topic_pages = Paginator.new @topic_count, @limit, params['page'] || 1
+ @memos = paginateHelper @forum.topics.includes(:last_reply).reorder(order).preload(:author, {:last_reply => :author}), @limit
@my_topic_count = Memo.where("forum_id = #{@memo.forum_id} and parent_id is null").count
@my_replies_count = Memo.where("forum_id = #{@memo.forum_id} and parent_id is not null").count
@errors = params[:errors]
diff --git a/app/controllers/games_controller.rb b/app/controllers/games_controller.rb
index 69194f1f8..cc68070d3 100644
--- a/app/controllers/games_controller.rb
+++ b/app/controllers/games_controller.rb
@@ -316,9 +316,9 @@ class GamesController < ApplicationController
answer_right = []
@game_challenge.challenge_chooses.each_with_index do |choose, index|
correct = (params[:answer][index] == choose.standard_answer) ? true : false
- if choose.current_choose_outputs.blank?
- ChooseOutputs.create(:challenge_choose_id => choose.id, :user_id => User.current.id, :answer => params[:answer][index], :correct => correct)
- end
+ #choose.current_choose_outputs.delete if choose.current_choose_outputs.present?
+ #ChooseOutputs.create(:challenge_choose_id => choose.id, :user_id => User.current.id, :answer => params[:answer][index], :correct => correct)
+ Output.create(:game_id => @game.id, :test_set_position => choose.position, :actual_output => params[:answer][index], :result => correct, :query_index => @game.query_index)
if @shixun.status > 1 && !@game.answer_open
if correct
score += choose.score
@@ -332,14 +332,15 @@ class GamesController < ApplicationController
end
answer_right << correct
end
- @game.update_attributes(:status => 2, :end_time => Time.now)
@had_done = @game.had_done
- reward_grade(@game.user, @game.id, 'Game', score)
- reward_experience(@game.user, @game.id, 'Game', score)
- @game.update_attribute(:final_score, score)
-
+ if @right
+ @game.update_attributes(:status => 2, :end_time => Time.now)
+ reward_grade(@game.user, @game.id, 'Game', score)
+ reward_experience(@game.user, @game.id, 'Game', score)
+ @game.update_attribute(:final_score, score)
+ end
respond_to do |format|
- format.js{redirect_to myshixun_game_path(@game, :myshixun_id => @myshixun, :choose => 1)}
+ format.js{redirect_to myshixun_game_path(@game, :myshixun_id => @myshixun, :choose => @right)}
end
end
@@ -407,7 +408,7 @@ class GamesController < ApplicationController
if(params[:choose] == "true")
challenge.challenge_chooses.each_with_index do |choose, index|
@answer += "第"+ ((index + 1).to_s) +"题:
"
- @answer += choose.answer
+ @answer += (choose.answer.blank? ? choose.standard_answer : choose.answer)
@answer += "
"
end
else
@@ -434,11 +435,17 @@ class GamesController < ApplicationController
user = User.current
challenge_score = @game_challenge.score.to_i
reward_grade(user, @game.id, 'Answer', -challenge_score)
- @answer = @game_challenge.answer
- @game.update_column(:answer_open, true)
- respond_to do |format|
- format.js
+ @answer = ""
+ if @game.challenge.st == 0
+ @answer = @game_challenge.answer
+ else
+ @game_challenge.challenge_chooses.each_with_index do |choose, index|
+ @answer += "第"+ ((index + 1).to_s) +"题:
"
+ @answer += (choose.answer.blank? ? choose.standard_answer : choose.answer)
+ @answer += "
"
+ end
end
+ @game.update_column(:answer_open, true)
end
def refresh_game_list
diff --git a/app/controllers/managements_controller.rb b/app/controllers/managements_controller.rb
index 8a7630134..5d844b04a 100644
--- a/app/controllers/managements_controller.rb
+++ b/app/controllers/managements_controller.rb
@@ -850,36 +850,35 @@ end
def classroom_classment
@menu_type = 2
@sub_type = 2
- @sx_order = params[:sx_order].blank? ? "desc" : params[:sx_order]
+ @sx_order = params[:sx_order].blank? ? "desc" : params[:sx_order]
@courses = Course.where(:is_delete => 0)
- @timing = Course.where(:is_end=>false).count
- @end = Course.where(:is_end=>true).count
+ @timing=Course.where(:is_end=>false).count
+ @end=Course.where(:is_end=>true).count
@course_lists = CourseList.where(:id => Course.where(:is_delete => 0 ).map(&:course_list_id) )
unless params[:school_id] || params[:search] || params[:keyword] || params[:status]
- user_exs=UserExtensions.where(:school_id=> @courses.map(&:school_id))
- @schools = School.where(:id =>user_exs.map(&:school_id))
+ user_exs=UserExtensions.where(:school_id=> @courses.map(&:school_id))
+ @schools = School.where(:id =>user_exs.map(&:school_id))
end
@search = params[:search] # 搜索字
@keyword = params[:keyword].blank? ? "u_name" : params[:keyword] # 根据姓名/课程名搜索
- status = params[:status].to_i
- courselist = params[:course_list]
+ @status = params[:status]
+ @courselist = params[:course_list]
+ @school_id = params[:school_id]
if params[:school_id] && params[:school_id] != ''
- @school_id = params[:school_id]
- @courses = @courses.joins("join users u on courses.tea_id = u.id").joins("join user_extensions ue on u.id = ue.user_id").where("ue.school_id = #{params[:school_id]}")
+ @courses = Course.joins("join users u on courses.tea_id = u.id").joins("join user_extensions ue on u.id = ue.user_id").where("ue.school_id = #{params[:school_id]}")
end
if params[:homepage_show]
@courses = @courses.where(:homepage_show => params[:homepage_show].to_i)
end
- if courselist && courselist != ''
- @courses = @courses.where(:course_list_id => courselist)
+ if params[:course_list] && params[:course_list] != ''
+ @courses = @courses.where(:course_list_id => @courselist)
end
if params[:status] && params[:status]!=''
- @status = params[:status]
- @courses =@courses.where(:is_end =>status)
+ @courses =@courses.where(:is_end => @status.to_i)
end
if "u_name" == @keyword
if @search.blank?
@@ -892,6 +891,7 @@ end
@courses= @courses.where("name like '%#{@search}%'")
end
@courses = @courses.select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS updatetime").reorder("updatetime #{@sx_order}")
+ @export_courses = @courses
@courses_count = @courses.count
limit = 20
@is_remote = true
@@ -901,6 +901,11 @@ end
respond_to do |format|
format.js
format.html
+ format.xls{
+ @export_courses = @export_courses.all
+ filename = "#{l(:label_course_list_xls)}.xls"
+ send_data(course_list_xls(@export_courses), :type => 'application/octet-stream', :filename => filename_for_content_disposition(filename))
+ }
end
end
@@ -1622,28 +1627,29 @@ end
render_404
end
- def course_list_xls course
+ def course_list_xls courses
xls_report = StringIO.new
book = Spreadsheet::Workbook.new
sheet1 = book.create_worksheet :name => "course"
blue = Spreadsheet::Format.new :color => :blue, :weight => :bold, :size => 10
sheet1.row(0).default_format = blue
- sheet1.row(0).concat([l(:issue_xls_id),l(:issue_xls_tracker_id),l(:issue_xls_title),l(:issue_xls_description),l(:issue_xls_status),l(:issue_xls_assign),l(:issue_xls_priority),l(:issue_xls_author),l(:issue_xls_created_at),l(:milestone),l(:issue_xls_start),l(:issue_xls_due),l(:issue_xls_ratio)])
+ sheet1.row(0).concat(["ID","课堂名称","成员","资源","普通作业"," 实训作业","试卷","私有","状态","创建者单位","创建者","动态时间"])
count_row = 1
- issues.each do |issue|
- sheet1[count_row,0] = issue.id
- sheet1[count_row,1] = issue_tracker_change(issue.tracker_id)
- sheet1[count_row,2] = issue.subject
- sheet1[count_row,3] = (issue.description.gsub(/<\/?.*?>/,"")).html_safe
- sheet1[count_row,4] = issue_status_change(issue.status_id)
- sheet1[count_row,5] = issue.assigned_to.try(:show_name)
- sheet1[count_row,6] = issue_priority_change(issue.priority_id)
- sheet1[count_row,7] = issue.author.show_name
- sheet1[count_row,8] = issue.created_on.nil? ? issue.created_on : issue.created_on.strftime('%Y-%m-%d %H:%M:%S')
- sheet1[count_row,9] = issue.fixed_version.try(:name)
- sheet1[count_row,10] = issue.start_date.nil? ? issue.start_date : issue.start_date.strftime('%Y-%m-%d')
- sheet1[count_row,11] = issue.due_date.nil? ? issue.due_date : issue.due_date.strftime('%Y-%m-%d')
- sheet1[count_row,12] = issue_ratio_change(issue.done_ratio, issue.status_id)
+ courses.each do |course|
+ school = course.teacher.try(:user_extensions).try(:school).try(:name).blank? ? "--" : course.teacher.school_name
+ teacher_name = course.teacher ? course.teacher.show_real_name : ""
+ sheet1[count_row,0] = course.id
+ sheet1[count_row,1] = course.name
+ sheet1[count_row,2] = course.members.count
+ sheet1[count_row,3] = course.attachments.count
+ sheet1[count_row,4] = course.homework_commons.where(:homework_type => 1).count
+ sheet1[count_row,5] = course.homework_commons.where(:homework_type => 4).count
+ sheet1[count_row,6] = course.exercises.count
+ sheet1[count_row,7] = course.is_public.to_i == 1 ? '否' : '是'
+ sheet1[count_row,8] = course.is_end ? "已结束" : "正在进行"
+ sheet1[count_row,9] = school
+ sheet1[count_row,10] = teacher_name
+ sheet1[count_row,11] = format_time(course.updatetime)
count_row += 1
end
book.write xls_report
diff --git a/app/controllers/memos_controller.rb b/app/controllers/memos_controller.rb
index 7f4c1d48e..7e9662563 100644
--- a/app/controllers/memos_controller.rb
+++ b/app/controllers/memos_controller.rb
@@ -1,6 +1,6 @@
class MemosController < ApplicationController
default_search_scope :memos
- before_filter :find_forum, :only => [:new, :create, :preview, :update]
+ before_filter :find_forum, :only => [:new, :create, :preview, :update, :reply]
before_filter :find_attachments, :only => [:preview]
before_filter :find_memo, :except => [:new, :create, :preview]
before_filter :authenticate_user_edit, :only => [:edit, :update]
@@ -29,13 +29,14 @@ class MemosController < ApplicationController
def new
# 如何是问吧主页来的,导航不显示具体贴吧名
+ @user = User.current
@memo = Memo.new
- @my_forums_count = Memo.where("author_id =? and parent_id is null", User.current.id).count
- @my_memos_count = Memo.where("author_id =? and parent_id is not null", User.current.id).count
+ @my_forums_count = Memo.where("author_id =? and parent_id is null",@user.id).count
+ @my_memos_count = Memo.where("author_id =? and parent_id is not null", @user.id).count
@forums = Forum.reorder("topic_count desc,updated_at desc")
respond_to do |format|
format.js
- format.html {render layout: 'base_new_forum'}
+ format.html {render layout: 'base_edu'}
format.json { render json: @memo }
end
end
@@ -88,6 +89,7 @@ class MemosController < ApplicationController
REPLIES_PER_PAGE = 20 unless const_defined?(:REPLIES_PER_PAGE)
def show
+ @user = User.current
# 更新贴吧帖子留言对应的memo_messages的viewed字段
unless @memo.children.blank?
@memo.children.each do |child|
@@ -141,19 +143,20 @@ class MemosController < ApplicationController
respond_to do |format|
format.js
- format.html {render :layout => 'base_new_forum'}
+ format.html {render :layout => 'base_edu'}
format.json { render json: @memo }
format.xml { render xml: @memo }
end
end
def edit
- @my_topic_count = 0
- @my_replies_count = Memo.where(:parent_id => @memo.id).count
- @forums = Forum.reorder("topic_count desc,updated_at desc")
- @replying = false
+ #@my_topic_count = 0
+ #@my_replies_count = Memo.where(:parent_id => @memo.id).count
+ #@forums = Forum.reorder("topic_count desc,updated_at desc")
+ #@replying = false
+ @user = User.current
respond_to do |format|
- format.html {render :layout => 'base_new_forum'}
+ format.html {render :layout => 'base_edu'}
end
end
@@ -173,7 +176,7 @@ class MemosController < ApplicationController
@flag = @memo.save
# @memo.root.update_attribute(:updated_at, @memo.updated_at)
format.js
- format.html {redirect_to back_memo_url, notice: "#{l :label_memo_update_succ}"}
+ format.html {redirect_to back_memo_url}
else
format.js
format.html { render action: "edit" }
@@ -182,12 +185,64 @@ class MemosController < ApplicationController
end
end
+ def reply
+ if params[:memo].present? && params[:memo][:parent_id].present?
+ parent = Memo.find params[:memo][:parent_id]
+ @memo = params[:activity_id].blank? ? parent : Memo.find(params[:activity_id].to_i)
+ @reply = Memo.new
+ @reply.author = User.current
+ @reply.forum_id = parent.forum_id
+ @reply.content = params[:content]
+ @reply.subject = "RE: #{@memo.subject}"
+ #@reply.reply_id = params[:id]
+ @reply.root_id = parent.root_id.nil? ? parent.id : parent.root_id
+ # @reply.reply_id = params[:id]
+ parent.children << @reply
+ else
+ @reply = Memo.new()
+ @reply.content = params[:content]
+ @reply.subject = @memo.subject
+ @reply.author = User.current
+ @reply.forum_id = @forum.id
+ #@reply.content = @quote + @reply.content
+ #@reply.subject = "RE: #{@topic.subject}" unless params[:reply][:subject]
+ @reply.root_id = @memo.id
+ @reply.safe_attributes = params[:reply]
+ @memo.children << @reply
+ # @reply.reply_id = params[:id]
+ end
+
+ redirect_to message_replies_forum_memo_path(@memo.forum, @memo, :user_activity_id => params[:user_activity_id])
+ end
+
+ def message_replies
+ @replies = Memo.where(:root_id => @memo.id).order("created_at desc")
+ @reply_count = @replies.count
+ @replies = get_no_children_comments_all @replies
+ #@limit_count = @replies.count
+ #@page = params[:page] ? params[:page].to_i + 1 : 0
+ #@limit = 10
+ #@replies = @replies[@page * @limit..@page * @limit + 9]
+ @reply = Message.new()
+ @user_activity_id = params[:user_activity_id].blank? ? @memo.id : params[:user_activity_id].to_i
+ respond_to do |format|
+ format.js
+ end
+
+ end
+
def destroy
@memo.destroy
-
respond_to do |format|
- # format.html { redirect_to @back_url }
- format.html { redirect_to back_memo_or_forum_url }
+ #format.html { redirect_to @back_url }
+ format.html { redirect_to forums_path }
+ format.js{
+ @memo = Memo.find(params[:user_activity_id].to_i)
+ @replies = Memo.where(:root_id => @memo.id).order("created_at desc")
+ @reply_count = @replies.count
+ @replies = get_no_children_comments_all @replies
+ #redirect_to message_replies_forum_memo_path(@memo.forum, @memo, :user_activity_id => params[:user_activity_id])
+ }
format.json { head :no_content }
end
end
@@ -196,7 +251,13 @@ class MemosController < ApplicationController
def change_sticky
@memo.sticky ? @memo.update_attribute(:sticky, false) : @memo.update_attribute(:sticky, true)
respond_to do |format|
- format.html { redirect_to forum_memo_path(@memo.forum, @memo) }
+ format.html {
+ if params[:index]
+ redirect_to forums_path
+ else
+ redirect_to forum_memo_path(@memo.forum, @memo)
+ end
+ }
end
end
diff --git a/app/controllers/myshixuns_controller.rb b/app/controllers/myshixuns_controller.rb
index 813c790b4..a2aadf706 100644
--- a/app/controllers/myshixuns_controller.rb
+++ b/app/controllers/myshixuns_controller.rb
@@ -127,7 +127,6 @@ class MyshixunsController < ApplicationController
compile_success = jsonTestDetails['compileSuccess']
# message = Base64.decode64(params[:msg]) unless params[:msg].blank?
logger.info(outPut)
- logger.info("##################"+ compile_success)
game = Game.find(game_id)
challenge = game.challenge
unless jenkins_testsets.blank?
@@ -135,7 +134,6 @@ class MyshixunsController < ApplicationController
actual_output = tran_base64_decode64(j_test_set['output'])
game_outputs = Output.create(:code => status, :game_id => game_id, :out_put => outPut, :test_set_position => j_test_set['caseId'],
:actual_output => actual_output, :result => j_test_set['passed'].to_i, :query_index => game.query_index, :compile_success => compile_success.to_i)
- logger.info("compile_success:"+ compile_success)
# output = Output.where(:game_id => game.id, :test_set_position => j_test_set['caseId'].to_i).first
# logger.info("#############{outPut}")
# if output.nil?
diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb
index 2776a3a72..6ce0e4c63 100644
--- a/app/controllers/shixuns_controller.rb
+++ b/app/controllers/shixuns_controller.rb
@@ -24,6 +24,7 @@ class ShixunsController < ApplicationController
@offset ||= @statistic_pages.offset
@statistics = paginateHelper @statistics, @limit
+
end
# push代码的时候会触发gitlab hook
@@ -114,9 +115,9 @@ class ShixunsController < ApplicationController
@rev = params[:rev]
@content = params[:content]
code_file = g.edit_file(@shixun.gpid, :content => params[:content], :file_path => @path, :branch_name => @rev, :commit_message => "shixun entry")
- if @shixun.try(:status).to_i < 2
+ # if @shixun.try(:status).to_i < 2
shixun_modify_status_without_publish(@shixun, 1)
- end
+ # end
respond_to do |format|
format.js
end
@@ -254,9 +255,9 @@ class ShixunsController < ApplicationController
# 确定 sort 1升序 2 降序
@order = params[:order] || "myshixun_count"
bsort = params[:sort] || "desc"
- @sort = bsort == "desc" ? "asc" : "desc"
+ @sort = bsort == "asc" ? "desc" : "asc"
if @order == "updated_at"
- order_str = "#{Shixun.table_name}.updated_at #{bsort}"
+ order_str = "#{Shixun.table_name}.updated_at #{@sort}"
else
order_str = "myshixun_count #{bsort}, #{Shixun.table_name}.updated_at #{bsort}"
end
@@ -546,6 +547,10 @@ class ShixunsController < ApplicationController
end
def copy
+ unless (@shixun.can_copy && User.current.user_extensions.try(:identity) == 0 && User.current.professional_certification)
+ render_403
+ return
+ end
ActiveRecord::Base.transaction do
begin
new_shixun = Shixun.new
@@ -574,10 +579,13 @@ class ShixunsController < ApplicationController
gshixun = g.fork(@shixun.gpid, user_gid)
raise "版本库创建失败" if gshixun.try(:id).blank?
gshixun = g.edit_project(gshixun.id, new_shixun.identifier, new_shixun.identifier)
- raise "版本库创建失败" if (gshixun.try(:name) != new_shixun.identifier || gshixun.try(:path) != new_shixun.identifier)
+ raise "实训复制失败" if (gshixun.try(:name) != new_shixun.identifier || gshixun.try(:path) != new_shixun.identifier)
new_shixun.update_column(:gpid, gshixun.id)
# 同步复制合作者,合作者加入到gitlab
+ unless User.current.manager_of_shixun?(@shixun)
+ ShixunMember.create!(:user_id => User.current.id, :shixun_id => new_shixun.try(:id), :role => 1)
+ end
@shixun.shixun_members.each do |shixun_member|
if ShixunMember.where(:shixun_id => new_shixun.try(:id), :user_id => shixun_member.user_id).blank?
ShixunMember.create!(:user_id => shixun_member.try(:user_id), :shixun_id => new_shixun.try(:id),
@@ -718,7 +726,7 @@ class ShixunsController < ApplicationController
ActiveRecord::Base.transaction do
begin
@shixun.save!
- if language != params[:language]
+ if language != params[:language] && @shixun.status != 2 # 已发布不触发重置
add_shixun_modify_status(@shixun, 1)
end
rescue
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index 3e5a0c0a3..1f545fd9e 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -321,6 +321,11 @@ class UsersController < ApplicationController
when 'Syllabus'
@reply = JournalsForMessage.find params[:reply_id]
@type = 'Syllabus'
+ when 'Memo'
+ @reply = Memo.find params[:reply_id]
+ @user_activity_id = params[:user_activity_id]
+ @activity_id = params[:activity_id]
+ @type = 'Memo'
end
respond_to do |format|
format.js
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index e13cf05b8..122d74478 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -101,6 +101,17 @@ module ApplicationHelper
shixun_modify_status_without_publish shixun, type
end
+ def shixun_modify_status_publish shixun, type
+ shixun_tomcat = Redmine::Configuration['shixun_tomcat']
+ gameInfo = shixun.gameInfo
+ uri ="#{shixun_tomcat}/bridge/game/publishGame"
+ params = {gameInfo:gameInfo}
+ res = uri_exec uri, params
+ if res && res['code'].to_i != 0
+ raise("实训云平台繁忙(繁忙等级:90)")
+ end
+ end
+
# 仅仅产生记录,用于已执行publish的方法
# ShixunModify中status 1:表示有更改,开启实训的时候需要重置,0:表示不需要重置或已重置完成
def shixun_modify_status_without_publish shixun, type
@@ -503,7 +514,7 @@ module ApplicationHelper
def new_homework_common_status status
case status
when 0
- "挂起"
+ "未发布"
when 1
"提交中"
when 2
@@ -523,7 +534,7 @@ module ApplicationHelper
def homework_status_color status
style = ""
case status
- when '挂起'
+ when '未发布'
style = 'edu-filter-btn-yellow'
when '提交中'
style = 'edu-filter-btn-blue'
@@ -571,7 +582,7 @@ module ApplicationHelper
if ho_detail_manual
case ho_detail_manual.comment_status
when 0
- status = "挂起"
+ status = "未发布"
when 1
if homework_common.end_time && homework_common.end_time >= Time.now
status = "提交中"
@@ -830,7 +841,7 @@ module ApplicationHelper
end
# 项目issue列表导出Excel功能
- def issue_list_xls issues
+ def issue_list_xls issues
xls_report = StringIO.new
book = Spreadsheet::Workbook.new
sheet1 = book.create_worksheet :name => "issues"
@@ -4775,7 +4786,7 @@ def get_hw_status homework_common
str = ""
if homework_common.homework_detail_manual
if homework_common.homework_detail_manual.comment_status == 0 && homework_common.publish_time.nil?
- str += '挂起'
+ str += '未发布'
elsif homework_common.homework_detail_manual.comment_status == 0
str += '未发布'
elsif homework_common.homework_detail_manual.comment_status == 1
diff --git a/app/helpers/debates_helper.rb b/app/helpers/debates_helper.rb
new file mode 100644
index 000000000..f551d98d1
--- /dev/null
+++ b/app/helpers/debates_helper.rb
@@ -0,0 +1,2 @@
+module DebatesHelper
+end
diff --git a/app/models/challenge_choose.rb b/app/models/challenge_choose.rb
index c14a0c02d..38b7d8685 100644
--- a/app/models/challenge_choose.rb
+++ b/app/models/challenge_choose.rb
@@ -7,6 +7,7 @@ class ChallengeChoose < ActiveRecord::Base
has_many :challenge_tags, :dependent => :destroy
has_many :challenge_questions, :dependent => :destroy
has_one :choose_outputs, :dependent => :destroy
+ #has_many :outputs, :dependent => :destroy
validates_presence_of :subject
diff --git a/app/models/game.rb b/app/models/game.rb
index 7c0e913ae..e278690c4 100644
--- a/app/models/game.rb
+++ b/app/models/game.rb
@@ -66,4 +66,18 @@ class Game < ActiveRecord::Base
challenge = self.challenge
challenge.try(:position).to_i == challenge.shixun.challenges.count ? true : false
end
+
+ def choose_correct_num
+ num = 0
+ outputs = self.outputs.where(:query_index => (self.query_index - 1))
+ if outputs.blank?
+ num = nil
+ else
+ outputs.each do |output|
+ num += output.result ? 1 : 0
+ end
+ end
+ return num
+ end
+
end
diff --git a/app/models/myshixun.rb b/app/models/myshixun.rb
index 9e7e2a0aa..ace51c51f 100644
--- a/app/models/myshixun.rb
+++ b/app/models/myshixun.rb
@@ -48,7 +48,7 @@ class Myshixun < ActiveRecord::Base
score = 0
self.games.each do |game|
if game.status == 2
- score += game.final_score
+ score += game.final_score.to_i
end
end
score
diff --git a/app/models/output.rb b/app/models/output.rb
index 4ce462eff..8f1547cfe 100644
--- a/app/models/output.rb
+++ b/app/models/output.rb
@@ -4,5 +4,5 @@ class Output < ActiveRecord::Base
# compile_success 1 表示程序未报错,有正常输出, 0.表示程序抛异常了,报错!
default_scope :order => 'query_index desc'
belongs_to :game
-
+ #belongs_to :challenge_choose
end
diff --git a/app/views/challenges/_choose_type.html.erb b/app/views/challenges/_choose_type.html.erb
index 1947a3760..a47d921f9 100644
--- a/app/views/challenges/_choose_type.html.erb
+++ b/app/views/challenges/_choose_type.html.erb
@@ -4,8 +4,10 @@
<%= render :partial => "challenges/choose_tab" %>
- <% if @shixun.status == 0 && User.current.manager_of_shixun?(@shixun) %> + <% if User.current.manager_of_shixun?(@shixun) %> 编辑 <% end %>
@@ -49,8 +49,8 @@ <% end %> -<%= match_specific_symbol test.input unless test.input.blank? %>
<%= match_specific_symbol test.output unless test.output.blank? %>
<%= match_specific_symbol test.input unless test.input.blank? %>
<%= match_specific_symbol test.output unless test.output.blank? %>
+
-
+
-
- <%= group.name %> + <%= group.name %> <%= group.members.count %>
@@ -27,3 +27,13 @@+
<%= group.name %> <%= group.members.count %> -
+
<%= group.name %> <%= group.members.count %> @@ -26,4 +26,14 @@ <%= render :partial => "courses/settings/has_group_student_list_block" %> - \ No newline at end of file + + + \ No newline at end of file diff --git a/app/views/courses/settings/_has_group_student_list_block.html.erb b/app/views/courses/settings/_has_group_student_list_block.html.erb index 44178da15..5bf490f8c 100644 --- a/app/views/courses/settings/_has_group_student_list_block.html.erb +++ b/app/views/courses/settings/_has_group_student_list_block.html.erb @@ -34,8 +34,9 @@ <% end %>
diff --git a/app/views/courses/settings/_members.html.erb b/app/views/courses/settings/_members.html.erb index 1c1806e00..cdb8e9d0b 100644 --- a/app/views/courses/settings/_members.html.erb +++ b/app/views/courses/settings/_members.html.erb @@ -46,20 +46,22 @@ <% end %> - <% @apply_users.each_with_index do |apply, index| %> - <% user = User.find(apply.course_message_id) %> -+
<%= group.name %> <%= group.members.count %> @@ -26,3 +26,14 @@ <%= render :partial => "courses/settings/no_group_student_list_block" %> + + + \ No newline at end of file diff --git a/app/views/courses/settings/_no_group_student_list_block.html.erb b/app/views/courses/settings/_no_group_student_list_block.html.erb index 2cb30a5a5..86b6ec0ff 100644 --- a/app/views/courses/settings/_no_group_student_list_block.html.erb +++ b/app/views/courses/settings/_no_group_student_list_block.html.erb @@ -20,8 +20,9 @@ <% end %>
diff --git a/app/views/courses/settings/_search_not_students_list.html.erb b/app/views/courses/settings/_search_not_students_list.html.erb index d0ad45ea1..882b28edc 100644 --- a/app/views/courses/settings/_search_not_students_list.html.erb +++ b/app/views/courses/settings/_search_not_students_list.html.erb @@ -7,7 +7,8 @@+ + 实验四 多周期CPU与存储器实验 +
+ 返回 +发布设置
+ 编辑 +发布之前,学生不会收到试卷
+结束之后,系统自动归档试卷
+发布设置
+发布之前,学生不会收到试卷
+结束之后,系统自动归档试卷
+答题设置
+答题时长不填写,则表示不限时长
+学生答题时间即使没有超过答题时长的限制
+但是已到截止时间点,则系统自动为正在答题的学生提交试卷
+允许补交,则在补交截止日期之前,未答题的学生可以补交答题
+但是在发布截止日期~补交截止时间内才答题的学生,将被扣迟交分
+答题设置
+答题时长不填写,则表示不限时长
+学生答题时间即使没有超过答题时长的限制
+但是已到截止时间点,则系统自动为正在答题的学生提交试卷
+允许补交,则在补交截止日期之前,未答题的学生可以补交答题
+但是在发布截止日期~补交截止时间内才答题的学生,将被扣迟交分
+主观题评分设置
+计算说明
+教师评分*其百分比+助教评分+其百分比+迟交扣分
+注意
+非零百分比的评分选项,在没有评分记录的情况下,其百分比平摊到另外
的评分选项上。例如教师评分60% + 助教评分40% ,学生A没有得到
教师评分,则最终成绩将按照助教评分100% 进行计算
+主观题评分设置
+计算说明
+教师评分*其百分比+助教评分+其百分比+迟交扣分
+注意
+非零百分比的评分选项,在没有评分记录的情况下,其百分比平摊到另外
的评分选项上。例如教师评分60% + 助教评分40% ,学生A没有得到
教师评分,则最终成绩将按照助教评分100% 进行计算
+公开设置
+公开设置
+试卷须知: + 共有选择、填空、简答、编程题4种题型,其中选择题包括单选题和多选题。 + 请大家认真答题,本次作业成绩将计入期末成绩。
++ 单选题 3 题,共 15 分 + 多选题 5 题,共 25 分 + 填空题 10 题,共 25 分 + 简答题 10 题,共 25 分 +
+合计 18 题,共 100 分
+总分:89分
+第1题:[多选题]10分
+ +10分
+ +黑盒测试和白盒测试的区别
+第2题:[单选题]5分
+0分
+黑盒测试和白盒测试的区别
+第3题:[填空题]5分
+0分
+黑盒测试和白盒测试(没有)区别
+候选答案1:哈哈哈哈
+候选答案1:呵呵呵呵
+第4题:[简答题]10分
+9分
+黑盒测试和白盒测试的区别
+参考答案
+黑盒测试也称功能测试或数据驱动测试,它是在已知产品所应具有的功能,通过测试来检测每个功能是否都能正常使用,在测试时,把程序看作一个不能打开的黑盆子,在完全不考虑程序内部结构和内部特性的情况下,
+软件测试小测
+ + + 返回 +试卷须知: + 共有选择、填空、简答、编程题4种题型,其中选择题包括单选题和多选题。 + 请大家认真答题,本次作业成绩将计入期末成绩。
++ 单选题 3 题,共 15 分 + 多选题 5 题,共 25 分 + 填空题 10 题,共 25 分 + 简答题 10 题,共 25 分 +
+合计 18 题,共 100 分
+第1题:[多选题]10分
+黑盒测试和白盒测试的区别
+第2题:[单选题]5分
+黑盒测试和白盒测试的区别
+第3题:[填空题]5分
+黑盒测试和白盒测试()区别
+第4题:[简答题]10分
+黑盒测试和白盒测试的区别
+试卷须知: + 共有选择、填空、简答、编程题4种题型,其中选择题包括单选题和多选题。 + 请大家认真答题,本次作业成绩将计入期末成绩。
++ 单选题 3 题,共 15 分 + 多选题 5 题,共 25 分 + 填空题 10 题,共 25 分 + 简答题 10 题,共 25 分 +
+合计 18 题,共 100 分
+第1题:[多选题]10分
+10分
+黑盒测试和白盒测试的区别
+第2题:[单选题]5分
+0分
+黑盒测试和白盒测试的区别
+第3题:[填空题]5分
+0分
+黑盒测试和白盒测试(没有)区别
+候选答案1:哈哈哈哈
+候选答案1:呵呵呵呵
+第4题:[简答题]10分
+9分
+黑盒测试和白盒测试的区别
+参考答案
+黑盒测试也称功能测试或数据驱动测试,它是在已知产品所应具有的功能,通过测试来检测每个功能是否都能正常使用,在测试时,把程序看作一个不能打开的黑盆子,在完全不考虑程序内部结构和内部特性的情况下,
+试卷须知: + 共有选择、填空、简答、编程题4种题型,其中选择题包括单选题和多选题。 + 请大家认真答题,本次作业成绩将计入期末成绩。
++ 单选题 3 题,共 15 分 + 多选题 5 题,共 25 分 + 填空题 10 题,共 25 分 + 简答题 10 题,共 25 分 +
+合计 18 题,共 100 分
+黑盒测试和白盒测试的区别
+黑盒测试和白盒测试的区别
++ + 胡莎莎 > 智能课堂> 计算机基础> 计算机基础学院工程专业 +
+| 序号 | +姓名 | +学号 | +提交状态 | +提交时间 | +客观题得分 | +主观题教师评分 | +主观题助教评分 | +最终成绩 | +操作 | +
|---|---|---|---|---|---|---|---|---|---|
| 48 | +李航 | +2015551337 | +按时提交 | +2016-11-24 17:53 | +-- | +-- | +91.0
+
+
+
+
+ 5名助教进行了评分 |
+
+ 91.0
+
+
+
+
+ 胡莎莎(ruanjianlihang) |
+ 评阅 | +
| 48 | +胡莎莎 | +2015551337 | +延时提交 | +2016-11-24 17:53 | +95 | +-- | +91.0
+
+
+
+
+ 1名助教进行了评分 |
+
+ 52.0
+
+
+
+
+ 李航(ruanjianlihang) |
+ 评阅 | +
| 48 | +李航 | +2015551337 | +未提交 | +2016-11-24 17:53 | +-- | +65.0 | +65.0
+
+
+
+
+ 1名助教进行了评分 |
+
+ 91.0
+
+
+
+
+ 李航(ruanjianlihang) |
+ + 评阅 + + + | +
+ + 班级首页 > 试卷 +
+新建试卷
+ 返回 +简答题
++ 温馨提示:[简答题]属于主观题需要人工评分,未作答的情况下系统将自动评分 + 参考答案仅作为人工评分的参考 + 保存 + 取消 +
++ 单选题 3 题,共 15 分 + 多选题 5 题,共 25 分 + 填空题 10 题,共 25 分 + 简答题 10 题,共 25 分 +
+ + 合计 10 题,共 100 分 + +<%= render :partial => 'course_file_filter_order', :locals => {:remote => @is_remote, :sort => @sort, :order => @order} %> diff --git a/app/views/files/_course_list.html.erb b/app/views/files/_course_list.html.erb index c1836895b..67c6a458d 100644 --- a/app/views/files/_course_list.html.erb +++ b/app/views/files/_course_list.html.erb @@ -1,3 +1,10 @@ + <% if curse_attachments.count != 0 %> <% curse_attachments.each do |file| %> <% if file.is_public? || User.current.member_of_course?(course) || User.current.admin? %> @@ -8,10 +15,15 @@
+ <% if comment.creator_user == User.current %> + 删除 + <% end %> + | + <%= link_to( + '回复'.html_safe, + {:controller => 'users' ,:action => 'reply_to',:reply_id => comment.id, :type => memo.class.to_s, :user_activity_id => memo.id}, + :remote => true, + :method => 'get', + :title => l(:button_reply),:class => "color-grey") %> + | + + <%=render :partial=> "praise_tread/edu_praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%> + +
+