Merge branch 'sw_new_course' into szzh
This commit is contained in:
commit
84191fcedc
1
Gemfile
1
Gemfile
|
@ -26,6 +26,7 @@ gem 'spreadsheet'
|
|||
gem 'ruby-ole'
|
||||
gem 'rails_kindeditor',path:'lib/rails_kindeditor'
|
||||
#gem "rmagick", ">= 2.0.0"
|
||||
gem 'binding_of_caller'
|
||||
|
||||
group :development do
|
||||
gem 'grape-swagger'
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
class HomeworkCommonController < ApplicationController
|
||||
require 'net/http'
|
||||
require 'json'
|
||||
layout "base_courses"
|
||||
before_filter :find_course, :only => [:index,:new,:create]
|
||||
before_filter :find_course, :only => [:index,:new,:create,:next_step]
|
||||
before_filter :find_homework, :only => [:edit,:update,:alert_anonymous_comment,:start_anonymous_comment,:stop_anonymous_comment,:destroy]
|
||||
before_filter :teacher_of_course, :only => [:new, :create, :edit, :update, :destroy, :start_anonymous_comment, :stop_anonymous_comment, :alert_anonymous_comment]
|
||||
before_filter :member_of_course, :only => [:index]
|
||||
|
@ -16,20 +18,37 @@ class HomeworkCommonController < ApplicationController
|
|||
end
|
||||
|
||||
def new
|
||||
respond_to do |format|
|
||||
format.html
|
||||
end
|
||||
end
|
||||
|
||||
#新建作业下一步
|
||||
def next_step
|
||||
@homework_type = params[:homework_common_type]
|
||||
|
||||
@homework = HomeworkCommon.new
|
||||
@homework.safe_attributes = params[:homework_common]
|
||||
@homework.late_penalty = 0
|
||||
@homework.end_time = (Time.now + 3600 * 24).strftime('%Y-%m-%d')
|
||||
@homework.publish_time = Time.now.strftime('%Y-%m-%d')
|
||||
|
||||
#匿评作业相关属性
|
||||
@homework_detail_manual = HomeworkDetailManual.new
|
||||
@homework_detail_manual.ta_proportion = 0.6
|
||||
@homework_detail_manual.absence_penalty = 0
|
||||
@homework_detail_manual.evaluation_num = 3
|
||||
@homework_detail_manual.evaluation_start = Time.now.strftime('%Y-%m-%d')
|
||||
@homework_detail_manual.evaluation_end = (Time.now + 3600 * 24).strftime('%Y-%m-%d')
|
||||
@homework.homework_detail_manual = @homework_detail_manual
|
||||
if @homework_type == "1"
|
||||
#匿评作业相关属性
|
||||
@homework_detail_manual = HomeworkDetailManual.new
|
||||
@homework_detail_manual.ta_proportion = 0.6
|
||||
@homework_detail_manual.absence_penalty = 0
|
||||
@homework_detail_manual.evaluation_num = 3
|
||||
@homework_detail_manual.evaluation_start = Time.now.strftime('%Y-%m-%d')
|
||||
@homework_detail_manual.evaluation_end = (Time.now + 3600 * 24).strftime('%Y-%m-%d')
|
||||
@homework.homework_detail_manual = @homework_detail_manual
|
||||
elsif @homework_type == "2"
|
||||
#编程作业相关属性
|
||||
@homework_detail_programing = HomeworkDetailPrograming.new
|
||||
@homework.homework_detail_programing = @homework_detail_programing
|
||||
end
|
||||
|
||||
|
||||
respond_to do |format|
|
||||
format.html
|
||||
end
|
||||
|
@ -50,15 +69,57 @@ class HomeworkCommonController < ApplicationController
|
|||
homework.save_attachments(params[:attachments])
|
||||
render_attachment_warning_if_needed(homework)
|
||||
|
||||
#匿评作业相关属性
|
||||
homework_detail_manual = HomeworkDetailManual.new
|
||||
homework_detail_manual.ta_proportion = params[:ta_proportion] || 0.6
|
||||
homework_detail_manual.comment_status = 1
|
||||
homework_detail_manual.evaluation_start = params[:evaluation_start]
|
||||
homework_detail_manual.evaluation_end = params[:evaluation_end]
|
||||
homework_detail_manual.evaluation_num = params[:evaluation_num]
|
||||
homework_detail_manual.absence_penalty = params[:absence_penalty]
|
||||
homework.homework_detail_manual = homework_detail_manual
|
||||
if homework.homework_type == 2
|
||||
homework_detail_programing = HomeworkDetailPrograming.new
|
||||
homework_detail_programing.language = "C++"
|
||||
homework_detail_programing.standard_code = params[:standard_code]
|
||||
|
||||
question = {title:homework.name,content:homework.description}
|
||||
question[:input] = []
|
||||
question[:output] = []
|
||||
if params[:input] && params[:output]
|
||||
params[:input].each do |k,v|
|
||||
if params[:output].include? k
|
||||
homework_test = HomeworkTest.new
|
||||
homework_test.input = v
|
||||
homework_test.output = params[:output][k]
|
||||
homework.homework_tests << homework_test
|
||||
question[:input] << homework_test.input
|
||||
question[:output] << homework_test.output
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# uri = URI('http://test.gitlab.trustie.net/api/questions.json')
|
||||
# req = Net::HTTP::Post.new(uri, initheader = {'Content-Type' =>'application/json'})
|
||||
# req.body = question.to_json
|
||||
# res = Net::HTTP.start(uri.hostname, uri.port) do |http|
|
||||
# http.request(req)
|
||||
# end
|
||||
|
||||
uri = URI('http://192.168.80.21:8080/api/questions.json')
|
||||
body = question.to_json
|
||||
res = Net::HTTP.new(uri.host, uri.port).start do |client|
|
||||
request = Net::HTTP::Post.new(uri.path)
|
||||
request.body = body
|
||||
request["Content-Type"] = "application/json"
|
||||
client.request(request)
|
||||
end
|
||||
result = JSON.parse(res.body)
|
||||
homework_detail_programing.question_id = result["id"] if result["status"] && result["status"] == 0
|
||||
|
||||
homework.homework_detail_programing = homework_detail_programing
|
||||
else
|
||||
#匿评作业相关属性
|
||||
homework_detail_manual = HomeworkDetailManual.new
|
||||
homework_detail_manual.ta_proportion = params[:ta_proportion] || 0.6
|
||||
homework_detail_manual.comment_status = 1
|
||||
homework_detail_manual.evaluation_start = params[:evaluation_start]
|
||||
homework_detail_manual.evaluation_end = params[:evaluation_end]
|
||||
homework_detail_manual.evaluation_num = params[:evaluation_num]
|
||||
homework_detail_manual.absence_penalty = params[:absence_penalty]
|
||||
homework.homework_detail_manual = homework_detail_manual
|
||||
end
|
||||
|
||||
if homework.save
|
||||
respond_to do |format|
|
||||
|
@ -98,10 +159,10 @@ class HomeworkCommonController < ApplicationController
|
|||
end
|
||||
@homework.late_penalty = params[:late_penalty]
|
||||
end
|
||||
@homework.course_id = @course.id
|
||||
# @homework.course_id = @course.id
|
||||
|
||||
#匿评作业相关属性
|
||||
if @homework.homework_type == 1
|
||||
if @homework.homework_type == 1 && @homework_detail_manual
|
||||
@homework_detail_manual.ta_proportion = params[:ta_proportion] || 0.6
|
||||
@homework_detail_manual.evaluation_start = params[:evaluation_start]
|
||||
@homework_detail_manual.evaluation_end = params[:evaluation_end]
|
||||
|
@ -117,18 +178,49 @@ class HomeworkCommonController < ApplicationController
|
|||
end
|
||||
@homework_detail_manual.absence_penalty = params[:absence_penalty]
|
||||
end
|
||||
else #不是匿评作业,缺评扣分为0分,每个作品的缺评扣分改为0分,防止某些作业在结束匿评之后改为普通作业
|
||||
elsif @homework.homework_type == 0 #普通作业,缺评扣分为0分,每个作品的缺评扣分改为0分,防止某些作业在结束匿评之后改为普通作业
|
||||
@homework.student_works.where("absence_penalty != 0").each do |student_work|
|
||||
student_work.late_penalty = 0
|
||||
student_work.save
|
||||
end
|
||||
@homework_detail_manual.absence_penalty = 0
|
||||
@homework_detail_manual.absence_penalty = 0 if @homework_detail_manual
|
||||
end
|
||||
|
||||
if @homework.homework_type == 2 && @homework_detail_programing #编程作业
|
||||
@homework_detail_programing.language = "C++"
|
||||
@homework_detail_programing.standard_code = params[:standard_code]
|
||||
homework_tests = @homework.homework_tests
|
||||
#需要删除的测试
|
||||
ids = homework_tests.map(&:id) - params[:input].keys.map(&:to_i)
|
||||
ids.each do |id|
|
||||
homework_test = HomeworkTest.find id
|
||||
homework_test.destroy if homework_test
|
||||
end
|
||||
if params[:input] && params[:output]
|
||||
params[:input].each do |k,v|
|
||||
if params[:output].include? k
|
||||
homework_test = HomeworkTest.find_by_id k
|
||||
if homework_test #已存在的测试,修改
|
||||
homework_test.input = v
|
||||
homework_test.output = params[:output][k]
|
||||
else #不存在的测试,增加
|
||||
homework_test = HomeworkTest.new
|
||||
homework_test.input = v
|
||||
homework_test.output = params[:output][k]
|
||||
homework_test.homework_common = @homework
|
||||
end
|
||||
homework_test.save
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@homework.save_attachments(params[:attachments])
|
||||
render_attachment_warning_if_needed(@homework)
|
||||
|
||||
if @homework.save && @homework_detail_manual.save
|
||||
if @homework.save
|
||||
@homework_detail_manual.save if @homework_detail_manual
|
||||
@homework_detail_programing.save if @homework_detail_programing
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
flash[:notice] = l(:notice_successful_edit)
|
||||
|
@ -227,6 +319,7 @@ class HomeworkCommonController < ApplicationController
|
|||
def find_homework
|
||||
@homework = HomeworkCommon.find params[:id]
|
||||
@homework_detail_manual = @homework.homework_detail_manual
|
||||
@homework_detail_programing = @homework.homework_detail_programing
|
||||
@course = @homework.course
|
||||
rescue
|
||||
render_404
|
||||
|
|
|
@ -23,7 +23,7 @@ class PollController < ApplicationController
|
|||
|
||||
def show
|
||||
@poll = Poll.find params[:id]
|
||||
if @poll.polls_status != 2 && !User.current.allowed_to?(:as_teacher,@course)
|
||||
if @poll.polls_status != 2 && (!User.current.allowed_to?(:as_teacher,@course) || User.current.admin?)
|
||||
render_403
|
||||
return
|
||||
end
|
||||
|
@ -393,7 +393,7 @@ class PollController < ApplicationController
|
|||
end
|
||||
|
||||
def is_member_of_course
|
||||
render_403 unless(@course && User.current.member_of_course?(@course))
|
||||
render_403 unless(@course && (User.current.member_of_course?(@course) || User.current.admin?))
|
||||
end
|
||||
|
||||
def is_course_teacher
|
||||
|
|
|
@ -2,47 +2,87 @@ class StudentWorkController < ApplicationController
|
|||
layout "base_courses"
|
||||
include StudentWorkHelper
|
||||
require 'bigdecimal'
|
||||
require "base64"
|
||||
before_filter :find_homework, :only => [:new, :index, :create, :student_work_absence_penalty, :absence_penalty_list, :evaluation_list]
|
||||
before_filter :find_work, :only => [:edit, :update, :show, :destroy, :add_score, :praise_student_work]
|
||||
before_filter :member_of_course, :only => [:index, :new, :create, :show, :add_score, :praise_student_work]
|
||||
before_filter :author_of_work, :only => [:edit, :update, :destroy]
|
||||
before_filter :teacher_of_course, :only => [:student_work_absence_penalty, :absence_penalty_list, :evaluation_list]
|
||||
protect_from_forgery :except => :set_program_score
|
||||
|
||||
def index
|
||||
@order,@b_sort,@name = params[:order] || "score",params[:sort] || "desc",params[:name] || ""
|
||||
@order,@b_sort,@name,@group = params[:order] || "score",params[:sort] || "desc",params[:name] || "",params[:group]
|
||||
@is_teacher = User.current.allowed_to?(:as_teacher,@course)
|
||||
#老师 || 非匿评作业 || 匿评结束 显示所有的作品
|
||||
@show_all = @is_teacher || @homework.homework_type != 1 || @homework.homework_detail_manual.comment_status == 3 || User.current.admin?
|
||||
if @show_all
|
||||
if @homework.homework_type == 1 || @is_teacher || User.current.admin? #超级管理员 || 老师 || 匿评结束 显示所有的作品
|
||||
if @order == "name"
|
||||
@stundet_works = search_homework_member @homework.student_works.select("*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").joins(:user).order("users.lastname #{@b_sort}, users.firstname #{@b_sort}"),@name
|
||||
else
|
||||
@stundet_works = search_homework_member @homework.student_works.select("*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").order("#{@order} #{@b_sort}"),@name
|
||||
end
|
||||
else #剩余情况: 学生 && 非匿评作业 如果未提交作品,只能看到自己的,提交了作品,能看到所有作品
|
||||
my_work = @homework.student_works.select("*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id)
|
||||
if my_work.empty?
|
||||
@stundet_works = []
|
||||
else
|
||||
unless @group == "0" || @group.nil?
|
||||
group_students = CourseGroup.find_by_id(@group).users
|
||||
if group_students.empty?
|
||||
student_in_group = '(0)'
|
||||
else
|
||||
student_in_group = '(' + group_students.map{|user| user.id}.join(',') + ')'
|
||||
end
|
||||
#老师 || 非匿评作业 || 匿评结束 显示所有的作品
|
||||
@show_all = @is_teacher || @homework.homework_type != 1 || @homework.homework_detail_manual.comment_status == 3 || User.current.admin?
|
||||
if @show_all
|
||||
if @homework.homework_type == 1 || @is_teacher || User.current.admin? #超级管理员 || 老师 || 匿评结束 显示所有的作品
|
||||
if @order == "name"
|
||||
@stundet_works = search_homework_member @homework.student_works.select("*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").joins(:user).order("users.lastname #{@b_sort}, users.firstname #{@b_sort}"),@name
|
||||
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").joins(:user).where("users.id in #{student_in_group}").order("users.lastname #{@b_sort}, users.firstname #{@b_sort}"),@name
|
||||
else
|
||||
@stundet_works = search_homework_member @homework.student_works.select("*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").order("#{@order} #{@b_sort}"),@name
|
||||
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").joins(:user).where("users.id in #{student_in_group}").order("#{@order} #{@b_sort}"),@name
|
||||
end
|
||||
else #剩余情况: 学生 && 非匿评作业 如果未提交作品,只能看到自己的,提交了作品,能看到所有作品
|
||||
my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id)
|
||||
if my_work.empty?
|
||||
@stundet_works = []
|
||||
else
|
||||
if @order == "name"
|
||||
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").joins(:user).where("users.id in #{student_in_group}").order("users.lastname #{@b_sort}, users.firstname #{@b_sort}"),@name
|
||||
else
|
||||
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").joins(:user).where("users.id in #{student_in_group}").order("#{@order} #{@b_sort}"),@name
|
||||
end
|
||||
end
|
||||
end
|
||||
else #学生
|
||||
if @homework.homework_detail_manual.comment_status == 1 #未开启匿评,只显示我的作品
|
||||
@stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id)
|
||||
elsif @homework.homework_detail_manual.comment_status == 2 #匿评列表,显示匿评作品和我的作品
|
||||
@is_evaluation = true
|
||||
my_work = @homework.student_works.where(:user_id => User.current.id)
|
||||
@stundet_works = my_work + User.current.student_works_evaluation_distributions.map(&:student_work).select { |work| work.homework_common_id == @homework.id}
|
||||
end
|
||||
end
|
||||
else #学生
|
||||
if @homework.homework_detail_manual.comment_status == 1 #未开启匿评,只显示我的作品
|
||||
@stundet_works = @homework.student_works.select("*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id)
|
||||
elsif @homework.homework_detail_manual.comment_status == 2 #匿评列表,显示匿评作品和我的作品
|
||||
@is_evaluation = true
|
||||
my_work = @homework.student_works.where(:user_id => User.current.id)
|
||||
@stundet_works = my_work + User.current.student_works_evaluation_distributions.map(&:student_work).select { |work| work.homework_common_id == @homework.id}
|
||||
else
|
||||
#老师 || 非匿评作业 || 匿评结束 显示所有的作品
|
||||
@show_all = @is_teacher || @homework.homework_type != 1 || @homework.homework_detail_manual.comment_status == 3 || User.current.admin?
|
||||
if @show_all
|
||||
if @homework.homework_type == 1 || @is_teacher || User.current.admin? #超级管理员 || 老师 || 匿评结束 显示所有的作品
|
||||
if @order == "name"
|
||||
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").joins(:user).order("users.lastname #{@b_sort}, users.firstname #{@b_sort}"),@name
|
||||
else
|
||||
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").order("#{@order} #{@b_sort}"),@name
|
||||
end
|
||||
else #剩余情况: 学生 && 非匿评作业 如果未提交作品,只能看到自己的,提交了作品,能看到所有作品
|
||||
my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id)
|
||||
if my_work.empty?
|
||||
@stundet_works = []
|
||||
else
|
||||
if @order == "name"
|
||||
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").joins(:user).order("users.lastname #{@b_sort}, users.firstname #{@b_sort}"),@name
|
||||
else
|
||||
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").order("#{@order} #{@b_sort}"),@name
|
||||
end
|
||||
end
|
||||
end
|
||||
else #学生
|
||||
if @homework.homework_detail_manual.comment_status == 1 #未开启匿评,只显示我的作品
|
||||
@stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id)
|
||||
elsif @homework.homework_detail_manual.comment_status == 2 #匿评列表,显示匿评作品和我的作品
|
||||
@is_evaluation = true
|
||||
my_work = @homework.student_works.where(:user_id => User.current.id)
|
||||
@stundet_works = my_work + User.current.student_works_evaluation_distributions.map(&:student_work).select { |work| work.homework_common_id == @homework.id}
|
||||
end
|
||||
end
|
||||
end
|
||||
@homework_commons = @course.homework_commons.order("created_at desc")
|
||||
@homework_commons = @course.homework_commons.order("created_at desc")
|
||||
@score = @b_sort == "desc" ? "asc" : "desc"
|
||||
respond_to do |format|
|
||||
format.html
|
||||
|
@ -80,7 +120,24 @@ class StudentWorkController < ApplicationController
|
|||
stundet_work.late_penalty = 0
|
||||
end
|
||||
render_attachment_warning_if_needed(stundet_work)
|
||||
|
||||
if stundet_work.save
|
||||
if @homework.homework_type == 2 && @homework.homework_detail_programing #编程作业,学生提交作品后计算系统得分
|
||||
url = "http://192.168.80.21:8080/api/questions/#{@homework.homework_detail_programing.question_id}/solutions.json"
|
||||
solutions = {
|
||||
student_work_id:stundet_work.id,
|
||||
src:Base64.encode64(stundet_work.description),
|
||||
language:1
|
||||
}
|
||||
uri = URI(url)
|
||||
body = solutions.to_json
|
||||
res = Net::HTTP.new(uri.host, uri.port).start do |client|
|
||||
request = Net::HTTP::Post.new(uri.path)
|
||||
request.body = body
|
||||
request["Content-Type"] = "application/json"
|
||||
client.request(request)
|
||||
end
|
||||
end
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
flash[:notice] = l(:notice_successful_create)
|
||||
|
@ -99,8 +156,12 @@ class StudentWorkController < ApplicationController
|
|||
end
|
||||
|
||||
def edit
|
||||
respond_to do |format|
|
||||
format.html
|
||||
if @homework.homework_type == 2 #编程作业不能修改作业
|
||||
render_403
|
||||
else
|
||||
respond_to do |format|
|
||||
format.html
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -135,7 +196,9 @@ class StudentWorkController < ApplicationController
|
|||
end
|
||||
|
||||
def destroy
|
||||
if @work.destroy
|
||||
if @homework.homework_type == 2 #编程作业,作品提交后不可以删除
|
||||
render_403
|
||||
elsif @work.destroy
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
redirect_to student_work_index_url(:homework => @homework.id)
|
||||
|
@ -154,6 +217,12 @@ class StudentWorkController < ApplicationController
|
|||
if @score
|
||||
@score.comment = params[:new_form][:user_message] if params[:new_form] && params[:new_form][:user_message] && params[:new_form][:user_message] != ""
|
||||
@score.score = params[:score] if params[:score]
|
||||
if User.current.admin?
|
||||
@score.reviewer_role = 1
|
||||
else
|
||||
role = User.current.members.where("course_id = ?",@course.id).first.roles.first.name
|
||||
@score.reviewer_role = get_role_by_name(role)
|
||||
end
|
||||
@is_new = false
|
||||
else
|
||||
@score = StudentWorksScore.new
|
||||
|
@ -161,8 +230,12 @@ class StudentWorkController < ApplicationController
|
|||
@score.comment = params[:new_form][:user_message] if params[:new_form] && params[:new_form][:user_message] && params[:new_form][:user_message] != ""
|
||||
@score.user_id = User.current.id
|
||||
@score.student_work_id = @work.id
|
||||
role = User.current.members.where("course_id = ?",@course.id).first.roles.first.name
|
||||
User.current.admin? ? @score.reviewer_role = 1 : @score.reviewer_role = get_role_by_name(role)
|
||||
if User.current.admin?
|
||||
@score.reviewer_role = 1
|
||||
else
|
||||
role = User.current.members.where("course_id = ?",@course.id).first.roles.first.name
|
||||
@score.reviewer_role = get_role_by_name(role)
|
||||
end
|
||||
@is_new = true
|
||||
end
|
||||
|
||||
|
@ -180,8 +253,10 @@ class StudentWorkController < ApplicationController
|
|||
if @work.student_score.nil?
|
||||
@work.final_score = @work.teaching_asistant_score
|
||||
else
|
||||
final_ta_score = BigDecimal.new("#{@work.teaching_asistant_score}") * BigDecimal.new("#{@homework.homework_detail_manual.ta_proportion}")
|
||||
final_s_score = BigDecimal.new("#{@work.student_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{@homework.homework_detail_manual.ta_proportion}"))
|
||||
ta_proportion = @homework.homework_detail_manual.ta_proportion if @homework.homework_detail_manual
|
||||
ta_proportion = @homework.homework_detail_programing.ta_proportion if @homework.homework_detail_programing
|
||||
final_ta_score = BigDecimal.new("#{@work.teaching_asistant_score}") * BigDecimal.new("#{ta_proportion}")
|
||||
final_s_score = BigDecimal.new("#{@work.student_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{ta_proportion}"))
|
||||
final_score = final_ta_score + final_s_score
|
||||
@work.final_score = format("%.2f",final_score.to_f)
|
||||
end
|
||||
|
@ -303,6 +378,45 @@ class StudentWorkController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
#设置编程作业得分
|
||||
def set_program_score
|
||||
stundet_work = StudentWork.find_by_id params[:student_work_id]
|
||||
@course = stundet_work.homework_common.course
|
||||
student_score_count = 0
|
||||
if stundet_work && params[:results] && params[:results].class.to_s == "Array"
|
||||
homework_common = stundet_work.homework_common
|
||||
params[:results].each do |result|
|
||||
homework_test = homework_common.homework_tests.where("input = '#{result[:input]}' AND output = '#{result[:output]}'").first
|
||||
if homework_test
|
||||
student_work_test = StudentWorkTest.new
|
||||
student_work_test.student_work = stundet_work
|
||||
student_work_test.homework_test = homework_test
|
||||
student_work_test.result = result[:status]
|
||||
if student_work_test.result == 0
|
||||
student_score_count += 1
|
||||
end
|
||||
student_work_test.save!
|
||||
end
|
||||
end
|
||||
unless homework_common.homework_tests.empty?
|
||||
stundet_work.student_score = student_score_count * 100.0 / homework_common.homework_tests.count
|
||||
|
||||
if stundet_work.teacher_score.nil?
|
||||
if stundet_work.teaching_asistant_score.nil?
|
||||
stundet_work.final_score = stundet_work.student_score
|
||||
else
|
||||
final_ta_score = BigDecimal.new("#{stundet_work.teaching_asistant_score}") * BigDecimal.new("#{homework_common.homework_detail_programing.ta_proportion}")
|
||||
final_s_score = BigDecimal.new("#{stundet_work.student_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{homework_common.homework_detail_programing.ta_proportion}"))
|
||||
final_score = final_ta_score + final_s_score
|
||||
stundet_work.final_score = format("%.1f",final_score.to_f)
|
||||
end
|
||||
end
|
||||
|
||||
stundet_work.save!
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
#获取作业
|
||||
def find_homework
|
||||
|
|
|
@ -2292,6 +2292,8 @@ module ApplicationHelper
|
|||
else
|
||||
link = "<span class='fr mr10 pr_join_span ' title='学生提交作业数大于2时才可以启动匿评'>启动匿评</span>".html_safe
|
||||
end
|
||||
elsif homework.homework_type == 2 && homework.homework_detail_programing #编程作业作业
|
||||
link = "<span class='fr mr10 pr_join_span ' title='编程作业'>编程作业</span>".html_safe
|
||||
else
|
||||
link = "<span class='fr mr10 pr_join_span ' title='未开启匿评作业不可以启动匿评'>启动匿评</span>".html_safe
|
||||
end
|
||||
|
@ -2305,6 +2307,8 @@ module ApplicationHelper
|
|||
else
|
||||
if homework.homework_type == 1 && homework.homework_detail_manual && homework.homework_detail_manual.comment_status != 1 #匿评作业,且作业状态不是在开启匿评之前
|
||||
"<span class='fr mr10 pr_join_span '>#{l(:label_edit_homework)}</span>".html_safe
|
||||
elsif homework.homework_type == 2 #编程作业不能修改作品
|
||||
"<span class='fr mr10 pr_join_span ' title='编程作业不可修改作品'>作品已交</span>".html_safe
|
||||
else
|
||||
link_to l(:label_edit_homework), edit_student_work_path(work.id),:class => 'fr mr10 work_edit'
|
||||
end
|
||||
|
@ -2324,7 +2328,7 @@ module ApplicationHelper
|
|||
elsif homework.homework_type == 0
|
||||
"<span class='fr mr10 pr_join_span '>未启用匿评</span>".html_safe
|
||||
elsif homework.homework_type == 2
|
||||
"<span class='fr mr10 pr_join_span '>编程作业</span>".html_safe
|
||||
"<span class='fr mr10 pr_join_span '> 编程作业 </span>".html_safe
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -2339,4 +2343,8 @@ module ApplicationHelper
|
|||
end
|
||||
end
|
||||
|
||||
#将文本内的/n转换为<br>
|
||||
def text_format text
|
||||
text.gsub("\n","<br/>").html_safe
|
||||
end
|
||||
end
|
||||
|
|
|
@ -80,4 +80,22 @@ module StudentWorkHelper
|
|||
end
|
||||
color
|
||||
end
|
||||
|
||||
#获取分班信息
|
||||
def course_group_list course
|
||||
result = []
|
||||
if course.course_groups && !course.course_groups.empty?
|
||||
base = []
|
||||
base << l(:label_chose_group)
|
||||
base << 0
|
||||
result << base
|
||||
course.course_groups.each do |group|
|
||||
option = []
|
||||
option << group.name
|
||||
option << group.id
|
||||
result << option
|
||||
end
|
||||
end
|
||||
result
|
||||
end
|
||||
end
|
|
@ -2,4 +2,5 @@ class HomeworkTest < ActiveRecord::Base
|
|||
attr_accessible :input, :output, :homework_common_id
|
||||
|
||||
belongs_to :homework_common
|
||||
has_one :student_work_test
|
||||
end
|
||||
|
|
|
@ -7,6 +7,13 @@ class StudentWork < ActiveRecord::Base
|
|||
has_many :student_works_evaluation_distributions, :dependent => :destroy
|
||||
has_many :student_works_scores, :dependent => :destroy
|
||||
belongs_to :project
|
||||
has_one :student_work_test
|
||||
|
||||
before_destroy :delete_praise
|
||||
|
||||
acts_as_attachable
|
||||
|
||||
def delete_praise
|
||||
PraiseTread.where("praise_tread_object_id = #{self.id} AND praise_tread_object_type = 'StudentWork'").destroy_all
|
||||
end
|
||||
end
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
# encoding: utf-8
|
||||
class StudentWorkTest < ActiveRecord::Base
|
||||
attr_accessible :student_work_id, :homework_test_id
|
||||
|
||||
belongs_to :homework_test
|
||||
belongs_to :student_work
|
||||
|
||||
def status_to_s
|
||||
case self.result
|
||||
when -1
|
||||
'编译出错'
|
||||
when -2
|
||||
'答题错误'
|
||||
when -3
|
||||
'答案错误'
|
||||
when 1
|
||||
'运行出错'
|
||||
when 2
|
||||
'超时'
|
||||
when 3
|
||||
'内存超出'
|
||||
when 4
|
||||
'输出超出'
|
||||
when 5
|
||||
'禁用函数'
|
||||
when 6
|
||||
'其他错误'
|
||||
when 0
|
||||
'成功'
|
||||
else
|
||||
'未知错误'
|
||||
end
|
||||
end
|
||||
|
||||
def test_score
|
||||
if self.result == 0
|
||||
format("%.1f",100.0 / self.student_work.homework_common.homework_tests.count)
|
||||
else
|
||||
0
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,10 +1,10 @@
|
|||
<!-- huang -->
|
||||
<h3><%=l(:label_newtype_contest)%></h3>
|
||||
<!--<!– huang –>-->
|
||||
<!--<h3><%=l(:label_newtype_contest)%></h3>-->
|
||||
|
||||
<%= labelled_form_for @bid, :url => {:controller => 'bids', :action => 'create_contest'} do |f| %>
|
||||
<div class="box tabular">
|
||||
<%= render :partial => 'form_contest', :locals => { :f => f } %>
|
||||
<%= submit_tag l(:button_create) %>
|
||||
<%= javascript_tag "$('#bid_name').focus();" %>
|
||||
<% end %>
|
||||
</div>
|
||||
<!--<%= labelled_form_for @bid, :url => {:controller => 'bids', :action => 'create_contest'} do |f| %>-->
|
||||
<!--<div class="box tabular">-->
|
||||
<!--<%= render :partial => 'form_contest', :locals => { :f => f } %>-->
|
||||
<!--<%= submit_tag l(:button_create) %>-->
|
||||
<!--<%= javascript_tag "$('#bid_name').focus();" %>-->
|
||||
<!--<% end %>-->
|
||||
<!--</div>-->
|
|
@ -19,7 +19,7 @@
|
|||
<li ><span class="c_blue02 w280">作业名称</span><span class="c_blue02 w70">得分</span></li>
|
||||
<% @member_score.homework_common_list.each do |homework_common| %>
|
||||
<li>
|
||||
<span class="c_grey02 w280">
|
||||
<span class="c_grey02 w280 hiddent">
|
||||
<%= homework_common.name %>
|
||||
</span>
|
||||
<span class="c_red w70">
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
<div class="cl"></div>
|
||||
<li >
|
||||
<label class="label02 "> <%= l(:field_quote)%>: </label>
|
||||
<!--<textarea name="" placeholder="请在此填入作业的要求及评分依据" class=" w548 h150 mb10 fl" ></textarea>-->
|
||||
<div style="width: 83%;float: left;">
|
||||
<% if edit_mode %>
|
||||
<%= f.kindeditor :description,:editor_id => 'homework_description_editor',:owner_id => homework.id,:owner_type =>OwnerTypeHelper::HOMEWORKCOMMON %>
|
|
@ -0,0 +1,125 @@
|
|||
<ul class="hwork_new_basic">
|
||||
<li >
|
||||
<label class="label02 mb20">
|
||||
<span class="c_red">*</span>
|
||||
<%= l(:field_name)%>:
|
||||
</label>
|
||||
<input type="text" name="homework_common[name]" id="homework_name" class="w548 h26 fl" maxlength="255" onkeyup="regex_homework_name();" value="<%= homework.name%>" >
|
||||
<p id="homework_name_span" class="c_red ml110"></p>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li >
|
||||
<label class="label02 "> <%= l(:field_quote)%>: </label>
|
||||
<div style="width: 83%;float: left;">
|
||||
<% if edit_mode %>
|
||||
<%= f.kindeditor :description,:editor_id => 'homework_description_editor',:owner_id => homework.id,:owner_type =>OwnerTypeHelper::HOMEWORKCOMMON %>
|
||||
<% else %>
|
||||
<%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %>
|
||||
<%= f.kindeditor :description,:editor_id => 'homework_description_editor' %>
|
||||
<% end %>
|
||||
</div>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="mt10">
|
||||
<label class="label02"> 附件: </label>
|
||||
<%= render :partial => 'attachments/new_form', :locals => {:container => homework} %>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="fl">
|
||||
<label class="label02">
|
||||
<span class="c_red">*</span>
|
||||
<%= l(:label_limit_time)%>:
|
||||
</label>
|
||||
<input type="text" name="homework_common[end_time]" id="homework_end_time" class="hwork_input02 fl" readonly="readonly" value="<%= homework.end_time%>" >
|
||||
<%= calendar_for('homework_end_time')%>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<li class="fl ml100" style="display: none;">
|
||||
<label class="label02"> 发布日期: </label>
|
||||
<input type="text" name="homework_common[publish_time]" id="homework_publish_time" class="hwork_input02 fl" readonly="readonly" value="<%= homework.publish_time%>" >
|
||||
<%= calendar_for('homework_publish_time')%>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<label class="label02">迟交扣分: </label>
|
||||
<%= select_tag :late_penalty,options_for_select(late_penalty_option,homework.late_penalty), {:class => "fl mb10 h26 w70"} %>
|
||||
<span class="fl mt5"> 分</span>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
</ul><!--hwork_new_basic end--->
|
||||
|
||||
<div class="cl"></div>
|
||||
<div class="hwork_new_set">
|
||||
<p class="fl ml20 f14 mb10 c_orange">编程评测设置</p>
|
||||
<div class="cl"></div>
|
||||
<ul>
|
||||
<li >
|
||||
<label class="label02"> 开发语言: </label>
|
||||
<select class="fl mb10 h26 w150" >
|
||||
<option>C++</option>
|
||||
</select>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<label class="label02">评分比例: </label>
|
||||
<%= select_tag :ta_proportion,options_for_select(ta_proportion_option,homework.homework_detail_programing.ta_proportion), {:class => "fl mb10 h26 w70"} %>
|
||||
<span class="ml5 fl mt5">× 教辅评分</span>
|
||||
<span class="ml5 fl mt5"> + </span>
|
||||
<input type="text" id="student_proportion" value="<%= (100 - homework.homework_detail_programing.ta_proportion* 100).to_i%>%" class="fl mb10 h26 w70" readonly>
|
||||
<span class="ml5 fl mt5">× 系统评分</span>
|
||||
<span class="ml5 fl mt5">= 学生得分</span>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<li >
|
||||
<label class="label02" > </label>
|
||||
<span class=" fl c_red">如果教师对学生作品进行了评分,则教师评分为学生最终得分。</span>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
|
||||
<li >
|
||||
<label class="label02"> 标准代码: </label>
|
||||
<textarea name="standard_code" class=" w547 h150 mb10 fl"><%= homework.homework_detail_programing.standard_code%></textarea>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
|
||||
<% if edit_mode %>
|
||||
<% homework.homework_tests.each do |homework_test|%>
|
||||
<div>
|
||||
<li>
|
||||
<label class="label02"> 测试输入: </label>
|
||||
<input type="text" class="fl h26 w186 mb10" name="input[<%= homework_test.id%>]" value="<%= homework_test.input%>"/>
|
||||
</li>
|
||||
<li >
|
||||
<label class=" fl f14 ml10"> 输出: </label>
|
||||
<input type="text" class="fl h26 w186 mb10" name="output[<%= homework_test.id%>]" value="<%= homework_test.output%>"/>
|
||||
</li>
|
||||
<li>
|
||||
<a class="icon_add ml10 " href="javascript:void(0);" title="添加测试" onclick="add_programing_test($(this).parent().parent())"></a>
|
||||
<a class="icon_remove" href="javascript:void(0);" title="删除测试" onclick="remove_programing_test($(this).parent().parent())"></a>
|
||||
<span class="green_btn fl ml5 mt1">测试</span>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% end%>
|
||||
<% else %>
|
||||
<div>
|
||||
<li>
|
||||
<label class="label02"> 测试输入: </label>
|
||||
<input type="text" class="fl h26 w186 mb10" name="input[0]" />
|
||||
</li>
|
||||
<li >
|
||||
<label class=" fl f14 ml10"> 输出: </label>
|
||||
<input type="text" class="fl h26 w186 mb10" name="output[0]" />
|
||||
</li>
|
||||
<li>
|
||||
<a class="icon_add ml10 " href="javascript:void(0);" title="添加测试" onclick="add_programing_test($(this).parent().parent())"></a>
|
||||
<a class="icon_remove" href="javascript:void(0);" title="删除测试" onclick="remove_programing_test($(this).parent().parent())"></a>
|
||||
<span class="green_btn fl ml5 mt1">测试</span>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
|
@ -7,10 +7,18 @@
|
|||
</h2>
|
||||
</div>
|
||||
<div class="hwork_new">
|
||||
<%= form_for @homework do |f| %>
|
||||
<%= render :partial => 'homework_common/homework_common_form', :locals => { :homework => @homework,:f => f,:edit_mode => true } %>
|
||||
<a href="javascript:void(0)" class="blue_btn fl mr10" onClick="submit_homework('edit_homework_common_<%= @homework.id%>');" >提交</a>
|
||||
<%= link_to '取消',homework_common_index_path(:course => @course.id),:class => 'grey_btn fl'%>
|
||||
<%if @homework.homework_type == 2%>
|
||||
<%= form_for @homework do |f| %>
|
||||
<%= render :partial => 'homework_common/homework_detail_programing_form', :locals => { :homework => @homework,:f => f,:edit_mode => true } %>
|
||||
<a href="javascript:void(0)" class="blue_btn fl mr10" onClick="submit_homework('edit_homework_common_<%= @homework.id%>');" >提交</a>
|
||||
<%= link_to '取消',homework_common_index_path(:course => @course.id),:class => 'grey_btn fl'%>
|
||||
<% end%>
|
||||
<% else %>
|
||||
<%= form_for @homework do |f| %>
|
||||
<%= render :partial => 'homework_common/homework_detail_manual_form', :locals => { :homework => @homework,:f => f,:edit_mode => true } %>
|
||||
<a href="javascript:void(0)" class="blue_btn fl mr10" onClick="submit_homework('edit_homework_common_<%= @homework.id%>');" >提交</a>
|
||||
<%= link_to '取消',homework_common_index_path(:course => @course.id),:class => 'grey_btn fl'%>
|
||||
<% end%>
|
||||
<% end%>
|
||||
</div><!--hwork_new end-->
|
||||
<div class="cl"></div>
|
||||
|
|
|
@ -1,17 +1,27 @@
|
|||
<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' %>
|
||||
<%= error_messages_for 'homework_common' %>
|
||||
|
||||
<div class="project_r_h">
|
||||
<h2 class="project_h2">
|
||||
<%= l(:label_course_homework_new)%>
|
||||
</h2>
|
||||
</div>
|
||||
<div class="hwork_new">
|
||||
<%= labelled_form_for @homework,:url => {:controller => 'homework_common',:action => 'create'} do |f| %>
|
||||
<%= hidden_field_tag "course",@course.id%>
|
||||
<%= render :partial => 'homework_common/homework_common_form', :locals => { :homework => @homework,:f => f,:edit_mode => false } %>
|
||||
<a href="javascript:void(0)" class="blue_btn fl mr10" onClick="submit_homework('new_homework_common');" >提交</a>
|
||||
<%= link_to '取消',homework_common_index_path(:course => @course.id),:class => 'grey_btn fl'%>
|
||||
<div class="hwork_new" id="hwork_new">
|
||||
<%= form_for("new_homework_common",:url => next_step_homework_common_index_path) do |f|%>
|
||||
<input type="hidden" name="course" value="<%= @course.id%>">
|
||||
<h3 class="c_blue f16 mb10">
|
||||
请选择将要发布的作业类型
|
||||
</h3>
|
||||
<input type="radio" class="mb10 fl" name="homework_common_type" value="1" id="homework_detail_manual_radio" checked/>
|
||||
<span class="ml5 fl">
|
||||
人工评分的作业(支持匿名互评、灵活设置评分比例)
|
||||
</span>
|
||||
<div class="cl"></div>
|
||||
<input type="radio" class="mb20 fl" name="homework_common_type" value="2" id="homework_detail_programing_radio"/>
|
||||
<span class="ml5 fl">
|
||||
自动评测的编程作业(支持C++程序的自动评分)
|
||||
</span>
|
||||
<div class="cl"></div>
|
||||
<a href="javascript:void(0);" class=" orange_btn" onclick="$(this).parent().submit();">
|
||||
下一步
|
||||
</a>
|
||||
<% end%>
|
||||
</div><!--hwork_new end-->
|
||||
<div class="cl"></div>
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
<%= javascript_include_tag "/assets/kindeditor/kindeditor" %>
|
||||
<%= error_messages_for 'homework_common' %>
|
||||
<div class="project_r_h">
|
||||
<h2 class="project_h2">
|
||||
<%= l(:label_course_homework_new)%>
|
||||
</h2>
|
||||
</div>
|
||||
<% if @homework_type == "1"%>
|
||||
<div class="hwork_new">
|
||||
<%= labelled_form_for @homework,:url => {:controller => 'homework_common',:action => 'create'} do |f| %>
|
||||
<%= hidden_field_tag "course",@course.id%>
|
||||
<%= render :partial => 'homework_common/homework_detail_manual_form', :locals => { :homework => @homework,:f => f,:edit_mode => false } %>
|
||||
<a href="javascript:void(0)" class="blue_btn fl mr10" onClick="submit_homework('new_homework_common');" >提交</a>
|
||||
<%= link_to "上一步", new_homework_common_path(:course => @course.id), :class => "orange_btn_homework fl"%>
|
||||
<%= link_to '取消',homework_common_index_path(:course => @course.id),:class => 'grey_btn fl'%>
|
||||
<% end%>
|
||||
</div><!--hwork_new end-->
|
||||
<% elsif @homework_type == "2"%>
|
||||
<div class="hwork_new">
|
||||
<%= labelled_form_for @homework,:url => {:controller => 'homework_common',:action => 'create'} do |f| %>
|
||||
<%= hidden_field_tag "course",@course.id%>
|
||||
<%= hidden_field_tag "homework_common[homework_type]","2"%>
|
||||
<%= render :partial => 'homework_common/homework_detail_programing_form', :locals => { :homework => @homework,:f => f,:edit_mode => false } %>
|
||||
<a href="javascript:void(0)" class="blue_btn fl mr10" onClick="submit_homework('new_homework_common');" >提交</a>
|
||||
<%= link_to "上一步", new_homework_common_path(:course => @course.id), :class => "orange_btn_homework fl"%>
|
||||
<%= link_to '取消',homework_common_index_path(:course => @course.id),:class => 'grey_btn fl'%>
|
||||
<% end%>
|
||||
</div><!--hwork_new end-->
|
||||
<div class="cl"></div>
|
||||
<% end%>
|
|
@ -101,10 +101,7 @@
|
|||
addSlipMenu();
|
||||
addProjectSlipMenu ();
|
||||
addCourseSlipMenu();
|
||||
});
|
||||
|
||||
jQuery(document).ready(function($) {
|
||||
$('.sub_menu').find("a").attr('target', '_blank');
|
||||
$('.sub_menu').find("a").attr('target', '_blank');
|
||||
$('.project_sub_menu').find("a").attr('target', '_blank');
|
||||
$('.course_sub_menu').find("a").attr('target', '_blank');
|
||||
});
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<%= link_to student_work.user.show_name,user_path(student_work.user),:title => student_work.user.show_name, :class => "c_blue02"%>
|
||||
</li>
|
||||
<li class=" hwork_tit">
|
||||
<%= link_to student_work.name, student_work_path(student_work),:remote => true,:title => student_work.name, :class => "c_blue02"%>
|
||||
<%= link_to student_work.name, student_work_path(student_work.id),:remote => true,:title => student_work.name, :class => "c_blue02"%>
|
||||
</li>
|
||||
<li class=" hwork_time_c">
|
||||
<% if Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(student_work.created_at.to_s).strftime("%Y-%m-%d") %>
|
||||
|
@ -26,7 +26,7 @@
|
|||
</li>
|
||||
<li class=" hwork_code02 <%= score_color student_work.student_score%> student_score_info" >
|
||||
<%= student_work.student_score.nil? ? "--" : format("%.1f",student_work.student_score)%>
|
||||
<% unless student_work.student_score.nil?%>
|
||||
<% unless student_work.student_score.nil? || student_work.homework_common.homework_type == 2%>
|
||||
<span class="">
|
||||
(<%= student_work.student_works_scores.where(:reviewer_role => 3).count%>)
|
||||
</span>
|
||||
|
|
|
@ -2,42 +2,46 @@
|
|||
<span class="c_dark f14 fb fl">学号</span>
|
||||
</li>
|
||||
<li class=" hwork_name f14 fb c_dark">
|
||||
<%= link_to "姓名",@show_all ? student_work_index_path(:homework => @homework.id,:order => "name", :sort => @score, :name => @name) : "javascript:void(0)",:class => "f14 f_b c_dark fl"%>
|
||||
<%= link_to "姓名",@show_all ? student_work_index_path(:homework => @homework.id,:order => "name", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)",:class => "f14 f_b c_dark fl"%>
|
||||
<% if @show_all && @order == "name"%>
|
||||
<a href="javascript:void(0);" class="<%= @score == 'desc' ? 'st_up' : 'st_down'%>" ></a>
|
||||
<%= link_to "",student_work_index_path(:homework => @homework.id,:order => "name", :sort => @score, :name => @name, :group => @group) ,:class => @score == 'desc' ? 'st_up' : 'st_down'%>
|
||||
<% end%>
|
||||
</li>
|
||||
<li class="hwork_tit">
|
||||
<span class="c_dark f14 fb fl">作品名称</span>
|
||||
</li>
|
||||
<li class=" hwork_time f14 fb c_dark">
|
||||
<%= link_to "时间",@show_all ? student_work_index_path(:homework => @homework.id,:order => "created_at", :sort => @score, :name => @name) : "javascript:void(0)",:class => "f14 f_b c_dark fl"%>
|
||||
<%= link_to "时间",@show_all ? student_work_index_path(:homework => @homework.id,:order => "created_at", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)",:class => "f14 f_b c_dark fl"%>
|
||||
<% if @show_all && @order == "created_at"%>
|
||||
<%= link_to "",student_work_index_path(:homework => @homework.id,:order => "created_at", :sort => @score, :name => @name) ,:class => @score == 'desc' ? 'st_up' : 'st_down'%>
|
||||
<%= link_to "",student_work_index_path(:homework => @homework.id,:order => "created_at", :sort => @score, :name => @name, :group => @group) ,:class => @score == 'desc' ? 'st_up' : 'st_down'%>
|
||||
<% end%>
|
||||
</li>
|
||||
<li class="mr5 w40 ml15">
|
||||
<%= link_to "教师",@show_all ? student_work_index_path(:homework => @homework.id,:order => "teacher_score", :sort => @score, :name => @name) : "javascript:void(0)",:class => "f14 f_b c_dark fl"%>
|
||||
<%= link_to "教师",@show_all ? student_work_index_path(:homework => @homework.id,:order => "teacher_score", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)",:class => "f14 f_b c_dark fl"%>
|
||||
<% if @show_all && @order == "teacher_score"%>
|
||||
<%= link_to "", student_work_index_path(:homework => @homework.id,:order => "teacher_score", :sort => @score, :name => @name) ,:class => @score == 'desc' ? 'st_up' : 'st_down'%>
|
||||
<%= link_to "", student_work_index_path(:homework => @homework.id,:order => "teacher_score", :sort => @score, :name => @name, :group => @group) ,:class => @score == 'desc' ? 'st_up' : 'st_down'%>
|
||||
<% end%>
|
||||
</li>
|
||||
<li class="mr5 w40 ml20">
|
||||
<%= link_to "教辅",@show_all ? student_work_index_path(:homework => @homework.id,:order => "teaching_asistant_score", :sort => @score, :name => @name) : "javascript:void(0)",:class => "f14 f_b c_dark fl"%>
|
||||
<%= link_to "教辅",@show_all ? student_work_index_path(:homework => @homework.id,:order => "teaching_asistant_score", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)",:class => "f14 f_b c_dark fl"%>
|
||||
<% if @show_all && @order == "teaching_asistant_score"%>
|
||||
<%= link_to "", student_work_index_path(:homework => @homework.id,:order => "teaching_asistant_score", :sort => @score, :name => @name) ,:class => @score == 'desc' ? 'st_up' : 'st_down'%>
|
||||
<%= link_to "", student_work_index_path(:homework => @homework.id,:order => "teaching_asistant_score", :sort => @score, :name => @name, :group => @group) ,:class => @score == 'desc' ? 'st_up' : 'st_down'%>
|
||||
|
||||
<% end%>
|
||||
</li>
|
||||
<li class="mr5 ml10 w40">
|
||||
<%= link_to "匿评",@show_all ? student_work_index_path(:homework => @homework.id,:order => "student_score", :sort => @score, :name => @name) : "javascript:void(0)",:class => "f14 f_b c_dark fl"%>
|
||||
<li class="ml15 w40">
|
||||
<% if @homework.homework_type == 1%>
|
||||
<%= link_to "匿评",@show_all ? student_work_index_path(:homework => @homework.id,:order => "student_score", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)",:class => "f14 f_b c_dark fl"%>
|
||||
<% elsif @homework.homework_type == 2%>
|
||||
<%= link_to "系统",@show_all ? student_work_index_path(:homework => @homework.id,:order => "student_score", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)",:class => "f14 f_b c_dark fl"%>
|
||||
<% end %>
|
||||
<% if @show_all && @order == "student_score"%>
|
||||
<%= link_to "", student_work_index_path(:homework => @homework.id,:order => "student_score", :sort => @score, :name => @name) ,:class => @score == 'desc' ? 'st_up' : 'st_down'%>
|
||||
<%= link_to "", student_work_index_path(:homework => @homework.id,:order => "student_score", :sort => @score, :name => @name, :group => @group) ,:class => @score == 'desc' ? 'st_up' : 'st_down'%>
|
||||
<% end%>
|
||||
</li>
|
||||
<li class="ml20">
|
||||
<%= link_to "成绩",@show_all ? student_work_index_path(:homework => @homework.id,:order => "score", :sort => @score, :name => @name) : "javascript:void(0)",:class => "f14 f_b c_dark fl"%>
|
||||
<%= link_to "成绩",@show_all ? student_work_index_path(:homework => @homework.id,:order => "score", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)",:class => "f14 f_b c_dark fl"%>
|
||||
<% if @show_all && @order == "score"%>
|
||||
<%= link_to "", student_work_index_path(:homework => @homework.id,:order => "score", :sort => @score, :name => @name) ,:class => @score == 'desc' ? 'st_up' : 'st_down'%>
|
||||
<%= link_to "", student_work_index_path(:homework => @homework.id,:order => "score", :sort => @score, :name => @name, :group => @group) ,:class => @score == 'desc' ? 'st_up' : 'st_down'%>
|
||||
<% end%>
|
||||
</li>
|
|
@ -0,0 +1,75 @@
|
|||
<div class="show_hwork_arrow"></div>
|
||||
<div class="show_hwork">
|
||||
<ul>
|
||||
<li class="fl" >
|
||||
<span class="tit_fb">
|
||||
上交时间:
|
||||
</span>
|
||||
<%=format_time @work.created_at %>
|
||||
</li>
|
||||
<% if @work.user != User.current%>
|
||||
<!-- 不是自己显示为点赞,编程作业不可编辑和删除 -->
|
||||
<li class="fr" id="student_work_praise_<%= @work.id%>">
|
||||
<%= render :partial => 'student_work_praise' %>
|
||||
</li>
|
||||
<% end%>
|
||||
<div class="cl"></div>
|
||||
<li >
|
||||
<span class="tit_fb ">
|
||||
编程代码:
|
||||
</span>
|
||||
<div class="show_hwork_p break_word">
|
||||
<%= text_format @work.description%>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<li ><span class="tit_fb ">测试结果:</span>
|
||||
<table class="border_ce" cellpadding="0" cellspacing="0">
|
||||
<tbody>
|
||||
<!--<%#@work.student_work_test.each do |test|%>-->
|
||||
<!--<tr class="<%#= cycle("", "b_grey") %>">-->
|
||||
<!--<td class="td_tit">-->
|
||||
<!--<%#= test.homework_test.input%>-->
|
||||
<!--</td>-->
|
||||
<!--<td class="td_tit">-->
|
||||
<!--<%#= test.homework_test.output%>-->
|
||||
<!--</td>-->
|
||||
<!--<td class="td_50 c_red"><%#= test.status_to_s%></td>-->
|
||||
<!--<td class="td_50 "><%#= test.test_score%></td>-->
|
||||
<!--</tr>-->
|
||||
<!--<%# end%>-->
|
||||
|
||||
<%@homework.homework_tests.each do |test|%>
|
||||
<tr class="<%= cycle("", "b_grey") %>">
|
||||
<td class="td_tit">
|
||||
<%= test.input%>
|
||||
</td>
|
||||
<td class="td_tit">
|
||||
<%= test.output%>
|
||||
</td>
|
||||
<td class="td_50 c_red"><%= test.student_work_test.nil? ? "正在编译" : test.student_work_test.status_to_s%></td>
|
||||
<td class="td_50 "><%= test.student_work_test.nil? ? "0" : test.student_work_test.test_score%></td>
|
||||
</tr>
|
||||
<% end%>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<% if @is_teacher%>
|
||||
<!-- 编程作业老师才可以评分 -->
|
||||
<div id="add_student_score_<%= @work.id%>" class="mt10 evaluation">
|
||||
<%= render :partial => 'add_score',:locals => {:work => @work,:score => @score}%>
|
||||
</div>
|
||||
<% end%>
|
||||
</ul>
|
||||
|
||||
<div class="ping_box mt10" id="score_list_<%= @work.id%>" style="<%= @work.student_works_scores.empty? ? 'padding:0px;' : ''%>">
|
||||
<%@work.student_works_scores.order("updated_at desc").each do |score|%>
|
||||
<div id="work_score_<%= score.id%>">
|
||||
<%= render :partial => 'student_work_score',:locals => {:score => score}%>
|
||||
</div>
|
||||
<% end%>
|
||||
</div><!---ping_box end--->
|
||||
<a href="javascript:void(0);" class="fr c_blue mt5 mb5" onclick="$('#about_hwork_<%= @work.id%>').html('');">收起</a>
|
||||
</div><!---show_hwork end--->
|
|
@ -36,7 +36,7 @@
|
|||
<li >
|
||||
<span class="tit_fb ">内容:</span>
|
||||
<div class="show_hwork_p break_word">
|
||||
<%= textilizable @work.description%>
|
||||
<%= text_format @work.description%>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
|
|
|
@ -2,36 +2,36 @@
|
|||
<span class="c_dark f14 fb fl">学号</span>
|
||||
</li>
|
||||
<li class=" hwork_name f14 fb c_dark">
|
||||
<%= link_to "姓名",@show_all ? student_work_index_path(:homework => @homework.id,:order => "name", :sort => @score, :name => @name) : "javascript:void(0)",:class => "f14 f_b c_dark fl"%>
|
||||
<%= link_to "姓名",@show_all ? student_work_index_path(:homework => @homework.id,:order => "name", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)",:class => "f14 f_b c_dark fl"%>
|
||||
<% if @show_all && @order == "name"%>
|
||||
<a href="javascript:void(0);" class="<%= @score == 'desc' ? 'st_up' : 'st_down'%>" ></a>
|
||||
<%= link_to "",student_work_index_path(:homework => @homework.id,:order => "name", :sort => @score, :name => @name, :group => @group) ,:class => @score == 'desc' ? 'st_up' : 'st_down'%>
|
||||
<% end%>
|
||||
</li>
|
||||
<li class="hwork_tit_une">
|
||||
<span class="c_dark f14 fb fl">作品名称</span>
|
||||
</li>
|
||||
<li class=" hwork_time f14 fb c_dark">
|
||||
<%= link_to "时间",@show_all ? student_work_index_path(:homework => @homework.id,:order => "created_at", :sort => @score, :name => @name) : "javascript:void(0)",:class => "f14 f_b c_dark fl"%>
|
||||
<%= link_to "时间",@show_all ? student_work_index_path(:homework => @homework.id,:order => "created_at", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)",:class => "f14 f_b c_dark fl"%>
|
||||
<% if @show_all && @order == "created_at"%>
|
||||
<%= link_to "",student_work_index_path(:homework => @homework.id,:order => "created_at", :sort => @score, :name => @name) ,:class => @score == 'desc' ? 'st_up' : 'st_down'%>
|
||||
<%= link_to "",student_work_index_path(:homework => @homework.id,:order => "created_at", :sort => @score, :name => @name, :group => @group) ,:class => @score == 'desc' ? 'st_up' : 'st_down'%>
|
||||
<% end%>
|
||||
</li>
|
||||
<li class="mr5 w40 ml15">
|
||||
<%= link_to "教师",@show_all ? student_work_index_path(:homework => @homework.id,:order => "teacher_score", :sort => @score, :name => @name) : "javascript:void(0)",:class => "f14 f_b c_dark fl"%>
|
||||
<%= link_to "教师",@show_all ? student_work_index_path(:homework => @homework.id,:order => "teacher_score", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)",:class => "f14 f_b c_dark fl"%>
|
||||
<% if @show_all && @order == "teacher_score"%>
|
||||
<%= link_to "", student_work_index_path(:homework => @homework.id,:order => "teacher_score", :sort => @score, :name => @name) ,:class => @score == 'desc' ? 'st_up' : 'st_down'%>
|
||||
<%= link_to "", student_work_index_path(:homework => @homework.id,:order => "teacher_score", :sort => @score, :name => @name, :group => @group) ,:class => @score == 'desc' ? 'st_up' : 'st_down'%>
|
||||
<% end%>
|
||||
</li>
|
||||
<li class="mr5 w40 ml20">
|
||||
<%= link_to "教辅",@show_all ? student_work_index_path(:homework => @homework.id,:order => "teaching_asistant_score", :sort => @score, :name => @name) : "javascript:void(0)",:class => "f14 f_b c_dark fl"%>
|
||||
<%= link_to "教辅",@show_all ? student_work_index_path(:homework => @homework.id,:order => "teaching_asistant_score", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)",:class => "f14 f_b c_dark fl"%>
|
||||
<% if @show_all && @order == "teaching_asistant_score"%>
|
||||
<%= link_to "", student_work_index_path(:homework => @homework.id,:order => "teaching_asistant_score", :sort => @score, :name => @name) ,:class => @score == 'desc' ? 'st_up' : 'st_down'%>
|
||||
<%= link_to "", student_work_index_path(:homework => @homework.id,:order => "teaching_asistant_score", :sort => @score, :name => @name, :group => @group) ,:class => @score == 'desc' ? 'st_up' : 'st_down'%>
|
||||
|
||||
<% end%>
|
||||
</li>
|
||||
<li class="ml20">
|
||||
<%= link_to "成绩",@show_all ? student_work_index_path(:homework => @homework.id,:order => "score", :sort => @score, :name => @name) : "javascript:void(0)",:class => "f14 f_b c_dark fl"%>
|
||||
<%= link_to "成绩",@show_all ? student_work_index_path(:homework => @homework.id,:order => "score", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)",:class => "f14 f_b c_dark fl"%>
|
||||
<% if @show_all && @order == "score"%>
|
||||
<%= link_to "", student_work_index_path(:homework => @homework.id,:order => "score", :sort => @score, :name => @name) ,:class => @score == 'desc' ? 'st_up' : 'st_down'%>
|
||||
<%= link_to "", student_work_index_path(:homework => @homework.id,:order => "score", :sort => @score, :name => @name, :group => @group) ,:class => @score == 'desc' ? 'st_up' : 'st_down'%>
|
||||
<% end%>
|
||||
</li>
|
|
@ -2,20 +2,23 @@ $("#add_student_score_<%= @work.id%>").html("<%= escape_javascript(render :parti
|
|||
$('#score_<%= @work.id%>').peSlider({range: 'min'});
|
||||
|
||||
<% if @is_new%>
|
||||
$("#score_list_<%= @work.id%>").prepend("<div id='work_score_<%= @score.id%>'><%= escape_javascript(render :partial => 'student_work_score', :locals => {:score => @score}) %></div>");
|
||||
$("#score_list_<%= @work.id%>").prepend("<div id='work_score_<%= @score.id%>'><%= escape_javascript(render :partial => 'student_work_score', :locals => {:score => @score}) %></div>");
|
||||
<% else %>
|
||||
$("#work_score_<%= @score.id%>").html("<%= escape_javascript(render :partial => 'student_work_score', :locals => {:score => @score}) %>");
|
||||
$("#work_score_<%= @score.id%>").html("<%= escape_javascript(render :partial => 'student_work_score', :locals => {:score => @score}) %>");
|
||||
<% end%>
|
||||
|
||||
$("#score_list_<%= @work.id%>").removeAttr("style");
|
||||
|
||||
<% if @is_teacher %>
|
||||
<% if @homework.homework_type == 1%>
|
||||
$("#student_work_<%= @work.id%>").replaceWith("<%= escape_javascript(render :partial => 'evaluation_student_work',:locals => {:student_work => @work}) %>");
|
||||
<% else%>
|
||||
$("#student_work_<%= @work.id%>").replaceWith("<%= escape_javascript(render :partial => 'student_work',:locals => {:student_work => @work}) %>");
|
||||
<% end%>
|
||||
<% if @homework.homework_type == 1%>
|
||||
$("#student_work_<%= @work.id%>").replaceWith("<%= escape_javascript(render :partial => 'evaluation_student_work',:locals => {:student_work => @work}) %>");
|
||||
<% elsif @homework.homework_type == 2%>
|
||||
$("#student_work_<%= @work.id%>").replaceWith("<%= escape_javascript(render :partial => 'evaluation_student_work',:locals => {:student_work => @work}) %>");
|
||||
<% else%>
|
||||
$("#student_work_<%= @work.id%>").replaceWith("<%= escape_javascript(render :partial => 'student_work',:locals => {:student_work => @work}) %>");
|
||||
<% end%>
|
||||
<% else %>
|
||||
$("#student_work_<%= @work.id%>").replaceWith("<%= escape_javascript(render :partial => 'evaluation_work',:locals => {:student_work => @work}) %>");
|
||||
$("#student_work_<%= @work.id%>").replaceWith("<%= escape_javascript(render :partial => 'evaluation_work',:locals => {:student_work => @work}) %>");
|
||||
<% end%>
|
||||
|
||||
|
||||
|
|
|
@ -2,14 +2,6 @@
|
|||
<h2 class="project_h2">编辑作品</h2>
|
||||
</div>
|
||||
<div class="Newwork">
|
||||
<!--<div id="tb_" class="hwork_tb_">-->
|
||||
<!--<ul>-->
|
||||
<!--<li id="tb_1" class="hwork_hovertab" onclick="x:HoverLi(1);" >-->
|
||||
<!--课程名称课程名称课程名</li>-->
|
||||
<!--<li id="tb_2" class="hwork_normaltab" onclick="i:HoverLi(2);">-->
|
||||
<!--成员</li>-->
|
||||
<!--</ul>-->
|
||||
<!--</div>-->
|
||||
<div class="hwork_ctt">
|
||||
<div class="hwork_dis" id="tbc_01">
|
||||
<%= labelled_form_for @work,:html => { :multipart => true } do |f|%>
|
||||
|
|
|
@ -48,8 +48,9 @@
|
|||
<%= link_to "所有作品(<span class='c_red'>#{@stundet_works.count}</span>)".html_safe,student_work_index_path(:homework => @homework.id), :class => "fl"%>
|
||||
</span>
|
||||
<% if @show_all%>
|
||||
<input type="text" value="<%= @name%>" placeholder="昵称、学号、姓名搜索" class="min_search ml10 fl" onkeypress="SearchByName($(this),'<%= student_work_index_path(:homework => @homework.id)%>',event);">
|
||||
<a class="student_work_search fl" onclick="SearchByName_1($(this).prev(),'<%= student_work_index_path(:homework => @homework.id)%>');" href="javascript:void(0)">搜索</a>
|
||||
<input type="text" value="<%= @name%>" placeholder="昵称、学号、姓名搜索" class="min_search ml10 fl" onkeypress="SearchByName($(this).val(),$(this).next().val(),'<%= student_work_index_path(:homework => @homework.id)%>',event);">
|
||||
<%= select_tag(:late_penalty,options_for_select(course_group_list(@course),@group), {:class => "fl h22 w100 ml10"}) if @is_teacher %>
|
||||
<a class="student_work_search fl" onclick="SearchByName_1($(this).prev().prev().val(),$(this).prev().val(),'<%= student_work_index_path(:homework => @homework.id)%>');" href="javascript:void(0)">搜索</a>
|
||||
<%= link_to("缺评情况",student_work_absence_penalty_student_work_index_path(:homework => @homework.id), :class => "student_work_search fl", :target => "_blank") if((@is_teacher || User.current.admin?) && @homework.homework_type == 1) %>
|
||||
<% end%>
|
||||
<% if @is_teacher%>
|
||||
|
@ -89,7 +90,7 @@
|
|||
<div id="about_hwork_<%= student_work.id%>" ></div>
|
||||
<% end%>
|
||||
<% else %>
|
||||
<% if @homework.homework_type == 1%>
|
||||
<% if @homework.homework_type == 1 || @homework.homework_type == 2%>
|
||||
<ul class="hwork_ul">
|
||||
<%= render :partial => 'evaluation_student_work_title'%>
|
||||
</ul><!---hwork_ul end-->
|
||||
|
|
|
@ -33,9 +33,12 @@
|
|||
<p>
|
||||
<label class="fl"><span class="c_red">*</span> 作品名称 :</label>
|
||||
<%= f.text_field "name", :required => true, :size => 60, :class => "bo fl", :maxlength => 200, :placeholder => "作品名称", :onkeyup => "regexStudentWorkName();" %>
|
||||
<a href="javascript:void(0)" class="fl ml10 mt3" onclick="show_project();" >项目信息
|
||||
<img class="ml5 " src="../images/bid/pic_question.png" width="15" height="15" Title="项目是一种由用户创建的基于 网络的协作空间,能够为个人 或小组提供分布式的协同交流 和资料管理等方面的。">
|
||||
</a>
|
||||
<% if @homework.homework_type != 2%>
|
||||
<a href="javascript:void(0)" class="fl ml10 mt3" onclick="show_project();" >
|
||||
项目信息
|
||||
<img class="ml5 " src="../images/bid/pic_question.png" width="15" height="15" Title="项目是一种由用户创建的基于 网络的协作空间,能够为个人 或小组提供分布式的协同交流 和资料管理等方面的。">
|
||||
</a>
|
||||
<% end%>
|
||||
<div class="cl"></div>
|
||||
<p id="student_work_name_span" class="c_red ml90 mb10"></p>
|
||||
</p>
|
||||
|
@ -46,17 +49,23 @@
|
|||
</p>
|
||||
<div class="cl"></div>
|
||||
<p>
|
||||
<label class="fl"><span class="c_red">*</span> 作品描述 :</label>
|
||||
<%= f.text_area "description", :class => "w620 hwork_txt ", :maxlength => 3000, :placeholder => "最多3000个汉字", :onkeyup => "regexStudentWorkDescription();"%>
|
||||
<label class="fl">
|
||||
<span class="c_red">*</span>
|
||||
<%= @homework.homework_type == 2 ? "提交代码" : "作品描述"%>
|
||||
:
|
||||
</label>
|
||||
<%= f.text_area "description", :class => "w620 hwork_txt ", :placeholder => "作品描述不能为空", :onkeyup => "regexStudentWorkDescription();"%>
|
||||
<div class="cl"></div>
|
||||
<p id="student_work_description_textarea" class="c_red ml90 mb10"></p>
|
||||
</p>
|
||||
<div class="cl"></div>
|
||||
<p>
|
||||
<label class="fl"> 添加附件 :</label>
|
||||
<%= render :partial => 'attachments/new_form' %>
|
||||
</p>
|
||||
<div class="cl"></div>
|
||||
<% if @homework.homework_type != 2%>
|
||||
<p>
|
||||
<label class="fl"> 添加附件 :</label>
|
||||
<%= render :partial => 'attachments/new_form' %>
|
||||
</p>
|
||||
<div class="cl"></div>
|
||||
<% end%>
|
||||
<p class="ml80 ">
|
||||
<a href="javascript:void(0)" class="blue_btn fl c_white" onclick="new_student_work();">提交作品</a>
|
||||
<%= link_to "返 回".html_safe, student_work_index_path(:homework => @homework), :class => "blue_btn grey_btn fl c_white"%>
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
成功
|
|
@ -2,6 +2,10 @@ if($("#about_hwork_<%= @work.id%>").children().length > 0)
|
|||
{$("#about_hwork_<%= @work.id%>").html("");}
|
||||
else
|
||||
{
|
||||
$("#about_hwork_<%= @work.id%>").html("<%= escape_javascript(render :partial => 'show') %>");
|
||||
<% if @homework.homework_type == 2%>
|
||||
$("#about_hwork_<%= @work.id%>").html("<%= escape_javascript(render :partial => 'programing_work_show') %>");
|
||||
<% else%>
|
||||
$("#about_hwork_<%= @work.id%>").html("<%= escape_javascript(render :partial => 'show') %>");
|
||||
<% end%>
|
||||
$('#score_<%= @work.id%>').peSlider({range: 'min'});
|
||||
}
|
|
@ -2026,6 +2026,7 @@ zh:
|
|||
|
||||
label_file_lost_list: 缺失文件列表
|
||||
lable_unset: 未设置
|
||||
label_chose_group: 请选择分班
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -85,7 +85,7 @@ RedmineApp::Application.routes.draw do
|
|||
get 'alert_anonymous_comment'
|
||||
end
|
||||
collection do
|
||||
|
||||
post 'next_step'
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -100,6 +100,7 @@ RedmineApp::Application.routes.draw do
|
|||
get 'student_work_absence_penalty'
|
||||
get 'absence_penalty_list'
|
||||
get 'evaluation_list'
|
||||
post 'set_program_score'
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
class AddProportionToPrograming < ActiveRecord::Migration
|
||||
def up
|
||||
add_column :homework_detail_programings, :ta_proportion, :float, :default => 0.1
|
||||
end
|
||||
|
||||
def down
|
||||
remove_column :homework_detail_programings, :ta_proportion
|
||||
end
|
||||
end
|
|
@ -0,0 +1,9 @@
|
|||
class ChangeStudenWorkDesc < ActiveRecord::Migration
|
||||
def up
|
||||
change_column :student_works,:description,:text,:limit => 4294967295
|
||||
end
|
||||
|
||||
def down
|
||||
change_column :student_works,:description,:text
|
||||
end
|
||||
end
|
|
@ -0,0 +1,9 @@
|
|||
class AddQuestionIdToHomework < ActiveRecord::Migration
|
||||
def up
|
||||
add_column :homework_detail_programings, :question_id, :integer
|
||||
end
|
||||
|
||||
def down
|
||||
remove_column :homework_detail_programings, :question_id
|
||||
end
|
||||
end
|
|
@ -0,0 +1,14 @@
|
|||
class CreateTestResult < ActiveRecord::Migration
|
||||
def up
|
||||
create_table :student_work_tests do |t|
|
||||
t.integer :student_work_id
|
||||
t.integer :homework_test_id
|
||||
t.integer :result
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
drop_table :student_work_tests
|
||||
end
|
||||
end
|
38
db/schema.rb
38
db/schema.rb
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20150702073308) do
|
||||
ActiveRecord::Schema.define(:version => 20150715070534) do
|
||||
|
||||
create_table "activities", :force => true do |t|
|
||||
t.integer "act_id", :null => false
|
||||
|
@ -586,8 +586,10 @@ ActiveRecord::Schema.define(:version => 20150702073308) do
|
|||
t.string "language"
|
||||
t.text "standard_code", :limit => 2147483647
|
||||
t.integer "homework_common_id"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.float "ta_proportion", :default => 0.1
|
||||
t.integer "question_id"
|
||||
end
|
||||
|
||||
create_table "homework_evaluations", :force => true do |t|
|
||||
|
@ -721,16 +723,6 @@ ActiveRecord::Schema.define(:version => 20150702073308) do
|
|||
|
||||
add_index "journal_details", ["journal_id"], :name => "journal_details_journal_id"
|
||||
|
||||
create_table "journal_details_copy", :force => true do |t|
|
||||
t.integer "journal_id", :default => 0, :null => false
|
||||
t.string "property", :limit => 30, :default => "", :null => false
|
||||
t.string "prop_key", :limit => 30, :default => "", :null => false
|
||||
t.text "old_value"
|
||||
t.text "value"
|
||||
end
|
||||
|
||||
add_index "journal_details_copy", ["journal_id"], :name => "journal_details_journal_id"
|
||||
|
||||
create_table "journal_replies", :id => false, :force => true do |t|
|
||||
t.integer "journal_id"
|
||||
t.integer "user_id"
|
||||
|
@ -1229,20 +1221,28 @@ ActiveRecord::Schema.define(:version => 20150702073308) do
|
|||
t.integer "project_id"
|
||||
end
|
||||
|
||||
create_table "student_work_tests", :force => true do |t|
|
||||
t.integer "student_work_id"
|
||||
t.integer "homework_test_id"
|
||||
t.integer "result"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
create_table "student_works", :force => true do |t|
|
||||
t.string "name"
|
||||
t.text "description"
|
||||
t.text "description", :limit => 2147483647
|
||||
t.integer "homework_common_id"
|
||||
t.integer "user_id"
|
||||
t.float "final_score"
|
||||
t.float "teacher_score"
|
||||
t.float "student_score"
|
||||
t.float "teaching_asistant_score"
|
||||
t.integer "project_id", :default => 0
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.integer "late_penalty", :default => 0
|
||||
t.integer "absence_penalty", :default => 0
|
||||
t.integer "project_id", :default => 0
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.integer "late_penalty", :default => 0
|
||||
t.integer "absence_penalty", :default => 0
|
||||
end
|
||||
|
||||
create_table "student_works_evaluation_distributions", :force => true do |t|
|
||||
|
|
|
@ -394,6 +394,7 @@ function show_bid_dead_line(year,month,day,divname)
|
|||
+ "</form>"
|
||||
+ "<p class='fr'>作品提交还剩:</p>");
|
||||
}
|
||||
|
||||
//验证新建作业的名字
|
||||
function regex_homework_name()
|
||||
{
|
||||
|
@ -414,6 +415,7 @@ function regex_homework_name()
|
|||
//验证匿评数量
|
||||
function regex_evaluation_num()
|
||||
{
|
||||
if($("#evaluation_num").length == 0){ return true;}
|
||||
var evaluation_num = $.trim($("#evaluation_num").val());
|
||||
var regex = /^\d+$/;
|
||||
if(evaluation_num=="")
|
||||
|
@ -471,15 +473,18 @@ $(function(){
|
|||
});
|
||||
//第一次加载时,如果未开启匿评作业,隐藏显示匿评配置信息
|
||||
$(function(){
|
||||
if($("#homework_common_homework_type").attr("checked") == "checked")
|
||||
if($("#homework_common_homework_type").attr("id") != null && $("#homework_common_homework_type").val() != 2)
|
||||
{
|
||||
$("#evaluation_setting").show();
|
||||
$("#ta_proportion").removeAttr("disabled");
|
||||
}
|
||||
else
|
||||
{
|
||||
$("#evaluation_setting").hide();
|
||||
$("#ta_proportion").attr("disabled","disabled");
|
||||
if($("#homework_common_homework_type").attr("checked") == "checked")
|
||||
{
|
||||
$("#evaluation_setting").show();
|
||||
$("#ta_proportion").removeAttr("disabled");
|
||||
}
|
||||
else
|
||||
{
|
||||
$("#evaluation_setting").hide();
|
||||
$("#ta_proportion").attr("disabled","disabled");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -501,6 +506,25 @@ function submit_homework(id)
|
|||
}
|
||||
}
|
||||
|
||||
//增加测试结果
|
||||
function add_programing_test(obj) {
|
||||
var now = new Date().getTime();
|
||||
obj.after("<div><li><label class='label02'> 测试输入: </label><input type='text' class='fl h26 w186 mb10' name='input[" + now +"]'' />" +
|
||||
"</li><li ><label class='fl f14 ml10'> 输出: </label><input type='text' class='fl h26 w186 mb10' name='output[" + now +"]' />" +
|
||||
"</li><li><a class='icon_add ml10' href='javascript:void(0);' title='添加测试' onclick='add_programing_test($(this).parent().parent())'></a>" +
|
||||
"<a class='icon_remove' href='javascript:void(0);' title='删除测试' onclick='remove_programing_test($(this).parent().parent())'></a>" +
|
||||
"<span class='green_btn fl ml5 mt1'>测试</span></li><div class='cl'></div></div>");
|
||||
}
|
||||
//删除测试结果
|
||||
function remove_programing_test(obj) {
|
||||
if(obj.siblings("div").length == 0){
|
||||
alert("至少需要一组测试");
|
||||
}
|
||||
else{
|
||||
obj.remove();
|
||||
}
|
||||
}
|
||||
|
||||
function show_window (id1,id2,top,left) {
|
||||
$('#'+ id1).css('top',top);
|
||||
$('#'+ id1).css('left',left);
|
||||
|
@ -837,14 +861,14 @@ function clickOK(path)
|
|||
});
|
||||
}
|
||||
//查询
|
||||
function SearchByName(obj,url,event)
|
||||
function SearchByName(name,group,url,event)
|
||||
{
|
||||
var keycode = (event.keyCode ? event.keyCode : event.which);
|
||||
if(keycode == '13'){
|
||||
location.href = url + "&name=" + obj.val();
|
||||
location.href = url + "&name=" + name + "&group=" + group;
|
||||
}
|
||||
}
|
||||
function SearchByName_1(obj,url)
|
||||
function SearchByName_1(name,group,url)
|
||||
{
|
||||
location.href = url + "&name=" + obj.val();
|
||||
location.href = url + "&name=" + name + "&group=" + group;
|
||||
}
|
||||
|
|
|
@ -1,11 +1,15 @@
|
|||
function addSlipMenu () {
|
||||
var loggedas = $('#current_user_li:first');
|
||||
var loggedas = $('#current_user_li a:first');
|
||||
var sub_menu = $('#user_sub_menu');
|
||||
loggedas.mouseenter(function(event) {
|
||||
loggedas.mouseenter(function() {
|
||||
sub_menu.show();
|
||||
$('#my_projects_ul').hide();
|
||||
$('#my_courses_ul').hide();
|
||||
});
|
||||
sub_menu.mouseleave(function(event) {
|
||||
sub_menu.mouseleave(function() {
|
||||
sub_menu.hide();
|
||||
$('#my_projects_ul').hide();
|
||||
$('#my_courses_ul').hide();
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -13,24 +17,26 @@ function addProjectSlipMenu () {
|
|||
var loggedas = $('#my_projects_li');
|
||||
var project_sub_menu = $('#my_projects_ul');
|
||||
var course_sub_menu = $('#my_courses_ul');
|
||||
loggedas.mouseenter(function(event) {
|
||||
loggedas.mouseenter(function() {
|
||||
course_sub_menu.hide();
|
||||
project_sub_menu.show();
|
||||
});
|
||||
loggedas.mouseleave(function(event) {
|
||||
loggedas.mouseleave(function() {
|
||||
project_sub_menu.hide();
|
||||
course_sub_menu.hide();
|
||||
});
|
||||
}
|
||||
function addCourseSlipMenu () {
|
||||
var loggedas = $('#my_courses_li');
|
||||
var project_sub_menu = $('#my_projects_ul');
|
||||
var course_sub_menu = $('#my_courses_ul');
|
||||
loggedas.mouseenter(function(event) {
|
||||
loggedas.mouseenter(function() {
|
||||
project_sub_menu.hide();
|
||||
course_sub_menu.show();
|
||||
});
|
||||
loggedas.mouseleave(function(event) {
|
||||
loggedas.mouseleave(function() {
|
||||
course_sub_menu.hide();
|
||||
project_sub_menu.hide();
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -30,6 +30,10 @@ a:hover.news_foot{ color:#787b7e; border:1px solid #d4d4d4;}
|
|||
.box_h3{ color:#15bccf; text-align:center; font-size:16px;}
|
||||
.box_p{ color:#404040; margin-bottom:5px;}
|
||||
.fb_item{ color:#919191; border:1px solid #919191; height:28px; margin-bottom:10px; padding-left:5px; width:290px;}
|
||||
a.icon_addm{ background:url(../images/img_floatbox.png) 0 -33px no-repeat; width:16px; height:16px; display:block; margin:5px 0 0 5px;}
|
||||
a:hover.icon_addm{background:url(../images/img_floatbox.png) 0 -61px no-repeat; }
|
||||
a.icon_removem{ background:url(../images/img_floatbox.png) -22px -33px no-repeat;width:16px; height:16px; display:block; margin:5px 0 0 5px}
|
||||
a:hover.icon_removem{background:url(../images/img_floatbox.png) -22px -61px no-repeat;}
|
||||
a.btn_free{ background:#ff5722; display:block; width:80px; text-align:center; color:#fff; height:26px; padding-top:3px; margin-bottom:10px;}
|
||||
a:hover.btn_free{ background:#d63502;}
|
||||
/*成员邀请*/
|
||||
|
@ -338,7 +342,6 @@ a:hover.st_add{ color:#ff8e15;}
|
|||
.upbtn{ margin:40px 0 0 15px; display:block; padding:2px 5px; border:1px solid #eaeaea;}
|
||||
.upbtn:hover{border:1px solid #64bdd9; color:#64bdd9;cursor: pointer;}
|
||||
.upload_file{margin-left: -60px;margin-top: 40px;width: 50px;position: absolute;height: 24px;opacity: 0;cursor: pointer}
|
||||
|
||||
/* 功能倒计时*/
|
||||
.w_img{ float:left; margin:10px 10px 15px 0px;}
|
||||
.w_p{ float:left; color:#15bccf; font-size:16px; font-weight:bold; margin-top:70px; }
|
||||
|
@ -349,7 +352,9 @@ a:hover.st_add{ color:#ff8e15;}
|
|||
.upload_con h2{ display:block; background:#eaeaea; font-size:14px; color:#343333; height:31px; width: auto; margin-top:25px; padding-left:20px; padding-top:5px;}
|
||||
.upload_box{ width:430px; margin:15px auto;}
|
||||
|
||||
a.link_file{ background:url(../images/pic_file.png) 0 2px no-repeat; padding-left:20px; }
|
||||
a:hover.link_file{ background:url(../images/pic_file.png) 0 -25px no-repeat; color:#3ca5c6;}
|
||||
.r_txt_tit{width:510px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;color:#15bccf; float:left; color:#09658c; font-size:14px;}
|
||||
|
||||
blockquote {background: #eeeeee;padding: 10px;margin-bottom: 10px;word-break: break-all;word-wrap: break-word;}
|
||||
.respond-form{display: none;margin: auto;clear: both;}
|
||||
|
@ -561,8 +566,8 @@ a.files_tag_select{ background:#64bdd9; color:#fff; border:1px solid #64bdd9; pa
|
|||
.hwork_new_left{ width:220px; float:left; }
|
||||
.hwork_new_right{ width:350px; float:left; margin-left:40px;}
|
||||
.w305{ width:305px;}
|
||||
.icon_add{ background:url(images/icons.png) 0px -310px no-repeat; width:16px; height:27px; display:block;float:left; margin-right:5px;}
|
||||
a:hover.icon_add{background:url(images/icons.png) -20px -310px no-repeat;}
|
||||
.icon_add{ background:url(../stylesheets/images/icons.png) 0px -310px no-repeat; width:16px; height:27px; display:block;float:left; margin-right:5px;}
|
||||
a:hover.icon_add{background:url(../stylesheets/images/icons.png) -20px -310px no-repeat;}
|
||||
|
||||
/* 20150505讨论区*/
|
||||
.w664{ width:664px;}
|
||||
|
@ -598,10 +603,12 @@ a:hover.Reply_pic{border:1px solid #64bdd9;}
|
|||
/*.talk_new{ border-bottom:1px dashed #d9d9d9; padding-bottom:10px;}*/
|
||||
#about_newtalk{ display:none;}
|
||||
|
||||
/* 20150423作业评分*/
|
||||
.ml14{ margin-left:14px;}
|
||||
.w548{ width:552px;}
|
||||
.w547{ width:544px;}
|
||||
.w196{ width:196px;}
|
||||
.w186{ width:186px;}
|
||||
.w459{ width:459px;}
|
||||
.hwork_new_set{border:1px dashed #CCC; background:#f5f5f5; text-align:center; padding:10px 0; margin-bottom:10px;}
|
||||
.hwork_new_grey{background:#dbdbdb; width:610px; padding:10px 20px; margin:0 auto; text-align:left; margin-bottom:5px;}
|
||||
|
@ -610,6 +617,8 @@ a:hover.Reply_pic{border:1px solid #64bdd9;}
|
|||
.w305{ width:305px;}
|
||||
.icon_add{background:url(images/icons.png) 0px -310px no-repeat; width:16px; height:27px; display:block;float:left; margin-right:5px;}
|
||||
a:hover.icon_add{background:url(images/icons.png) -20px -310px no-repeat;}
|
||||
.icon_remove{background:url(images/icons.png) 0px -338px no-repeat; width:16px; height:27px; display:block;float:left;}
|
||||
a:hover.icon_remove{background:url(images/icons.png) -20px -338px no-repeat;}
|
||||
|
||||
/* 20150506上传头像*/
|
||||
.uppicBox{ width:265px; height:265px; background:#f2f2f5; float:left; color:#666; text-align:center;}
|
||||
|
@ -656,6 +665,7 @@ a:hover.ping_pic{border:1px solid #64bdd9;}
|
|||
a.down_btn{ border:1px solid #CCC; color:#999; padding:0px 5px; font-size:12px; text-align:center; display:block;}
|
||||
a:hover.down_btn{ background:#14ad5a; color:#fff; border:1px solid #14ad5a;}
|
||||
.fr{ float:right;}
|
||||
.min_search{ width:140px; height:20px; border:1px solid #d0d0d0; color:#666; background:url(../images/public_icon.png) 185px -193px no-repeat; }
|
||||
.li_min_search{ float:right; margin-right:-10px;}
|
||||
.info_ni_download{ width:100px; padding:5px;position: absolute;display:none;-moz-border-radius:3px; -webkit-border-radius:3px; border-radius:3px; box-shadow:0px 0px 5px #194a81; color:#666; background:#fff; text-align:left;margin-left: 200px;margin-top: 10px;}
|
||||
.info_ni{ width:100px; padding:5px;position: absolute;display:none;-moz-border-radius:3px; -webkit-border-radius:3px; border-radius:3px; box-shadow:0px 0px 5px #194a81; color:#666; background:#fff; text-align:left;margin-left: 50px;margin-top: -5px;}
|
||||
|
@ -674,6 +684,12 @@ input#score{ width:40px;}
|
|||
.ui-slider .ui-slider-handle:hover,.ui-slider .ui-slider-handle:focus{background:#64bdd9;}
|
||||
.ui-slider .ui-slider-handle:active{background-image:none;}
|
||||
.ui-slider .ui-slider-range{position:absolute;z-index:1;font-size:.7em;display:block;border:0;top:0;height:100%;background:#64bdd9;left:0;}
|
||||
/* 编程作品 */
|
||||
.border_ce{ border:1px solid #e4e4e4; }
|
||||
.border_ce tr td{ height:26px; }
|
||||
.td_tit{width:155px; text-align:center;}
|
||||
.td_50{width:50px; text-align:center;}
|
||||
a.work_list_tit{width:610px; display:block; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;}
|
||||
|
||||
.filename { background: url(../images/pic_file.png) 0 -25px no-repeat;color: #3ca5c6;max-width: 150px;border: none; padding-left: 20px;margin-right: 10px;margin-bottom: 5px; white-space: nowrap; text-overflow:ellipsis;}
|
||||
.evaluation{position: relative;}
|
||||
|
|
|
@ -79,6 +79,7 @@ h4{ font-size:14px; color:#3b3b3b;}
|
|||
.mr50{margin-right: 50px;}
|
||||
.mr55{margin-right: 55px;}
|
||||
.mr70{margin-right: 70px;}
|
||||
.mt1{margin-top: 1px;}
|
||||
.mt3{ margin-top:3px;}
|
||||
.mt5{ margin-top:5px;}
|
||||
.mt8{ margin-top:8px;}
|
||||
|
@ -109,6 +110,7 @@ h4{ font-size:14px; color:#3b3b3b;}
|
|||
.w350{ width:350px;}
|
||||
.w610{ width:610px;}
|
||||
.w600{ width:600px;}
|
||||
.h20{height: 20px;}
|
||||
.h22{ height:22px;}
|
||||
.h26{ height:26px;}
|
||||
.h50{ height:50px;}
|
||||
|
@ -166,6 +168,7 @@ a.green_btn{background:#28be6c;color:#fff;font-size:14px; font-weight:normal; pa
|
|||
a:hover.green_btn{ background:#14ad5a;}
|
||||
.blue_btn{ background:#64bdd9; color:#fff; font-size:14px; font-weight:normal;padding:2px 10px; text-align:center;}
|
||||
a.blue_btn{background:#64bdd9;color:#fff;font-size:14px; font-weight:normal; padding:2px 10px; text-align:center;}
|
||||
a.orange_btn_homework{background:#d63502;color:#fff;font-size:14px; font-weight:normal; padding:2px 10px; text-align:center;}
|
||||
a:hover.blue_btn{ background:#329cbd;cursor: pointer;}
|
||||
a.orange_btn{ background:#ff5722;color:#fff;font-size:14px; font-weight:normal; padding:2px 10px; text-align:center; }
|
||||
a:hover.orange_btn{ background:#d63502;}
|
||||
|
|
Loading…
Reference in New Issue