Merge branch 'develop' of https://git.trustie.net/jacknudt/trustieforge into develop

This commit is contained in:
cxt 2017-06-10 09:17:10 +08:00
commit c10911ec5d
99 changed files with 1765 additions and 797 deletions

View File

@ -4,9 +4,9 @@ unless RUBY_PLATFORM =~ /w32/
# unix-like only
gem 'iconv'
if RUBY_PLATFORM =~ /darwin/
# gem "rmagick", "= 2.15.4" ## osx must be this version
gem "rmagick", "= 2.15.4" ## osx must be this version
elsif RUBY_PLATFORM =~ /linux/
# gem "rmagick", "~> 2.13.1" ## centos yum install ImageMagick-devel
gem "rmagick", "~> 2.13.1" ## centos yum install ImageMagick-devel
end
gem 'certified'
gem 'net-ssh', '2.9.1'

View File

@ -136,8 +136,14 @@ class AtController < ApplicationController
#Message
def find_message(id)
message = Message.find(id)
at_persons = message.board.messages.map(&:author)
(at_persons || []) + (find_project(message.board.project_id)||[])
if message.board.course_id.nil?
at_persons = message.board.messages.map(&:author)
(at_persons || []) + (find_project(message.board.project_id)||[])
else
type = 'Course'
course_id = message.board.course_id
find_at_users(type, course_id)
end
end
#News

View File

@ -310,7 +310,8 @@ class AttachmentsController < ApplicationController
@history.version = @old_history.nil? ? 1 : @old_history.version + 1
@history.save #历史记录保存完毕
#将最新保存的记录 数据替换到 需要修改的文件记录
@old_attachment.attributes = @attachment.attributes.dup.except("id","container_id","container_type","is_public","downloads", "quotes")
@old_attachment.attributes = @attachment.attributes.dup.except("id","container_id","container_type","is_public","downloads", "quotes",'is_publish','publish_time')
@status = @old_attachment.is_publish
# 如果附件描述被修改,则保存附件
unless params[:description] == @attachment.description
@old_attachment.description = params[:description]
@ -327,8 +328,18 @@ class AttachmentsController < ApplicationController
end
end
def update_attachment_publish_time
@attachment = Attachment.find params[:id]
@status = params[:status].to_i
if @status == 0
@attachment.update_attributes(:is_publish => 1, :publish_time => Time.now)
end
end
# prams[:type] => history 历史版本
def destroy
page = params[:page] ? params[:page].to_i : 1
@curr_page = page
if params[:type] == "history"
begin
AttachmentHistory.find(params[:history_id]).destroy
@ -390,6 +401,8 @@ class AttachmentsController < ApplicationController
format.html { redirect_to_referer_or user_blog_blog_comment_path(:user_id=>@attachment.container.author.id,:blog_id=>@attachment.container.blog_id,:id=>@attachment.container.id)}
elsif @course.nil?
format.html { redirect_to_referer_or forum_memo_path(@attachment.container.forum, @attachment.container) }
elsif @course
format.html { redirect_to course_files_path(@course, :page => page) }
else
format.html { redirect_to_referer_or course_path(@course) }
end
@ -667,6 +680,7 @@ class AttachmentsController < ApplicationController
@attachment = Attachment.find(params[:id])
@attachment_histories = @attachment.attachment_histories
@attachment_histories_count = @attachment_histories.count
@curr_page = params[:page]
respond_to do |format|
format.js
end

View File

@ -31,6 +31,7 @@ class AvatarController < ApplicationController
end
end
size = @temp_file.size
if @temp_file && (@temp_file.size > 0)
if @temp_file.size > Setting.upload_avatar_max_size.to_i
@status = 1
@ -65,7 +66,11 @@ class AvatarController < ApplicationController
end
end
Trustie::Utils::Image.new(diskfile,true).compress(300)
if @source_type == 'Contest'
Trustie::Utils::Image.new(diskfile,true).compress(900)
else
Trustie::Utils::Image.new(diskfile,true).compress(300)
end
@status = 0
@msg = ''
else
@ -75,10 +80,12 @@ class AvatarController < ApplicationController
end
@temp_file = nil
# while !File.readable?(diskfile)
# logger.info("###############################################################sleep")
# sleep(0.5)
# end
sleep(3)
unless File.size(diskfile) < size
logger.info("###############################################################sleep")
sleep(0.5)
end
#@src_file = diskfile

View File

@ -229,6 +229,54 @@ class BoardsController < ApplicationController
end
end
def board_history
@order, @b_sort,@type = params[:order] || 1, params[:sort] || 1, params[:type] || 1
#确定 sort_type 1升序 2 降序
if @order.to_i == @type.to_i
@b_sort = @b_sort.to_i == 1 ? 2 : 1
else
@b_sort = 2
end
sort_name = "updated_on"
sort_type = @b_sort == 1 ? "asc" : "desc"
@course = Course.find(params[:course])
syllabus = @course.syllabus
boards = Board.where(:course_id => syllabus.courses.map(&:id))
@topics = Message.where(:board_id => boards.map(&:id), :parent_id => nil).reorder("#{Message.table_name}.sticky DESC, COALESCE(last_replies_messages.created_on, #{Message.table_name}.created_on) #{sort_type}").offset(@topic_pages).includes(:last_reply).preload(:author, {:last_reply => :author}).all();
#根据 赞+回复数排序
if @order.to_i == 2
@type = 2
@topics.each do |topic|
all_comments = []
#count=get_all_children(all_comments, topic).count
count=Message.where("root_id = #{topic.id}").count
topic[:infocount] = get_praise_num(topic) + count
if topic[:infocount] < 0
topic[:infocount] = 0
end
end
@b_sort == 1 ? @topics = @topics.sort{|x,y| x[:infocount] <=> y[:infocount] } : @topics = @topics.sort{|x,y| y[:infocount] <=> x[:infocount] }
@topics = sort_by_sticky @topics
@topics = sortby_time_countcommon_hassticky @topics,sort_name
else
@type = 1
end
#分页
@limit = 15
@is_remote = true
@atta_count = @topics.count
@atta_pages = Paginator.new @atta_count, @limit, params['page'] || 1
@offset ||= @atta_pages.offset
@topics = paginateHelper @topics,@limit
@page = params[:page] ? params[:page].to_i + 1 : 0
respond_to do |format|
format.js
end
end
def new
@board = @project.boards.build
@board.safe_attributes = params[:board]

View File

@ -627,13 +627,14 @@ class CoursesController < ApplicationController
member = @course.members.find params[:member_id]
student_role = member.member_roles.where("role_id = 10").first
teacher_role = member.member_roles.where("role_id = 7 || role_id = 9").first
joined = StudentsForCourse.where('student_id = ? and course_id = ?', member.user_id,@course.id)
joined.destroy_all
if member && member.deletable? && student_role
user_admin = CourseInfos.where("user_id = ? and course_id = ?", member.user_id, @course.id)
if user_admin.size > 0
user_admin.destroy_all
end
joined = StudentsForCourse.where('student_id = ? and course_id = ?', member.user_id,@course.id)
joined.destroy_all
if member.member_roles.count > 1&& student_role && teacher_role
student_role.destroy

View File

@ -14,7 +14,9 @@ class ExerciseController < ApplicationController
exercise.update_column('exercise_status', 2)
course = exercise.course
course.members.each do |m|
exercise.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => course.id, :viewed => false, :status => 2)
if m.user_id != exercise.user_id
exercise.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => course.id, :viewed => false, :status => 2)
end
end
end
@ -42,7 +44,9 @@ class ExerciseController < ApplicationController
exercise.update_column('exercise_status', 2)
course = exercise.course
course.members.each do |m|
exercise.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => course.id, :viewed => false, :status => 2)
if m.user_id != exercise.user_id
exercise.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => course.id, :viewed => false, :status => 2)
end
end
end
@ -441,9 +445,6 @@ class ExerciseController < ApplicationController
@exercise.exercise_status = 2
@exercise.publish_time = Time.now
if @exercise.save
@exercise.course.members.each do |m|
@exercise.course_messages << CourseMessage.create(:user_id =>m.user_id, :course_id => @exercise.course.id, :viewed => false,:status=>2)
end
#redirect_to exercise_index_url(:course_id=> @course.id)
respond_to do |format|
format.js

View File

@ -43,6 +43,9 @@ class FilesController < ApplicationController
@all_attachments = User.current.admin? ? @attachments : visable_attachemnts(@attachments)
@limit = 10
@feedback_count = @all_attachments.count
if @feedback_count <= (params['page'].to_i - 1) * 10
params['page'] = 1
end
@feedback_pages = Paginator.new @feedback_count, @limit, params['page']
@offset ||= @feedback_pages.offset
#@curse_attachments_all = @all_attachments[@offset, @limit]
@ -61,6 +64,7 @@ class FilesController < ApplicationController
@sort = ""
@order = ""
@is_remote = true
@curr_page = params[:page] ? params[:page].to_i : 1
@q = params[:name].strip
if params[:sort]
order_by = params[:sort].split(":")
@ -222,10 +226,11 @@ class FilesController < ApplicationController
if sort == ""
sort = "created_on DESC"
end
course_ids = "(" + course.syllabus.courses.map(&:id).join(",") + ")"
if keywords != "%%"
resultSet = Attachment.where("attachments.container_type = 'Course' And attachments.container_id = '#{course.id}' AND filename LIKE :like ", like: "%#{keywords}%").reorder(sort)
resultSet = Attachment.where("attachments.container_type = 'Course' And attachments.container_id in #{course_ids} AND filename LIKE :like ", like: "%#{keywords}%").reorder(sort)
else
resultSet = Attachment.where("attachments.container_type = 'Course' And attachments.container_id = '#{course.id}' "). reorder(sort)
resultSet = Attachment.where("attachments.container_type = 'Course' And attachments.container_id in #{course_ids} "). reorder(sort)
end
#resultSet = Attachment.find_by_sql("SELECT `attachments`.* FROM `attachments` LEFT OUTER JOIN `homework_attaches` ON `attachments`.container_type = 'HomeworkAttach' AND `attachments`.container_id = `homework_attaches`.id LEFT OUTER JOIN `homework_for_courses` ON `homework_attaches`.bid_id = `homework_for_courses`.bid_id LEFT OUTER JOIN `homework_for_courses` AS H_C ON `attachments`.container_type = 'Bid' AND `attachments`.container_id = H_C.bid_id WHERE (`homework_for_courses`.course_id = 117 OR H_C.course_id = 117 OR (`attachments`.container_type = 'Course' AND `attachments`.container_id = 117)) AND `attachments`.filename LIKE '%#{keywords}%'").reorder("created_on DESC")
end
@ -274,6 +279,7 @@ class FilesController < ApplicationController
@sort = ""
@order = ""
@is_remote = false
@curr_page = params[:page] ? params[:page].to_i : 1
if params[:project_id]
# 更新资源申请消息为已读
# ar_ids = ApplyResource.where("user_id =? and container_id =? and container_type =?", User.current.id, params[:project_id].to_i, "Project").map{|ar| ar.id}
@ -380,7 +386,7 @@ class FilesController < ApplicationController
sort = "#{Attachment.table_name}.created_on desc"
end
@containers = [ Course.includes(:attachments).reorder(sort).find(@course.id)]
@containers = @course.syllabus.courses.includes(:attachments).reorder(sort)
show_attachments @containers
get_attachment_for_tip(@all_attachments)

View File

@ -121,7 +121,7 @@ class ForumsController < ApplicationController
order = ""
@order_str = ""
if(params[:reorder_complex])
order = "last_replies_memos.created_at #{params[:reorder_complex]}, #{Memo.table_name}.created_at #{params[:reorder_complex]}"
order = "replies_count #{params[:reorder_complex]}, #{Memo.table_name}.created_at #{params[:reorder_complex]}"
@order_str = "reorder_complex="+params[:reorder_complex]
elsif(params[:reorder_popu])
order = "replies_count #{params[:reorder_popu]}"

View File

@ -176,11 +176,8 @@ class HomeworkCommonController < ApplicationController
end
anonymous = params[:homework_common][:anonymous_comment] ? params[:homework_common][:anonymous_comment].to_i : 1
if anonymous != @homework.anonymous_comment
if anonymous == 1
homework_detail_manual.ta_proportion = @homework.homework_type == 2 ? 0.4 : 1.0
else
homework_detail_manual.ta_proportion = @homework.homework_type == 2 ? 0.3 : 0.6
end
homework_detail_manual.te_proportion = 1.0
homework_detail_manual.ta_proportion = 0
end
@homework.save_attachments(params[:attachments])
@ -192,11 +189,7 @@ class HomeworkCommonController < ApplicationController
@homework_detail_programing = @homework.homework_detail_programing
@homework_detail_programing.language = params[:language_type].to_i if params[:language_type]
if anonymous != @homework.anonymous_comment
if anonymous == 1
@homework_detail_programing.ta_proportion = 0.6
else
@homework_detail_programing.ta_proportion = 0.5
end
@homework_detail_programing.ta_proportion = 0
end
@homework.homework_samples.delete_all if params[:sample]
@ -267,36 +260,6 @@ class HomeworkCommonController < ApplicationController
def destroy
if @homework.destroy
#更新CourseHomeworkStatistics中每个学生的未交作品数、已交作品数、迟交作品数
hw_count = @course.homework_commons.includes(:homework_detail_manual).where("homework_detail_manuals.comment_status > 0").count
homework_ids = @course.homework_commons.empty? ? "(-1)" : "(" + @course.homework_commons.map{|hw| hw.id}.join(",") + ")"
student_works = StudentWork.where("homework_common_id in #{homework_ids} and work_status !=0")
is_eva_homeworks = @course.homework_commons.includes(:homework_detail_manual).where("homework_commons.anonymous_comment = 0 and homework_detail_manuals.comment_status = 2")
is_eva_student_works = StudentWork.where(:homework_common_id => is_eva_homeworks.map{|hw| hw.id})
has_eva_homeworks = @course.homework_commons.includes(:homework_detail_manual).where("homework_commons.anonymous_comment = 0 and homework_detail_manuals.comment_status = 3")
has_eva_student_works = StudentWork.where(:homework_common_id => has_eva_homeworks.map{|hw| hw.id})
@course.student.each do |student|
user = student.student
course_statistics = CourseHomeworkStatistics.find_by_course_id_and_user_id(@homework.course_id, student.student_id)
if user && course_statistics
committed_work_num = user.student_works.where("homework_common_id in #{homework_ids} and work_status != 0").count
un_commit_work_num = (hw_count - committed_work_num) < 0 ? 0 : (hw_count - committed_work_num)
late_commit_work_num = user.student_works.where("homework_common_id in #{homework_ids} and work_status = 2").count
absence_evaluation_work_num = user.student_works_evaluation_distributions.where(:student_work_id => has_eva_student_works.map(&:id)).count -
user.student_works_scores.where(:reviewer_role => 3, :student_work_id => has_eva_student_works.map(&:id)).group_by(&:student_work_id).count
absence_evaluation_work_num = absence_evaluation_work_num < 0 ? 0 : absence_evaluation_work_num
un_evaluation_work_num = user.student_works_evaluation_distributions.where(:student_work_id => is_eva_student_works.map(&:id)).count -
user.student_works_scores.where(:reviewer_role => 3, :student_work_id => is_eva_student_works.map(&:id)).group_by(&:student_work_id).count
un_evaluation_work_num = un_evaluation_work_num < 0 ? 0 : un_evaluation_work_num
appeal_num = user.student_works_scores.where(:student_work_id => student_works.map(&:id), :appeal_status => 3).count
average_score = user.student_works.where(:id => student_works.map(&:id)).select("AVG(student_works.work_score) as score").first ? user.student_works.where(:id => student_works.map(&:id)).select("AVG(student_works.work_score) as score").first.score : 0
total_score = user.student_works.where(:id => student_works.map(&:id)).select("SUM(student_works.work_score) as score").first ? user.student_works.where(:id => student_works.map(&:id)).select("SUM(student_works.work_score) as score").first.score : 0
course_statistics.update_attributes(:committed_work_num => committed_work_num, :un_commit_work_num => un_commit_work_num,
:late_commit_work_num => late_commit_work_num, :absence_evaluation_work_num => absence_evaluation_work_num, :un_evaluation_work_num => un_evaluation_work_num,
:appeal_num => appeal_num, :average_score => average_score, :total_score => total_score)
end
end
respond_to do |format|
format.html {
@hw_status = params[:hw_status].to_i
@ -315,17 +278,20 @@ class HomeworkCommonController < ApplicationController
#加入到题库
def add_to_homework_bank
if params[:type] && (params[:type].to_i == 1 || params[:type].to_i == 3)
if params[:type].to_i == 3
old_banks = HomeworkBank.where(:homework_common_id => @homework.id)
unless old_banks.blank?
old_banks.each do |bank|
bank.update_attributes(:quotes => (bank.quotes - 1) > 0 ? (bank.quotes - 1) : 0)
end
end
end
homework_bank = add_to_homework_bank_f @homework
homework_bank.save
@homework.update_attributes(:homework_bank_id => homework_bank.id)
# 如果是另存到题库且是作业创建者,则将原题库的引用数减一
if params[:type].to_i == 3 && User.current == @homework.user
old_banks = HomeworkBank.where(:id => @homework.homework_bank_id)
unless old_banks.blank?
old_banks.first.update_attributes(:quotes => (old_banks.first.quotes - 1) > 0 ? (old_banks.first.quotes - 1) : 0)
end
end
if User.current == @homework.user
@homework.update_attributes(:homework_bank_id => homework_bank.id)
else
homework_bank.update_column('quotes', 0);
end
elsif params[:type].to_i == 2
homework_bank = HomeworkBank.where(:id => @homework.homework_bank_id).first
if homework_bank
@ -352,7 +318,7 @@ class HomeworkCommonController < ApplicationController
end
end
end
if @homework.is_update
if @homework.is_update && User.current == @homework.user
@homework.update_attributes(:is_update => 0)
end
@user_activity_id = params[:user_activity_id].to_i
@ -480,11 +446,12 @@ class HomeworkCommonController < ApplicationController
# 参与匿评的缺评计算
@homework.student_works.where("work_status != 0").each do |student_work|
absence_penalty_count = student_work.user.student_works_evaluation_distributions.where("student_work_id IN #{work_ids}").count - student_work.user.student_works_scores.where("student_work_id IN #{work_ids} and reviewer_role = 3").count
absence_penalty_count = student_work.user.student_works_evaluation_distributions.where("student_work_id IN #{work_ids}").count - student_work.user.student_works_scores.where("student_work_id IN #{work_ids} and reviewer_role = 3").group_by(&:student_work_id).count
student_work.absence_penalty = absence_penalty_count > 0 ? absence_penalty_count * @homework_detail_manual.absence_penalty : 0
student_work.save
#更新CourseHomeworkStatistics中该学生的待匿评数和缺评数
absence_penalty_count = absence_penalty_count > 0 ? absence_penalty_count : 0
course_statistics = CourseHomeworkStatistics.find_by_course_id_and_user_id(@homework.course_id, student_work.user_id)
course_statistics.update_attribute('un_evaluation_work_num', (course_statistics.un_evaluation_work_num - absence_penalty_count) < 0 ? 0 : (course_statistics.un_evaluation_work_num - absence_penalty_count)) if course_statistics
course_statistics.update_attribute('absence_evaluation_work_num', course_statistics.absence_evaluation_work_num + absence_penalty_count) if course_statistics
@ -618,13 +585,15 @@ class HomeworkCommonController < ApplicationController
@homework_detail_manual.evaluation_end = params[:evaluation_end]
end
evaluation_num = @homework_detail_manual.evaluation_num
if params[:evaluation_limit].to_i == 1
@homework_detail_manual.evaluation_num = params[:evaluation_num]
@homework_detail_manual.absence_penalty = evaluation_num == -1 ? 5 : @homework_detail_manual.absence_penalty
else
@homework_detail_manual.evaluation_num = -1
@homework_detail_manual.absence_penalty = 0
if params[:evaluation_limit] && params[:evaluation_num]
evaluation_num = @homework_detail_manual.evaluation_num
if params[:evaluation_limit].to_i == 1
@homework_detail_manual.evaluation_num = params[:evaluation_num]
@homework_detail_manual.absence_penalty = evaluation_num == -1 ? 5 : @homework_detail_manual.absence_penalty
else
@homework_detail_manual.evaluation_num = -1
@homework_detail_manual.absence_penalty = 0
end
end
@homework_detail_manual.save
@user_activity_id = params[:user_activity_id].to_i

View File

@ -636,7 +636,7 @@ class OrganizationsController < ApplicationController
end
def apply_subdomain
organization = Organization.find(params[:id])
@applied_message_count = AppliedMessage.where(:applied_id => organization.id, :name => params[:domain].downcase, :status => 1).count
@applied_message_count = AppliedMessage.where(:applied_id => organization.id, :name => params[:domain].downcase, :status => 0).count
# 如果申请过该名字,怎不能重复申请
if @applied_message_count > 0
@flag = 1
@ -670,7 +670,7 @@ class OrganizationsController < ApplicationController
end
# 自己处理自己的消息则不需要另外发送消息
if User.current.id != @applied_message.applied_user_id
AppliedMessage.create(:user_id => @applied_message.applied_user_id, :applied_id => organization_id, :applied_type => 'Organization', :viewed => 0, :satus => 2, :applied_user_id => User.current.id, :name => org_domain.downcase)
OrgMessage.create(:user_id => params[:user_id], :organization_id => organization_id, :message_type => 'AgreeApplySubdomain', :message_id => organization_id, :sender_id => User.current.id, :viewed => 0, :content => params[:org_domain])
end
@applied_message.status = 2
@applied_message.updated_at = Time.now
@ -696,7 +696,7 @@ class OrganizationsController < ApplicationController
applied_messages.update_all(:status => 4, :viewed => true, :updated_at => Time.now)
# 自己处理自己的消息则不需要另外发送消息
if User.current.id != @applied_message.applied_user_id
AppliedMessage.create(:user_id => @applied_message.applied_user_id, :applied_id => organization_id, :applied_type => 'Organization', :viewed => 0, :satus => 4, :applied_user_id => User.current.id, :name => org_domain.downcase)
OrgMessage.create(:user_id => params[:user_id], :organization_id => organization_id, :message_type => 'DisagreeApplySubdomain', :message_id => organization_id, :sender_id => User.current.id, :viewed => 0, :content => params[:org_domain])
end
@applied_message.status = 4
@applied_message.updated_at = Time.now

View File

@ -39,17 +39,17 @@ class PollController < ApplicationController
end
end
#已提交问卷的用户不能再访问该界面
if has_commit_poll?(@poll.id,User.current.id) && (!User.current.admin?)
redirect_to poll_index_url(:polls_type => "Course", :polls_group_id => @course.id)
else
@can_edit_poll = @poll.user != User.current && ((!has_commit_poll?(@poll.id,User.current.id)) || User.current.admin?)
# if has_commit_poll?(@poll.id,User.current.id) && (!User.current.admin?)
# redirect_to poll_index_url(:polls_type => "Course", :polls_group_id => @course.id)
# else
@can_edit_poll = @poll.user != User.current
@percent = get_percent(@poll,User.current)
@poll_questions = @poll.poll_questions
@left_nav_type = 7
respond_to do |format|
format.html {render :layout => 'base_courses'}
end
end
#end
end
def new
@ -298,11 +298,11 @@ class PollController < ApplicationController
#提交答案
def commit_answer
pq = PollQuestion.find(params[:poll_question_id])
if has_commit_poll?(@poll.id,User.current.id) && (!User.current.admin?)
@percent = get_percent(@poll,User.current)
render :json => {:text => "ok" ,:percent => format("%.2f" ,@percent)}
return
end
# if has_commit_poll?(@poll.id,User.current.id) && (!User.current.admin?)
# @percent = get_percent(@poll,User.current)
# render :json => {:text => "ok" ,:percent => format("%.2f" ,@percent)}
# return
# end
if pq.question_type == 1
#单选题
pv = PollVote.find_by_poll_question_id_and_user_id(params[:poll_question_id],User.current.id)

View File

@ -701,8 +701,8 @@ class StudentWorkController < ApplicationController
course_statistics.update_attribute('committed_work_num', (course_statistics.committed_work_num - 1) < 0 ? 0 : (course_statistics.committed_work_num - 1)) if course_statistics
course_statistics.update_attribute('un_commit_work_num', course_statistics.un_commit_work_num + 1) if course_statistics
end
student_works.delete_all
student_work_projects.delete_all
student_works.destroy_all
student_work_projects.destroy_all
members = params[:group_member_ids].split(',')
for i in 1 .. members.count-1
stu_work = StudentWork.new(:name => @work.name, :description => @work.description,:user_id=> members[i].to_i, :homework_common_id => @homework.id, :project_id => @work.project_id, :late_penalty => @work.late_penalty,:work_status => 3, :commit_time => @work.commit_time)
@ -779,8 +779,8 @@ class StudentWorkController < ApplicationController
course_statistics.update_attribute('committed_work_num', (course_statistics.committed_work_num - 1) < 0 ? 0 : (course_statistics.committed_work_num - 1)) if course_statistics
course_statistics.update_attribute('un_commit_work_num', course_statistics.un_commit_work_num + 1) if course_statistics
end
student_works.delete_all
pros.delete_all
student_works.destroy_all
pros.destroy_all
project = @work.student_work_projects.where("is_leader = 1").first
if @homework.homework_detail_group.base_on_project == 1
@ -1225,21 +1225,36 @@ class StudentWorkController < ApplicationController
end
end
teacher_priority = params[:teacher_priority].to_i
if homework_detail_manual.ta_proportion.to_s != params[:ta_proportion].to_s || @homework.teacher_priority.to_s != teacher_priority.to_s || (homework_detail_programing && homework_detail_programing.ta_proportion.to_s != params[:sy_proportion].to_s)
homework_detail_manual.ta_proportion = params[:ta_proportion]
homework_detail_programing.ta_proportion = params[:sy_proportion] if homework_detail_programing
@homework.update_column('teacher_priority', teacher_priority)
if params[:final_mode] && params[:final_mode].to_i != homework_detail_manual.final_mode
homework_detail_manual.final_mode = params[:final_mode].to_i
if params[:final_mode].to_i == 0
homework_detail_manual.te_proportion = params[:te_proportion]
homework_detail_manual.ta_proportion = params[:ta_proportion]
homework_detail_programing.ta_proportion = params[:sy_proportion] if homework_detail_programing
homework_detail_programing.save if homework_detail_programing
end
homework_detail_manual.save if homework_detail_manual
homework_detail_programing.save if homework_detail_programing
@homework.save
@homework = HomeworkCommon.find @homework.id
@homework.student_works.each do |student_work|
set_final_score @homework,student_work
student_work.save
end
elsif params[:final_mode] && homework_detail_manual.final_mode == 0
if (params[:te_proportion] && params[:te_proportion].to_s != homework_detail_manual.te_proportion.to_s) || (params[:ta_proportion] && params[:ta_proportion].to_s != homework_detail_manual.ta_proportion.to_s) || (homework_detail_programing && homework_detail_programing.ta_proportion.to_s != params[:sy_proportion].to_s)
homework_detail_manual.te_proportion = params[:te_proportion]
homework_detail_manual.ta_proportion = params[:ta_proportion]
homework_detail_programing.ta_proportion = params[:sy_proportion] if homework_detail_programing
homework_detail_manual.save if homework_detail_manual
homework_detail_programing.save if homework_detail_programing
@homework.save
@homework = HomeworkCommon.find @homework.id
@homework.student_works.each do |student_work|
set_final_score @homework,student_work
student_work.save
end
end
end
@homework.save
@ -1322,7 +1337,6 @@ class StudentWorkController < ApplicationController
@homework.update_column('anonymous_comment', @homework.anonymous_comment == 0 ? 1 : 0)
homework_detail_programing = @homework.homework_detail_programing
if @homework.anonymous_comment == 1
homework_detail_manual.ta_proportion = @homework.homework_type == 2 ? 0.4 : 1.0
@status = 1
else
if @homework.end_time < Time.now
@ -1334,14 +1348,12 @@ class StudentWorkController < ApplicationController
homework_detail_manual.evaluation_end = homework_detail_manual.evaluation_start + 7
@status = 3
end
homework_detail_manual.ta_proportion = @homework.homework_type == 2 ? 0.3 : 0.6
end
homework_detail_manual.te_proportion = 1.0
homework_detail_manual.ta_proportion = 0
if @homework.homework_type == 2 && homework_detail_programing
if @homework.anonymous_comment == 1
homework_detail_programing.ta_proportion = 0.6
else
homework_detail_programing.ta_proportion = 0.5
end
homework_detail_programing.ta_proportion = 0
end
homework_detail_manual.save
homework_detail_programing.save if homework_detail_programing
@ -1628,11 +1640,11 @@ class StudentWorkController < ApplicationController
sheet1[count_row,10] = (@homework.teacher_priority == 1 && !homework.teacher_score.nil?) ? 0 : homework.absence_penalty
sheet1[count_row,11] = (@homework.teacher_priority == 1 && !homework.teacher_score.nil?) ? 0 : homework.late_penalty
sheet1[count_row,12] = homework.respond_to?("score") ? homework.score.nil? ? l(:label_without_score) : homework.score.round(2) : l(:label_without_score)
sheet1[count_row,13] = format_time(homework.created_at)
sheet1[count_row,13] = homework.commit_time ? format_time(homework.commit_time) : "未提交"
else
sheet1[count_row,9] = (@homework.teacher_priority == 1 && !homework.teacher_score.nil?) ? 0 : homework.late_penalty
sheet1[count_row,10] = homework.respond_to?("score") ? homework.score.nil? ? l(:label_without_score) : homework.score.round(2) : l(:label_without_score)
sheet1[count_row,11] = format_time(homework.created_at)
sheet1[count_row,11] = homework.commit_time ? format_time(homework.commit_time) : "未提交"
end
count_row += 1
end
@ -1661,11 +1673,11 @@ class StudentWorkController < ApplicationController
sheet1[count_row,11] = (@homework.teacher_priority == 1 && !homework.teacher_score.nil?) ? 0 : homework.absence_penalty
sheet1[count_row,12] = (@homework.teacher_priority == 1 && !homework.teacher_score.nil?) ? 0 : homework.late_penalty
sheet1[count_row,13] = homework.respond_to?("score") ? homework.score.nil? ? l(:label_without_score) : homework.score.round(2) : l(:label_without_score)
sheet1[count_row,14] = format_time(homework.created_at)
sheet1[count_row,14] = homework.commit_time ? format_time(homework.commit_time) : "未提交"
else
sheet1[count_row,10] = (@homework.teacher_priority == 1 && !homework.teacher_score.nil?) ? 0 : homework.late_penalty
sheet1[count_row,11] = homework.respond_to?("score") ? homework.score.nil? ? l(:label_without_score) : homework.score.round(2) : l(:label_without_score)
sheet1[count_row,12] = format_time(homework.created_at)
sheet1[count_row,12] = homework.commit_time ? format_time(homework.commit_time) : "未提交"
end
count_row += 1
end
@ -1690,11 +1702,11 @@ class StudentWorkController < ApplicationController
sheet1[count_row,7] = (@homework.teacher_priority == 1 && !homework.teacher_score.nil?) ? 0 : homework.absence_penalty
sheet1[count_row,8] = (@homework.teacher_priority == 1 && !homework.teacher_score.nil?) ? 0 : homework.late_penalty
sheet1[count_row,9] = homework.respond_to?("score") ? homework.score.nil? ? l(:label_without_score) : homework.score.round(2) : l(:label_without_score)
sheet1[count_row,10] = format_time(homework.created_at)
sheet1[count_row,10] = homework.commit_time ? format_time(homework.commit_time) : "未提交"
else
sheet1[count_row,6] = (@homework.teacher_priority == 1 && !homework.teacher_score.nil?) ? 0 : homework.late_penalty
sheet1[count_row,7] = homework.respond_to?("score") ? homework.score.nil? ? l(:label_without_score) : homework.score.round(2) : l(:label_without_score)
sheet1[count_row,8] = format_time(homework.created_at)
sheet1[count_row,8] = homework.commit_time ? format_time(homework.commit_time) : "未提交"
end
count_row += 1
end
@ -1820,60 +1832,89 @@ class StudentWorkController < ApplicationController
#成绩计算
def set_final_score homework,student_work
if homework && homework.homework_detail_manual
if homework.homework_type != 2 #非编程作业
if homework.teacher_priority == 1 #教师优先
if !homework.homework_detail_manual.final_mode
tea_ass_proportion = homework.homework_detail_manual.ta_proportion
tea_proportion = homework.homework_detail_manual.te_proportion
if homework.homework_type != 2 #非编程作业
if student_work.teacher_score
student_work.final_score = student_work.teacher_score
student_work.work_score = student_work.teacher_score - student_work.absence_penalty - student_work.late_penalty
if student_work.teaching_asistant_score.nil?
if student_work.student_score.nil?
student_work.final_score = student_work.teacher_score
else
te_proportion = tea_proportion + tea_ass_proportion / 2
final_te_score = BigDecimal.new("#{student_work.teacher_score}") * BigDecimal.new("#{te_proportion}")
final_s_score = BigDecimal.new("#{student_work.student_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{te_proportion}"))
final_score = final_te_score + final_s_score
student_work.final_score = format("%.2f",final_score.to_f)
end
else
if student_work.student_score.nil?
te_proportion = tea_proportion + (1.0 - tea_proportion - tea_ass_proportion) / 2
final_te_score = BigDecimal.new("#{student_work.teacher_score}") * BigDecimal.new("#{te_proportion}")
final_ta_score = BigDecimal.new("#{student_work.teaching_asistant_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{te_proportion}"))
final_score = final_te_score + final_ta_score
student_work.final_score = format("%.2f",final_score.to_f)
else
final_te_score = BigDecimal.new("#{student_work.teacher_score}") * BigDecimal.new("#{tea_proportion}")
final_ta_score = BigDecimal.new("#{student_work.teaching_asistant_score}") * BigDecimal.new("#{tea_ass_proportion}")
final_s_score = BigDecimal.new("#{student_work.student_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{tea_proportion}") - BigDecimal.new("#{tea_ass_proportion}"))
final_score = final_te_score + final_ta_score + final_s_score
student_work.final_score = format("%.2f",final_score.to_f)
end
end
else
if student_work.teaching_asistant_score.nil?
student_work.final_score = student_work.student_score
elsif student_work.student_score.nil?
student_work.final_score = student_work.teaching_asistant_score
else
ta_proportion = homework.homework_detail_manual.ta_proportion
ta_proportion = tea_ass_proportion + tea_proportion / 2
final_ta_score = BigDecimal.new("#{student_work.teaching_asistant_score}") * BigDecimal.new("#{ta_proportion}")
final_s_score = BigDecimal.new("#{student_work.student_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{ta_proportion}"))
final_score = final_ta_score + final_s_score
student_work.final_score = format("%.2f",final_score.to_f)
end
if student_work.final_score
score = student_work.final_score - student_work.absence_penalty - student_work.late_penalty - student_work.appeal_penalty
student_work.work_score = format("%.2f",(score < 0 ? 0 : score).to_f) if score
else
student_work.work_score = nil
end
end
else #不考虑教师评分
if student_work.teaching_asistant_score.nil?
student_work.final_score = student_work.student_score
elsif student_work.student_score.nil?
student_work.final_score = student_work.teaching_asistant_score
else
ta_proportion = homework.homework_detail_manual.ta_proportion
final_ta_score = BigDecimal.new("#{student_work.teaching_asistant_score}") * BigDecimal.new("#{ta_proportion}")
final_s_score = BigDecimal.new("#{student_work.student_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{ta_proportion}"))
final_score = final_ta_score + final_s_score
student_work.final_score = format("%.2f",final_score.to_f)
end
if student_work.final_score
score = student_work.final_score - student_work.absence_penalty - student_work.late_penalty - student_work.appeal_penalty
student_work.work_score = format("%.2f",(score < 0 ? 0 : score).to_f) if score
else
student_work.work_score = nil
end
end
elsif homework.homework_type == 2 && homework.homework_detail_programing #编程作业-----设定:系统评分必定不为空
if homework.teacher_priority == 1 #教师优先
elsif homework.homework_type == 2 && homework.homework_detail_programing #编程作业-----设定:系统评分必定不为空
#if homework.teacher_priority == 1 #教师优先
sy_proportion = homework.homework_detail_programing.ta_proportion
if student_work.teacher_score
student_work.final_score = student_work.teacher_score
student_work.work_score = student_work.teacher_score - student_work.absence_penalty - student_work.late_penalty - student_work.appeal_penalty
if student_work.teaching_asistant_score.nil? #教辅未评分
if student_work.student_score.nil?
ta_proportion = tea_proportion + (1 - tea_proportion - sy_proportion) / 2
final_te_score = BigDecimal.new("#{student_work.teacher_score}") * BigDecimal.new("#{ta_proportion}")
final_sy_score = BigDecimal.new("#{student_work.system_score || 0}") * (BigDecimal.new('1.0') - BigDecimal.new("#{ta_proportion}"))
final_score = final_sy_score + final_te_score
student_work.final_score = format("%.2f",final_score.to_f)
else
rest_proportion = tea_ass_proportion / 3
final_sy_score = BigDecimal.new("#{student_work.system_score || 0}") * BigDecimal.new("#{sy_proportion + rest_proportion}")
final_te_score = BigDecimal.new("#{student_work.teacher_score}") * BigDecimal.new("#{tea_proportion + rest_proportion}")
final_st_score = BigDecimal.new("#{student_work.student_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{sy_proportion + rest_proportion}") - BigDecimal.new("#{tea_proportion + rest_proportion}"))
final_score = final_sy_score + final_te_score + final_st_score
student_work.final_score = format("%.2f",final_score.to_f)
end
elsif student_work.student_score.nil? #学生未评分
rest_proportion = (1 - tea_proportion - sy_proportion - tea_ass_proportion) / 3
final_sy_score = BigDecimal.new("#{student_work.system_score || 0}") * BigDecimal.new("#{sy_proportion + rest_proportion}")
final_te_score = BigDecimal.new("#{student_work.teacher_score}") * BigDecimal.new("#{tea_proportion + rest_proportion}")
final_ta_score = BigDecimal.new("#{student_work.teaching_asistant_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{sy_proportion + rest_proportion}") - BigDecimal.new("#{tea_proportion + rest_proportion}"))
final_score = final_sy_score + final_te_score + final_ta_score
student_work.final_score = format("%.2f",final_score.to_f)
else
final_sy_score = BigDecimal.new("#{student_work.system_score || 0}") * BigDecimal.new("#{sy_proportion}")
final_te_score = BigDecimal.new("#{student_work.teacher_score}") * BigDecimal.new("#{tea_proportion}")
final_ta_score = BigDecimal.new("#{student_work.teaching_asistant_score}") * BigDecimal.new("#{tea_ass_proportion}")
final_s_score = BigDecimal.new("#{student_work.student_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{sy_proportion}") - BigDecimal.new("#{tea_proportion}") - BigDecimal.new("#{tea_ass_proportion}"))
final_score = final_sy_score + final_ta_score + final_te_score + final_st_score
student_work.final_score = format("%.2f",final_score.to_f)
end
else
if student_work.teaching_asistant_score.nil? #教辅未评分
if student_work.student_score.nil?
student_work.final_score = student_work.system_score
else
ta_proportion = homework.homework_detail_programing.ta_proportion + homework.homework_detail_manual.ta_proportion / 2
ta_proportion = sy_proportion + (tea_ass_proportion + tea_proportion) / 2
final_sy_score = BigDecimal.new("#{student_work.system_score || 0}") * BigDecimal.new("#{ta_proportion}")
final_st_score = BigDecimal.new("#{student_work.student_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{ta_proportion}"))
final_score = final_sy_score + final_st_score
@ -1883,62 +1924,56 @@ class StudentWorkController < ApplicationController
if student_work.teaching_asistant_score.nil?
student_work.final_score = student_work.system_score
else
ta_proportion = homework.homework_detail_programing.ta_proportion + (1.0 - homework.homework_detail_manual.ta_proportion - homework.homework_detail_programing.ta_proportion) / 2
ta_proportion = sy_proportion + (1.0 - tea_ass_proportion - sy_proportion) / 2
final_sy_score = BigDecimal.new("#{student_work.system_score || 0}") * BigDecimal.new("#{ta_proportion}")
final_ts_score = BigDecimal.new("#{student_work.teaching_asistant_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{ta_proportion}"))
final_score = final_sy_score + final_ts_score
student_work.final_score = format("%.2f",final_score.to_f)
end
else
final_sy_score = BigDecimal.new("#{student_work.system_score || 0}") * BigDecimal.new("#{homework.homework_detail_programing.ta_proportion}")
final_ts_score = BigDecimal.new("#{student_work.teaching_asistant_score}") * BigDecimal.new("#{homework.homework_detail_manual.ta_proportion}")
final_st_score = BigDecimal.new("#{student_work.student_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{homework.homework_detail_programing.ta_proportion}") - BigDecimal.new("#{homework.homework_detail_manual.ta_proportion}"))
rest_proportion = tea_proportion / 3
final_sy_score = BigDecimal.new("#{student_work.system_score || 0}") * BigDecimal.new("#{sy_proportion + rest_proportion}")
final_ts_score = BigDecimal.new("#{student_work.teaching_asistant_score}") * BigDecimal.new("#{tea_ass_proportion + rest_proportion}")
final_st_score = BigDecimal.new("#{student_work.student_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{sy_proportion + rest_proportion}") - BigDecimal.new("#{tea_ass_proportion + rest_proportion}"))
final_score = final_sy_score + final_ts_score + final_st_score
student_work.final_score = format("%.2f",final_score.to_f)
end
if student_work.final_score
score = student_work.final_score - student_work.absence_penalty - student_work.late_penalty - student_work.appeal_penalty
student_work.work_score = format("%.2f",(score < 0 ? 0 : score).to_f) if score
else
student_work.work_score = nil
end
end
else #不考虑教师评分
if student_work.teaching_asistant_score.nil? #教辅未评分
if student_work.student_score.nil?
student_work.final_score = student_work.system_score
else
ta_proportion = homework.homework_detail_programing.ta_proportion + homework.homework_detail_manual.ta_proportion / 2
final_sy_score = BigDecimal.new("#{student_work.system_score || 0}") * BigDecimal.new("#{ta_proportion}")
final_st_score = BigDecimal.new("#{student_work.student_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{ta_proportion}"))
final_score = final_sy_score + final_st_score
student_work.final_score = format("%.2f",final_score.to_f)
end
elsif student_work.student_score.nil? #学生未评分
end
else
if homework.homework_type != 2
if student_work.teacher_score
student_work.final_score = student_work.teacher_score
else
if student_work.teaching_asistant_score.nil?
student_work.final_score = student_work.system_score
student_work.final_score = student_work.student_score
else
ta_proportion = homework.homework_detail_programing.ta_proportion + (1.0 - homework.homework_detail_manual.ta_proportion - homework.homework_detail_programing.ta_proportion) / 2
final_sy_score = BigDecimal.new("#{student_work.system_score || 0}") * BigDecimal.new("#{ta_proportion}")
final_ts_score = BigDecimal.new("#{student_work.teaching_asistant_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{ta_proportion}"))
final_score = final_sy_score + final_ts_score
student_work.final_score = format("%.2f",final_score.to_f)
student_work.final_score = student_work.teaching_asistant_score
end
else
final_sy_score = BigDecimal.new("#{student_work.system_score || 0}") * BigDecimal.new("#{homework.homework_detail_programing.ta_proportion}")
final_ts_score = BigDecimal.new("#{student_work.teaching_asistant_score}") * BigDecimal.new("#{homework.homework_detail_manual.ta_proportion}")
final_st_score = BigDecimal.new("#{student_work.student_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{homework.homework_detail_programing.ta_proportion}") - BigDecimal.new("#{homework.homework_detail_manual.ta_proportion}"))
final_score = final_sy_score + final_ts_score + final_st_score
student_work.final_score = format("%.2f",final_score.to_f)
end
if student_work.final_score
score = student_work.final_score - student_work.absence_penalty - student_work.late_penalty - student_work.appeal_penalty
student_work.work_score = format("%.2f",(score < 0 ? 0 : score).to_f) if score
elsif homework.homework_type == 2 && homework.homework_detail_programing
if student_work.teacher_score
student_work.final_score = student_work.teacher_score
else
student_work.work_score = nil
if student_work.teaching_asistant_score
student_work.final_score = student_work.teaching_asistant_score
else
if student_work.system_score
student_work.final_score = student_work.system_score
else
student_work.final_score = student_work.student_score
end
end
end
end
if student_work.final_score
score = student_work.final_score - student_work.absence_penalty - student_work.late_penalty - student_work.appeal_penalty
student_work.work_score = format("%.2f",(score < 0 ? 0 : score).to_f) if score
else
student_work.work_score = nil
end
end
end
end
end

View File

@ -57,6 +57,13 @@ class SyllabusesController < ApplicationController
end
def delete_syllabus
if @syllabus.courses.empty?
@status = 1
elsif @syllabus.courses.not_deleted.empty?
@status = 2
else
@status = 3
end
respond_to do |format|
format.js
end

View File

@ -1408,11 +1408,9 @@ class UsersController < ApplicationController
render_attachment_warning_if_needed(homework)
homework_detail_manual = HomeworkDetailManual.new
if homework.anonymous_comment == 1
homework_detail_manual.ta_proportion = homework.homework_type == 2 ? 0.4 : 1.0
else
homework_detail_manual.ta_proportion = homework.homework_type == 2 ? 0.3 : 0.6
end
homework_detail_manual.te_proportion = 1.0
homework_detail_manual.ta_proportion = 0
if params[:homework_common][:end_time] == ""
homework_detail_manual.comment_status = 0
else
@ -1446,11 +1444,7 @@ class UsersController < ApplicationController
if homework.homework_type == 2
homework_detail_programing = HomeworkDetailPrograming.new
homework.homework_detail_programing = homework_detail_programing
if homework.anonymous_comment == 1
homework_detail_programing.ta_proportion = 0.6
else
homework_detail_programing.ta_proportion = 0.5
end
homework_detail_programing.ta_proportion = 0
homework_detail_programing.language = params[:language_type].to_i
sample_inputs = params[:sample][:input]

View File

@ -51,6 +51,36 @@ module ApplicationHelper
(User.current.id == applied_message.user_id && applied_message.status == 0) ? true : false
end
# 课程某个班级的成员
def syllabus_course_member user, course
result = false
syllabus = course.syllabus
if syllabus
syllabus.courses.each do |course|
if user.member_of_course?(course)
result = true
return result
end
end
end
result
end
# 课程某个班级的教师
def syllabus_course_teacher user, course
result = false
syllabus = course.syllabus
if syllabus
syllabus.courses.each do |course|
if user.allowed_to?(:as_teacher,course)
result = true
return result
end
end
end
result
end
# 获取竞赛的管理人员
def contest_managers contest
contest.contest_members.select{|cm| cm.roles.to_s.include?("ContestManager")}
@ -3038,8 +3068,8 @@ module ApplicationHelper
#获取课程资源的TAG云
def get_course_tag_list course
all_attachments = course.attachments.select{|attachment| attachment.is_public? ||
(attachment.container_type == "Course" && User.current.member_of_course?(course))||
all_attachments = Attachment.where(:container_type => 'Course', :container_id => course.syllabus.courses.map(&:id)).select{|attachment| attachment.is_public? ||
(attachment.container_type == "Course" && syllabus_course_member(User.current, Course.find(attachment.container_id)))||
attachment.author_id == User.current.id
}
tag_list = attachment_tag_list all_attachments
@ -4135,7 +4165,7 @@ def create_works_list homework
end
def add_to_homework_bank_f homework
homework_bank = HomeworkBank.new(:name => homework.name, :description => homework.description, :user_id => homework.user_id, :homework_type => homework.homework_type,
homework_bank = HomeworkBank.new(:name => homework.name, :description => homework.description, :user_id => User.current.id, :homework_type => homework.homework_type,
:quotes => 1, :is_public => homework.course.is_public, :applicable_syllabus => homework.course.syllabus.title, :homework_common_id => homework.id)
if homework.homework_type == 2 && homework.homework_detail_programing
homework_bank.language = homework.homework_detail_programing.language

View File

@ -812,8 +812,9 @@ module CoursesHelper
def visable_attachemnts_incourse course
return[] unless course
result = []
course.attachments.each do |attachment|
if attachment.is_public? && attachment.is_publish == 1 || User.current == attachment.author || User.current.allowed_to?(:as_teacher,course) || (User.current.member_of_course?(course) && attachment.is_publish == 1) || User.current.admin?
attachments = Attachment.where(:container_type => 'Course', :container_id => course.syllabus.courses.map(&:id))
attachments.each do |attachment|
if attachment.is_public? && attachment.is_publish == 1 || User.current == attachment.author || syllabus_course_teacher(User.current, Course.find(attachment.container_id)) || (syllabus_course_member(User.current, Course.find(attachment.container_id)) && attachment.is_publish == 1) || User.current.admin?
result << attachment
end
end

View File

@ -118,14 +118,30 @@ module FilesHelper
result
end
# def visable_attachemnts attachments
# result = []
# attachments.each do |attachment|
# if (attachment.is_public? && attachment.container_type != "Course") ||
# (attachment.is_public? && attachment.container_type == "Course" && attachment.is_publish == 1)||
# (attachment.container_type == "Project" && User.current.member_of?(attachment.project)) ||
# (attachment.container_type == "Course" && User.current.allowed_to?(:as_teacher,Course.find(attachment.container_id)))||
# (attachment.container_type == "Course" && User.current.member_of_course?(Course.find(attachment.container_id)) && attachment.is_publish == 1)||
# attachment.author_id == User.current.id ||
# (attachment.container_type == "OrgSubfield" and User.current.member_of_org?(attachment.container.organization))
# result << attachment
# end
# end
# result
# end
def visable_attachemnts attachments
result = []
attachments.each do |attachment|
if (attachment.is_public? && attachment.container_type != "Course") ||
(attachment.is_public? && attachment.container_type == "Course" && attachment.is_publish == 1)||
(attachment.container_type == "Project" && User.current.member_of?(attachment.project)) ||
(attachment.container_type == "Course" && User.current.allowed_to?(:as_teacher,Course.find(attachment.container_id)))||
(attachment.container_type == "Course" && User.current.member_of_course?(Course.find(attachment.container_id)) && attachment.is_publish == 1)||
(attachment.container_type == "Course" && syllabus_course_teacher(User.current, Course.find(attachment.container_id)))||
(attachment.container_type == "Course" && syllabus_course_member(User.current, Course.find(attachment.container_id)) && attachment.is_publish == 1)||
attachment.author_id == User.current.id ||
(attachment.container_type == "OrgSubfield" and User.current.member_of_org?(attachment.container.organization))
result << attachment

View File

@ -8,15 +8,25 @@ class Exercise < ActiveRecord::Base
has_many :users, :through => :exercise_users #该测试被哪些用户提交答案过
# 课程消息
has_many :course_messages, :class_name =>'CourseMessage', :as => :course_message, :dependent => :destroy
after_create :acts_as_course_message
after_save :acts_as_course_message
def acts_as_course_message
if self.course
if self.exercise_status == 2 #未发布
if self.exercise_status == 2 && self.course_messages.where(:status => 2).blank? #已发布
self.delay.send_exercise_message_delay
#self.course.members.each do |m|
self.course_messages << CourseMessage.create(:user_id => User.current.id, :course_id => self.course_id, :viewed => false,:status=>2)
#self.course_messages << CourseMessage.create(:user_id => User.current.id, :course_id => self.course_id, :viewed => false,:status=>2)
#end
# else
# self.course_messages.destroy_all 这里的destory_all值得商榷。因为我这里是通过status来控制不同的status的
else
#self.course_messages.destroy_all #这里的destory_all值得商榷。因为我这里是通过status来控制不同的status的
end
end
end
#测验通知delay
def send_exercise_message_delay
self.course.members.each do |m|
if m.user_id != self.user_id
self.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => self.course_id, :viewed => false ,:status=>2)
end
end
end

View File

@ -33,18 +33,50 @@ class HomeworkCommon < ActiveRecord::Base
:description => :description,
:author => :author,
:url => Proc.new {|o| {:controller => 'student_work', :action => 'index', :homework => o.id}}
after_create :act_as_activity, :act_as_course_message
after_create :act_as_activity, :act_as_course_message, :delay_homework_send
after_update :update_activity
after_save :act_as_course_activity
after_destroy :delete_kindeditor_assets
before_destroy :update_homework_bank_quotes
before_destroy :update_homework_bank_quotes, :update_course_statistics
#删除时更新题库中的引用数
def update_homework_bank_quotes
old_banks = HomeworkBank.where(:homework_common_id => self.id)
old_banks = HomeworkBank.where(:id => self.homework_bank_id)
unless old_banks.blank?
old_banks.each do |bank|
bank.update_attributes(:quotes => (bank.quotes - 1) > 0 ? (bank.quotes - 1) : 0, :homework_common_id => nil)
old_banks.first.update_attributes(:quotes => (old_banks.first.quotes - 1) > 0 ? (old_banks.first.quotes - 1) : 0, :homework_common_id => nil)
end
HomeworkBank.where(:homework_common_id => self.id).update_all(:homework_common_id => nil)
end
#更新CourseHomeworkStatistics中每个学生的未交作品数、已交作品数、迟交作品数
def update_course_statistics
course = self.course
hw_count = course.homework_commons.includes(:homework_detail_manual).where("homework_detail_manuals.comment_status > 0").count
homework_ids = course.homework_commons.includes(:homework_detail_manual).where("homework_detail_manuals.comment_status > 0").empty? ? "(-1)" : "(" + course.homework_commons.includes(:homework_detail_manual).where("homework_detail_manuals.comment_status > 0").map{|hw| hw.id}.join(",") + ")"
student_works = StudentWork.where("homework_common_id in #{homework_ids} and work_status !=0")
is_eva_homeworks = course.homework_commons.includes(:homework_detail_manual).where("homework_commons.anonymous_comment = 0 and homework_detail_manuals.comment_status = 2")
is_eva_student_works = StudentWork.where(:homework_common_id => is_eva_homeworks.map{|hw| hw.id})
has_eva_homeworks = course.homework_commons.includes(:homework_detail_manual).where("homework_commons.anonymous_comment = 0 and homework_detail_manuals.comment_status = 3")
has_eva_student_works = StudentWork.where(:homework_common_id => has_eva_homeworks.map{|hw| hw.id})
course.student.each do |student|
user = student.student
course_statistics = CourseHomeworkStatistics.find_by_course_id_and_user_id(course.id, student.student_id)
if user && course_statistics
committed_work_num = user.student_works.where("homework_common_id in #{homework_ids} and work_status != 0").count
un_commit_work_num = (hw_count - committed_work_num) < 0 ? 0 : (hw_count - committed_work_num)
late_commit_work_num = user.student_works.where("homework_common_id in #{homework_ids} and work_status = 2").count
absence_evaluation_work_num = user.student_works_evaluation_distributions.where(:student_work_id => has_eva_student_works.map(&:id)).count -
user.student_works_scores.where(:reviewer_role => 3, :student_work_id => has_eva_student_works.map(&:id)).group_by(&:student_work_id).count
absence_evaluation_work_num = absence_evaluation_work_num < 0 ? 0 : absence_evaluation_work_num
un_evaluation_work_num = user.student_works_evaluation_distributions.where(:student_work_id => is_eva_student_works.map(&:id)).count -
user.student_works_scores.where(:reviewer_role => 3, :student_work_id => is_eva_student_works.map(&:id)).group_by(&:student_work_id).count
un_evaluation_work_num = un_evaluation_work_num < 0 ? 0 : un_evaluation_work_num
appeal_num = user.student_works_scores.where(:student_work_id => student_works.map(&:id), :appeal_status => 3).count
average_score = user.student_works.where(:id => student_works.map(&:id)).select("AVG(student_works.work_score) as score").first ? user.student_works.where(:id => student_works.map(&:id)).select("AVG(student_works.work_score) as score").first.score : 0
total_score = user.student_works.where(:id => student_works.map(&:id)).select("SUM(student_works.work_score) as score").first ? user.student_works.where(:id => student_works.map(&:id)).select("SUM(student_works.work_score) as score").first.score : 0
course_statistics.update_attributes(:committed_work_num => committed_work_num, :un_commit_work_num => un_commit_work_num,
:late_commit_work_num => late_commit_work_num, :absence_evaluation_work_num => absence_evaluation_work_num, :un_evaluation_work_num => un_evaluation_work_num,
:appeal_num => appeal_num, :average_score => average_score, :total_score => total_score)
end
end
end
@ -103,11 +135,57 @@ class HomeworkCommon < ActiveRecord::Base
# end
# # end
# end
self.delay.send_homework_wechat_message_delay
self.delay.homework_wechat_message
end
end
end
def homework_wechat_message
self.course.members.each do |m|
rolesids = []
m.roles.each do |role|
rolesids << role.id
end
if rolesids.include?(10)
count = ShieldWechatMessage.where("container_type='User' and container_id=#{m.user_id} and shield_type='Course' and shield_id=#{self.course_id}").count
if count == 0
ws = WechatService.new
name = self.course.syllabus.nil? ? self.course.name : self.course.syllabus.title+""+self.course.name
ws.homework_message_notice(m.user_id, "homework", self.id, "#{m.user.show_name}#{l(:label_new_homework_template)}", name, "新作业:"+ self.name.html_safe, "作业内容请点击“详情”查看。")
end
end
# end
end
end
def delay_homework_send
if self.course
vs = []
self.course.members.each do | m|
if m.user_id != self.user_id
vs << {course_message_type:'HomeworkCommon',course_message_id:self.id, :user_id => m.user_id,
:course_id => self.course_id, :viewed => false}
#delayed_job卡住的原因是一次执行的条数太多导致超时。
#现在把每次只执行不超过30条就不会超了。
if vs.size >= 30
self.delay.contain_homework_message(vs)
vs.clear
end
end
end
unless vs.empty?
self.delay.contain_homework_message(vs)
end
end
end
def contain_homework_message(vs)
CourseMessage.create(vs)
end
#作业微信通知delay
def send_homework_wechat_message_delay
self.course.members.each do |m|

View File

@ -1,7 +1,7 @@
#手动评分作业表
#comment_status: 1:未开启匿评2开启匿评3匿评结束
class HomeworkDetailManual < ActiveRecord::Base
attr_accessible :ta_proportion, :comment_status, :evaluation_start, :evaluation_end, :evaluation_num, :absence_penalty, :homework_common_id, :no_anon_penalty
attr_accessible :te_proportion, :ta_proportion, :comment_status, :evaluation_start, :evaluation_end, :evaluation_num, :absence_penalty, :homework_common_id, :no_anon_penalty, :ta_mode, :final_mode
belongs_to :homework_common
end

View File

@ -57,15 +57,32 @@ class Poll < ActiveRecord::Base
def act_as_course_message
if self.polls_type == "Course"
if self.polls_status == 2 #问卷是发布状态
vs = []
Course.find(self.polls_group_id).members.each do |m|
if m.user_id != self.user_id
self.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => self.polls_group_id, :viewed => false)
vs << {course_message_type:'Poll',course_message_id:self.id, :user_id => m.user_id,
:course_id => self.polls_group_id, :viewed => false}
#delayed_job卡住的原因是一次执行的条数太多导致超时。
#现在把每次只执行不超过30条就不会超了。
if vs.size >= 30
self.delay.contain_poll_message(vs)
vs.clear
end
end
end
unless vs.empty?
self.delay.contain_poll_message(vs)
end
elsif self.polls_status == 1 #问卷是新建状态
self.course_messages.destroy_all
end
end
end
def contain_poll_message(vs)
CourseMessage.create(vs)
end
end

View File

@ -50,62 +50,89 @@ class StudentWork < ActiveRecord::Base
#成绩计算
def set_final_score homework,student_work
if homework && homework.homework_detail_manual
if homework.homework_type != 2 #非编程作业
if homework.teacher_priority == 1 #教师优先
if !homework.homework_detail_manual.final_mode
tea_ass_proportion = homework.homework_detail_manual.ta_proportion
tea_proportion = homework.homework_detail_manual.te_proportion
if homework.homework_type != 2 #非编程作业
if student_work.teacher_score
student_work.final_score = student_work.teacher_score
student_work.work_score = student_work.teacher_score - student_work.absence_penalty - student_work.late_penalty - student_work.appeal_penalty
if student_work.teaching_asistant_score.nil?
if student_work.student_score.nil?
student_work.final_score = student_work.teacher_score
else
te_proportion = tea_proportion + tea_ass_proportion / 2
final_te_score = BigDecimal.new("#{student_work.teacher_score}") * BigDecimal.new("#{te_proportion}")
final_s_score = BigDecimal.new("#{student_work.student_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{te_proportion}"))
final_score = final_te_score + final_s_score
student_work.final_score = format("%.2f",final_score.to_f)
end
else
if student_work.student_score.nil?
te_proportion = tea_proportion + (1.0 - tea_proportion - tea_ass_proportion) / 2
final_te_score = BigDecimal.new("#{student_work.teacher_score}") * BigDecimal.new("#{te_proportion}")
final_ta_score = BigDecimal.new("#{student_work.teaching_asistant_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{te_proportion}"))
final_score = final_te_score + final_ta_score
student_work.final_score = format("%.2f",final_score.to_f)
else
final_te_score = BigDecimal.new("#{student_work.teacher_score}") * BigDecimal.new("#{tea_proportion}")
final_ta_score = BigDecimal.new("#{student_work.teaching_asistant_score}") * BigDecimal.new("#{tea_ass_proportion}")
final_s_score = BigDecimal.new("#{student_work.student_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{tea_proportion}") - BigDecimal.new("#{tea_ass_proportion}"))
final_score = final_te_score + final_ta_score + final_s_score
student_work.final_score = format("%.2f",final_score.to_f)
end
end
else
if student_work.teaching_asistant_score.nil?
student_work.final_score = student_work.student_score
elsif student_work.student_score.nil?
student_work.final_score = student_work.teaching_asistant_score
else
ta_proportion = homework.homework_detail_manual.ta_proportion
ta_proportion = tea_ass_proportion + tea_proportion / 2
final_ta_score = BigDecimal.new("#{student_work.teaching_asistant_score}") * BigDecimal.new("#{ta_proportion}")
final_s_score = BigDecimal.new("#{student_work.student_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{ta_proportion}"))
final_score = final_ta_score + final_s_score
student_work.final_score = format("%.2f",final_score.to_f)
end
if student_work.final_score
score = student_work.final_score - student_work.absence_penalty - student_work.late_penalty - student_work.appeal_penalty
student_work.work_score = format("%.2f",(score < 0 ? 0 : score).to_f) if score
else
student_work.work_score = nil
end
end
else #不考虑教师评分
if student_work.student_score.nil? && student_work.teaching_asistant_score.nil?
student_work.final_score = student_work.teacher_score
elsif student_work.teaching_asistant_score.nil?
student_work.final_score = student_work.student_score
elsif student_work.student_score.nil?
student_work.final_score = student_work.teaching_asistant_score
else
ta_proportion = homework.homework_detail_manual.ta_proportion
final_ta_score = BigDecimal.new("#{student_work.teaching_asistant_score}") * BigDecimal.new("#{ta_proportion}")
final_s_score = BigDecimal.new("#{student_work.student_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{ta_proportion}"))
final_score = final_ta_score + final_s_score
student_work.final_score = format("%.2f",final_score.to_f)
end
if student_work.final_score
score = student_work.final_score - student_work.absence_penalty - student_work.late_penalty - student_work.appeal_penalty
student_work.work_score = format("%.2f",(score < 0 ? 0 : score).to_f) if score
else
student_work.work_score = nil
end
end
elsif homework.homework_type == 2 && homework.homework_detail_programing #编程作业-----设定:系统评分必定不为空
if homework.teacher_priority == 1 #教师优先
elsif homework.homework_type == 2 && homework.homework_detail_programing #编程作业-----设定:系统评分必定不为空
#if homework.teacher_priority == 1 #教师优先
sy_proportion = homework.homework_detail_programing.ta_proportion
if student_work.teacher_score
student_work.final_score = student_work.teacher_score
student_work.work_score = student_work.teacher_score - student_work.absence_penalty - student_work.late_penalty - student_work.appeal_penalty
if student_work.teaching_asistant_score.nil? #教辅未评分
if student_work.student_score.nil?
ta_proportion = tea_proportion + (1 - tea_proportion - sy_proportion) / 2
final_te_score = BigDecimal.new("#{student_work.teacher_score}") * BigDecimal.new("#{ta_proportion}")
final_sy_score = BigDecimal.new("#{student_work.system_score || 0}") * (BigDecimal.new('1.0') - BigDecimal.new("#{ta_proportion}"))
final_score = final_sy_score + final_te_score
student_work.final_score = format("%.2f",final_score.to_f)
else
rest_proportion = tea_ass_proportion / 3
final_sy_score = BigDecimal.new("#{student_work.system_score || 0}") * BigDecimal.new("#{sy_proportion + rest_proportion}")
final_te_score = BigDecimal.new("#{student_work.teacher_score}") * BigDecimal.new("#{tea_proportion + rest_proportion}")
final_st_score = BigDecimal.new("#{student_work.student_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{sy_proportion + rest_proportion}") - BigDecimal.new("#{tea_proportion + rest_proportion}"))
final_score = final_sy_score + final_te_score + final_st_score
student_work.final_score = format("%.2f",final_score.to_f)
end
elsif student_work.student_score.nil? #学生未评分
rest_proportion = (1 - tea_proportion - sy_proportion - tea_ass_proportion) / 3
final_sy_score = BigDecimal.new("#{student_work.system_score || 0}") * BigDecimal.new("#{sy_proportion + rest_proportion}")
final_te_score = BigDecimal.new("#{student_work.teacher_score}") * BigDecimal.new("#{tea_proportion + rest_proportion}")
final_ta_score = BigDecimal.new("#{student_work.teaching_asistant_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{sy_proportion + rest_proportion}") - BigDecimal.new("#{tea_proportion + rest_proportion}"))
final_score = final_sy_score + final_te_score + final_ta_score
student_work.final_score = format("%.2f",final_score.to_f)
else
final_sy_score = BigDecimal.new("#{student_work.system_score || 0}") * BigDecimal.new("#{sy_proportion}")
final_te_score = BigDecimal.new("#{student_work.teacher_score}") * BigDecimal.new("#{tea_proportion}")
final_ta_score = BigDecimal.new("#{student_work.teaching_asistant_score}") * BigDecimal.new("#{tea_ass_proportion}")
final_s_score = BigDecimal.new("#{student_work.student_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{sy_proportion}") - BigDecimal.new("#{tea_proportion}") - BigDecimal.new("#{tea_ass_proportion}"))
final_score = final_sy_score + final_ta_score + final_te_score + final_st_score
student_work.final_score = format("%.2f",final_score.to_f)
end
else
if student_work.teaching_asistant_score.nil? #教辅未评分
if student_work.student_score.nil?
student_work.final_score = student_work.system_score
else
ta_proportion = homework.homework_detail_programing.ta_proportion + homework.homework_detail_manual.ta_proportion / 2
ta_proportion = sy_proportion + (tea_ass_proportion + tea_proportion) / 2
final_sy_score = BigDecimal.new("#{student_work.system_score || 0}") * BigDecimal.new("#{ta_proportion}")
final_st_score = BigDecimal.new("#{student_work.student_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{ta_proportion}"))
final_score = final_sy_score + final_st_score
@ -115,61 +142,61 @@ class StudentWork < ActiveRecord::Base
if student_work.teaching_asistant_score.nil?
student_work.final_score = student_work.system_score
else
ta_proportion = homework.homework_detail_programing.ta_proportion + (1.0 - homework.homework_detail_manual.ta_proportion - homework.homework_detail_programing.ta_proportion) / 2
ta_proportion = sy_proportion + (1.0 - tea_ass_proportion - sy_proportion) / 2
final_sy_score = BigDecimal.new("#{student_work.system_score || 0}") * BigDecimal.new("#{ta_proportion}")
final_ts_score = BigDecimal.new("#{student_work.teaching_asistant_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{ta_proportion}"))
final_score = final_sy_score + final_ts_score
student_work.final_score = format("%.2f",final_score.to_f)
end
else
final_sy_score = BigDecimal.new("#{student_work.system_score || 0}") * BigDecimal.new("#{homework.homework_detail_programing.ta_proportion}")
final_ts_score = BigDecimal.new("#{student_work.teaching_asistant_score}") * BigDecimal.new("#{homework.homework_detail_manual.ta_proportion}")
final_st_score = BigDecimal.new("#{student_work.student_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{homework.homework_detail_programing.ta_proportion}") - BigDecimal.new("#{homework.homework_detail_manual.ta_proportion}"))
rest_proportion = tea_proportion / 3
final_sy_score = BigDecimal.new("#{student_work.system_score || 0}") * BigDecimal.new("#{sy_proportion + rest_proportion}")
final_ts_score = BigDecimal.new("#{student_work.teaching_asistant_score}") * BigDecimal.new("#{tea_ass_proportion + rest_proportion}")
final_st_score = BigDecimal.new("#{student_work.student_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{sy_proportion + rest_proportion}") - BigDecimal.new("#{tea_ass_proportion + rest_proportion}"))
final_score = final_sy_score + final_ts_score + final_st_score
student_work.final_score = format("%.2f",final_score.to_f)
end
if student_work.final_score
score = student_work.final_score - student_work.absence_penalty - student_work.late_penalty - student_work.appeal_penalty
student_work.work_score = format("%.2f",(score < 0 ? 0 : score).to_f) if score
else
student_work.work_score = nil
end
end
else #不考虑教师评分
if student_work.teaching_asistant_score.nil? #教辅未评分
if student_work.student_score.nil?
student_work.final_score = student_work.system_score
else
ta_proportion = homework.homework_detail_programing.ta_proportion + homework.homework_detail_manual.ta_proportion / 2
final_sy_score = BigDecimal.new("#{student_work.system_score || 0}") * BigDecimal.new("#{ta_proportion}")
final_st_score = BigDecimal.new("#{student_work.student_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{ta_proportion}"))
final_score = final_sy_score + final_st_score
student_work.final_score = format("%.2f",final_score.to_f)
end
elsif student_work.student_score.nil? #学生未评分
end
if student_work.final_score
score = student_work.final_score - student_work.absence_penalty - student_work.late_penalty - student_work.appeal_penalty
student_work.work_score = format("%.2f",(score < 0 ? 0 : score).to_f) if score
else
student_work.work_score = nil
end
else
if homework.homework_type != 2
if student_work.teacher_score
student_work.final_score = student_work.teacher_score
else
if student_work.teaching_asistant_score.nil?
student_work.final_score = student_work.system_score
student_work.final_score = student_work.student_score
else
ta_proportion = homework.homework_detail_programing.ta_proportion + (1.0 - homework.homework_detail_manual.ta_proportion - homework.homework_detail_programing.ta_proportion) / 2
final_sy_score = BigDecimal.new("#{student_work.system_score || 0}") * BigDecimal.new("#{ta_proportion}")
final_ts_score = BigDecimal.new("#{student_work.teaching_asistant_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{ta_proportion}"))
final_score = final_sy_score + final_ts_score
student_work.final_score = format("%.2f",final_score.to_f)
student_work.final_score = student_work.teaching_asistant_score
end
else
final_sy_score = BigDecimal.new("#{student_work.system_score || 0}") * BigDecimal.new("#{homework.homework_detail_programing.ta_proportion}")
final_ts_score = BigDecimal.new("#{student_work.teaching_asistant_score}") * BigDecimal.new("#{homework.homework_detail_manual.ta_proportion}")
final_st_score = BigDecimal.new("#{student_work.student_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{homework.homework_detail_programing.ta_proportion}") - BigDecimal.new("#{homework.homework_detail_manual.ta_proportion}"))
final_score = final_sy_score + final_ts_score + final_st_score
student_work.final_score = format("%.2f",final_score.to_f)
end
if student_work.final_score
score = student_work.final_score - student_work.absence_penalty - student_work.late_penalty - student_work.appeal_penalty
student_work.work_score = format("%.2f",(score < 0 ? 0 : score).to_f) if score
elsif homework.homework_type == 2 && homework.homework_detail_programing
if student_work.teacher_score
student_work.final_score = student_work.teacher_score
else
student_work.work_score = nil
if student_work.teaching_asistant_score
student_work.final_score = student_work.teaching_asistant_score
else
if student_work.system_score
student_work.final_score = student_work.system_score
else
student_work.final_score = student_work.student_score
end
end
end
end
if student_work.final_score
score = student_work.final_score - student_work.absence_penalty - student_work.late_penalty - student_work.appeal_penalty
student_work.work_score = format("%.2f",(score < 0 ? 0 : score).to_f) if score
else
student_work.work_score = nil
end
end
end
end

View File

@ -19,7 +19,7 @@ class StudentWorksScore < ActiveRecord::Base
if self.student_work && self.student_work.user && self.student_work.homework_common.course
receiver = self.student_work.user
# 判断是第一次评阅还是更新 status:0 新建1 更新
if self.created_at == self.updated_at
if (self.updated_at - self.created_at) < 60
if self.comment.nil? && self.score
self.course_messages << CourseMessage.new(:user_id => receiver.id, :course_id => self.student_work.homework_common.course.id,
:viewed => false, :content => "作业评分:#{self.score}", :status=> false)

View File

@ -44,7 +44,7 @@ class StudentsForCourse < ActiveRecord::Base
course = self.course
user = self.student
hw_count = course.homework_commons.includes(:homework_detail_manual).where("homework_detail_manuals.comment_status > 0").count
homework_ids = course.homework_commons.empty? ? "(-1)" : "(" + course.homework_commons.map{|hw| hw.id}.join(",") + ")"
homework_ids = course.homework_commons.includes(:homework_detail_manual).where("homework_detail_manuals.comment_status > 0").empty? ? "(-1)" : "(" + course.homework_commons.includes(:homework_detail_manual).where("homework_detail_manuals.comment_status > 0").map{|hw| hw.id}.join(",") + ")"
student_works = StudentWork.where("homework_common_id in #{homework_ids} and work_status !=0")
is_eva_homeworks = course.homework_commons.includes(:homework_detail_manual).where("homework_commons.anonymous_comment = 0 and homework_detail_manuals.comment_status = 2")
is_eva_student_works = StudentWork.where(:homework_common_id => is_eva_homeworks.map{|hw| hw.id})

View File

@ -1053,6 +1053,17 @@ class User < Principal
end
end
#是否是老师(不包括助教)
def teacher_of_course(course)
member = course.members.where("user_id = #{self.id}").first
if !member.nil?
role = MemberRole.where("member_id = #{member.id} and role_id in (3, 9)")
!role.blank?
else
return false
end
end
#是否具有老师角色
def has_teacher_role(course)
member = course.members.where("user_id = #{self.id}").first

View File

@ -59,13 +59,18 @@
if($mail_correct == false){
return
}else{
// 改变邮箱地址
$.get('<%= account_change_email_path(:user_id => @user.id) %>',
{ valid: "mail",
value: document.getElementById("user_mail").value },
function (data){
$("#user_email_show").html(data.email);
hideModal();
return;
$("#user_email_show").html(data.email);
// 更改邮箱地址后,直接给用户发送邮件
$.ajax({
url: "<%= resendmail_path(:user => @user) %>"
});
hideModal();
return;
});
}
}

View File

@ -8,8 +8,8 @@
<li>检查邮箱的“订阅邮件”、“垃圾邮件”,可能会发现激活邮件。 </li>
<li>如果激活邮件已无效,请点击重新发送激活邮件按钮。</li>
<li>如果重发注册验证邮箱邮件仍然没有收到,请<a href="javascript:void(0);" class="link-blue" id="change_email">更换邮箱地址</a>,重新发送激活邮件</li>
<li>如果您始终无法收到激活邮件,请直接给我们留言:</li>
<div class="mt10">
<li>如果您始终无法收到激活邮件,请直接给我们<a href="javascript:void(0);" class="link-blue" id="leave_message">留言</a></li>
<div class="mt10 undis" id="message_box">
<textarea style="resize: none;width: 570px;" class="email_prompt_mes" placeholder="<%= l(:label_email_feedback_tips) %>"></textarea>
<div class="c1"></div>
<button class="email_sub_btn fr" onclick="leave_email_activation_message('<%= leave_email_activation_message_path(1)%>','<%= @user.id %>');">确定</button>
@ -25,6 +25,9 @@
url: "<%= change_user_email_user_path(@user) %>"
});
});
$("#leave_message").click(function(){
$("#message_box").toggle();
})
});
function resendMail(url,id)

View File

@ -18,8 +18,8 @@
<li>请注意查看邮箱中的“订阅邮件”、“垃圾邮件”可能Trustie的邮件被误杀了</li>
<li>请点击重新发送激活邮件按钮</li>
<li>如果重发注册验证邮箱邮件仍然没有收到,请<a href="javascript:void(0);" class="link-blue" id="change_email">更换邮箱地址</a>,重新发送激活邮件</li>
<li>如果您始终无法收到激活邮件,请直接给我们留言:</li>
<div class="mt10">
<li>如果您始终无法收到激活邮件,请直接给我们<a href="javascript:void(0);" class="link-blue" id="leave_message">留言</a></li>
<div class="mt10 undis" id="message_box">
<textarea style="resize: none;width: 570px;" class="email_prompt_mes" placeholder="<%= l(:label_email_feedback_tips) %>"></textarea>
<div class="c1"></div>
<button class="email_sub_btn fr" onclick="leave_email_activation_message('<%= leave_email_activation_message_path(1)%>','<%= @user.id %>');">确定</button>
@ -36,6 +36,9 @@
url: "<%= change_user_email_user_path(@user) %>"
});
});
$("#leave_message").click(function(){
$("#message_box").toggle();
})
});

View File

@ -14,6 +14,7 @@
<script>
function attachment_fresh_for_destroy(){
hideModal();
$("#curr_page").val($("#curr_page_span").html());
$(".re_search").submit();
}
</script>

View File

@ -0,0 +1,17 @@
<div id="muban_popup_box" style="width:470px;">
<div class="muban_popup_top">
<h3 class="fl">更新成功</h3>
<a href="javascript:void(0);" class="muban_icons_close fr"></a>
<div class="cl"></div>
</div>
<div style='text-align:center;font-family: "微软雅黑","宋体"' class="mt20 f14">
是否保留您设置的延期发布时间:<%= format_time @old_attachment.publish_time %>
</div>
<div style='width:164px; margin:0 auto; margin-top: 15px; text-align:center; font-family: "微软雅黑","宋体"'>
<%=link_to '取消', update_attachment_publish_time_path(@old_attachment, :status => 0),:style => 'margin-left: 25px;', :class => 'sy_btn_grey fl mr5', :remote => true%>
<%=link_to '确认', update_attachment_publish_time_path(@old_attachment, :status => 1), :class => 'sy_btn_blue fl', :remote => true%>
<div class="cl"></div>
</div>
</div>

View File

@ -0,0 +1,2 @@
hideModal();
$(".re_search").submit(); // 为了刷新

View File

@ -1,7 +1,11 @@
<% if @flag %>
hideModal();
alert('更新成功');
$(".re_search").submit(); // 为了刷新
<% if @status == 1 %>
notice_box("更新成功");
$(".re_search").submit(); // 为了刷新
<% else %>
var htmlvalue = "<%=escape_javascript(render :partial => 'update_publish_time_box') %>";
pop_box_new(htmlvalue, 470, 140);
<% end %>
<%else%>
$("#upload_file_count").html('(更新失败)');
<%end %>

View File

@ -0,0 +1,61 @@
<div class="listbox mt10">
<p class="list-h2">历史讨论区列表</p>
<div class="category">
<span class="grayTxt ">排序:</span>
<%= link_to "时间", {:controller => 'boards', :action => 'board_history', :course =>@course.id, :type => @type, :sort => @b_sort, :order => 1 }, :class => "sortTxt", :remote => true %>
<% if @type.to_i == 1 %>
<%= link_to "", {:controller => 'boards', :action => 'board_history', :course =>@course.id, :type => @type, :sort => @b_sort, :order => 1 }, :class => "#{@b_sort.to_i == 1 ? 'sortupbtn' : 'sortdownbtn'} ", :remote => true %>
<% end %>
<%= link_to "人气", {:controller => 'boards', :action => 'board_history', :course =>@course.id, :type => @type, :sort => @b_sort, :order => 2 }, :class => "sortTxt", :remote => true %>
<% if @type.to_i == 2 %>
<%= link_to "", {:controller => 'boards', :action => 'board_history', :course =>@course.id, :type => @type, :sort => @b_sort, :order => 2 }, :class => "#{@b_sort.to_i == 1 ? 'sortupbtn' : 'sortdownbtn'} ", :remote => true %>
<% end %>
<div class="cl"></div>
</div>
<div class="bloglistbox">
<% if @topics.any? %>
<% @topics.each do |activity| %>
<div class="list-file">
<div><span class="item_list fl"></span>
<% if activity.parent_id.nil? %> <!--+"(帖子标题)"-->
<%= link_to activity.subject.to_s.html_safe, User.current.logged? ? board_message_path(activity.board_id, activity) : signin_url_without_domain, :target => '_blank', :class => "list-title-normal fl" %>
<% else %>
<%= link_to activity.parent.subject.to_s.html_safe, User.current.logged? ? board_message_path(activity.board_id, activity) : signin_url_without_domain, :target => '_blank', :class => "list-title-normal f1" %>
<% end %>
<% if activity.sticky == 1 %>
<span class="fl ml10 red-cir-btn">顶</span>
<% end%>
<% if activity.locked %>
<span class="fl ml10 green-cir-btn" title="已锁定">锁</span>
<% end %>
<%# u = User.where("id=?",activity.author_id).first%>
<div class="cl"></div>
</div>
<div class="ml15 mt10">
<span class="grayTxt mr15">
发帖人:<%= link_to activity.author.show_name, user_path(activity.author), :class => "link-blue" %>
</span>
<span class="grayTxt mr15">
班级:<%= link_to activity.board.course.name, course_path(activity.board.course), :class => "link-blue" %>
</span>
<span class="grayTxt">更新:<%= format_time(activity.children.any? ? activity.children.last[:created_on] : activity[:created_on] ) %></span>
<% all_comments = []%>
<% count=Message.where("root_id = #{activity.id}").count %>
<p class="list-info fr grayTxt"><span><%= count>0 ? "#{count}" : "0" %></span><span>回复</span><span>|</span><span><%= get_praise_num(activity) > 0 ? "#{get_praise_num(activity)}" : "0" %></span><span>赞</span></p>
</div>
<div class="cl"></div>
</div>
<% end %>
<div>
<ul class="wlist" id="pages" >
<%= pagination_links_full @atta_pages, @atta_count, :per_page_links => false, :remote => @is_remote, :flag => true %>
</ul>
<div class="cl"></div>
</div>
<% else %>
<div class="icons_tishi"><img src="/images/sy/icons_smile.png" width="110" height="110" alt="" ></div>
<p class="sy_tab_con_p">没有数据可以显示!</p>
<% end %>
</div>
</div>

View File

@ -0,0 +1 @@
$("#course-boardlist").html("<%= j(render :partial => 'sy_board_history') %>");

View File

@ -22,6 +22,7 @@
<div class="cl"></div>
<div class="courseSendCancel mr15" style="float:right;"><a href="javascript:void(0);" class="sendSourceText" onclick="clickCanel();">取消</a></div>
<div class="courseSendSubmit" style="float:right;"><a href="javascript:void(0);" class="sendSourceText" onclick="clickOK()">确定</a></div>
<span class="c_red fl" id="choose_member_notice"></span>
<div class="cl"></div>
</div>
<script type="text/javascript">
@ -82,10 +83,8 @@
}
function delete_student(id) {
$("#choose_member_notice").hide();
$("#choose_student_"+id).remove();
$("#student_"+id).one("click",function choose_student() {
$("#choose_students_list").append("<li id='choose_student_"+id+"' onclick='delete_student("+id+");'>"+$("#student_"+id).html()+"</li>");
});
}
$(document).ready(function(){

View File

@ -22,13 +22,19 @@ if(lists.length > 0) {
<%# if user.id.to_i != User.current.id.to_i && (@commit_student_ids.find{|e| e.to_i == user.id.to_i}).nil? && user.contestant_of_contest?(@contest) %>
<% if user.id.to_i != User.current.id.to_i && (@commit_student_ids.find{|e| e.to_i == user.id.to_i}).nil? %>
if (str.indexOf(<%=user.id.to_s %>) < 0 && choose_str.indexOf(<%=user.id.to_s %>) < 0) {
$("#student_<%=user.id %>").one("click",function choose_student() {
var li = "<li id='choose_student_<%=user.id %>'";
<% if user.id.to_i != User.current.id.to_i %>
li += " onclick='delete_student(<%=user.id %>);'";
<% end %>
li += ">" + $("#student_<%=user.id %>").html()+"<input name='member_id[]' value='<%=user.id %>' type='hidden'/></li>";
$("#choose_students_list").append(li);
$("#student_<%=user.id %>").on("click",function choose_student() {
if($("#choose_student_<%=user.id %>").length > 0){
$("#choose_member_notice").html("该成员已添加");
$("#choose_member_notice").show();
} else{
$("#choose_member_notice").hide();
var li = "<li id='choose_student_<%=user.id %>'";
<% if user.id.to_i != User.current.id.to_i %>
li += " onclick='delete_student(<%=user.id %>);'";
<% end %>
li += ">" + $("#student_<%=user.id %>").html()+"<input name='member_id[]' value='<%=user.id %>' type='hidden'/></li>";
$("#choose_students_list").append(li);
}
});
}
<%# elsif !user.contestant_of_contest?(@contest) %>
@ -37,7 +43,15 @@ if (str.indexOf(<%=user.id.to_s %>) < 0 && choose_str.indexOf(<%=user.id.to_s %>
//}
<% else %>
if (str.indexOf(<%=user.id.to_s %>) < 0) {
$("#student_<%=user.id %>").attr("title","该成员已加入其它分组");
$("#student_<%=user.id %>").on("click",function() {
$("#choose_member_notice").html("该成员已加入其它分组");
$("#choose_member_notice").show();
});
} else{
$("#student_<%=user.id %>").on("click",function() {
$("#choose_member_notice").html("该成员已添加");
$("#choose_member_notice").show();
});
}
<% end %>
<% end %>

View File

@ -19,7 +19,7 @@
<p class="sy_tab_con_p" style="margin-bottom: 0px; padding-bottom: 100px;">尚未发布竞赛说明,敬请期待~</p>
<% else %>
<div class="description_div">
<div class="syllabuscon upload_img ke-block break_word" id="syllabus_description_<%= @contest.id %>">
<div class="syllabuscon upload_img ke-block break_word break_full_word" id="syllabus_description_<%= @contest.id %>">
<%= @contest.description.html_safe %>
</div>
<div class="mt10" style="font-weight:normal; font-size: 12px;">

View File

@ -153,7 +153,7 @@
<%= render :partial => 'exercise/total_questions_score', :locals => {:exercise => exercise, :current_score => current_score} %>
</div>
<div class="ur_buttons" style="width: 297px;">
<div class="ur_buttons" style="width: 298px;">
<%= link_to "返回", exercise_index_path(:course_id => @course.id),:class => "btn_grey_64_width" %>
<a href="javascript:void(0)" onclick="send_exercise_to_course();" class="btn_green_64_width ml10 mr10">发送</a>
<% if exercise.exercise_status == 1 %>

View File

@ -61,6 +61,7 @@
<script>
function attachment_fresh_for_destroy(){
hideModal();
$("#curr_page").val($("#curr_page_span").html());
$(".re_search").submit();
}
</script>

View File

@ -26,7 +26,7 @@
<td class="text_c"><%= history.try(:quotes).to_i %></td>
<td class="text_c"><%= format_time(history.created_on) %></td>
<td class="text_c">
<%= link_to( '删除资源', attachment_path(history.attachment, :history_id => history, :type => "history_delete"),
<%= link_to( '删除资源', attachment_path(history.attachment, :page => @curr_page, :history_id => history, :type => "history_delete"),
:remote => true,
:data => {:confirm => l(:text_are_you_sure)},
:method => :delete,
@ -41,7 +41,7 @@
<% if @attachment.container_type == "Project" %>
<%= link_to( '删除所有资源', attachment_path(@attachment, :history_delete => true), :data => {:confirm => @attachment_histories_count.to_i > 0 ? l(:text_history_are_you_sure) : l(:text_are_you_sure)}, :method => :delete,:class => "fr fontGrey2 mb5", :onclick =>"hideModal();") if (is_project_manager?(User.current.id, @attachment.container_id) || User.current.id == @attachment.author_id || User.current.admin?) %>
<% elsif @attachment.container_type == "Course" %>
<%= link_to( '删除所有资源', attachment_path(@attachment, :history_delete => true), :data => {:confirm => @attachment_histories_count.to_i > 0 ? l(:text_history_are_you_sure) : l(:text_are_you_sure)}, :method => :delete,:class => "fr fontGrey2 mb5", :onclick =>"hideModal();") if (User.current.allowed_to?(:as_teacher, @attachment.container) || User.current.id == @attachment.author_id || User.current.admin?) %>
<%= link_to( '删除所有资源', attachment_path(@attachment, :history_delete => true, :page => @curr_page), :data => {:confirm => @attachment_histories_count.to_i > 0 ? l(:text_history_are_you_sure) : l(:text_are_you_sure)}, :method => :delete,:class => "fr fontGrey2 mb5", :onclick =>"hideModal();") if (User.current.allowed_to?(:as_teacher, @attachment.container) || User.current.id == @attachment.author_id || User.current.admin?) %>
<% elsif @attachment.container_type == "OrgSubfield" %>
<%= link_to( '删除所有资源', attachment_path(@attachment, :history => true), :data => {:confirm => @attachment_histories_count.to_i > 0 ? l(:text_history_are_you_sure) : l(:text_are_you_sure)}, :method => :delete,:class => "fr fontGrey2 mb5", :onclick =>"hideModal();") if (User.current.id == @attachment.author_id || User.current.admin_of_org?(@attachment) || User.current.admin?) %>
<% end %>

View File

@ -98,6 +98,8 @@
<div class="reTop mb5">
<%= form_tag( search_course_files_path(@course), method: 'get',:class => "re_search",:remote=>true) do %>
<%= text_field_tag 'name', params[:name], name: "name", :class => 'researchBox fl',:style=>"padding: 0px"%>
<input type="hidden" name="page" id="curr_page">
<span class="none" id="curr_page_span"><%= @curr_page %></span>
<%= submit_tag "班内搜索", :class => "blueBtn mr5 fl",:name => "incourse",:id => "incourse" %>
<%#= submit_tag "全站搜索", :class => "blueBtn mr5 fl",:name => "insite",:id => "insite" %>
<% if is_course_teacher(User.current,@course) || (@course.publish_resource==1 && User.current.member_of_course?(@course) ) %>

View File

@ -82,9 +82,9 @@
<%end%>
<li>
<% if file.destroyable %>
<%= link_to( '删除资源', attachment_path(file),:data => {:confirm => l(:text_are_you_sure)}, :method => :delete,:class => "postOptionLink") if (delete_allowed || User.current.id == file.author_id) && file.container_id == @course.id && file.container_type == "Course" %>
<%= link_to( '删除资源', attachment_path(file, :page => @curr_page),:data => {:confirm => l(:text_are_you_sure)}, :method => :delete,:class => "postOptionLink") if (delete_allowed || User.current.id == file.author_id) && file.container_id == @course.id && file.container_type == "Course" %>
<% else %>
<%= link_to '删除资源',attachment_versions_delete_path(file), :class => "postOptionLink", :remote => true %>
<%= link_to '删除资源',attachment_versions_delete_path(file, :page => @curr_page), :class => "postOptionLink", :remote => true %>
<% end %>
</li>
</ul>

View File

@ -1,18 +1,19 @@
<div id="muban_popup_box" style="width:550px;">
<%= form_for('new_form',:url => {:controller => 'homework_common',:action => 'set_evaluation_attr',:homework => @homework.id,:user_activity_id=>user_activity_id,:hw_status=>hw_status},:method => "post",:remote => true) do |f|%>
<%= form_for('new_form',:url => {:controller => 'homework_common',:action => 'set_evaluation_attr',:homework => @homework.id,:user_activity_id=>user_activity_id,:hw_status=>hw_status},:method => "post",:remote => true) do |f|%>
<div class="muban_popup_top">
<h3 class="fl">匿评设置</h3>
<a href="javascript:void(0);" class="muban_icons_close fr"></a>
<div class="cl"></div>
</div>
<% not_allow_edit = @homework.homework_detail_manual.comment_status == 2 %>
<div class="muban_popup_con clear">
<div class="clear mt15 ml20">
<ul class="pro_newsetting_con fl">
<li class="mb10 clear">
<label class="fl pop_box_label">开启匿评&nbsp;&nbsp;:&nbsp;</label>
<div class="calendar_div fl">
<input type="text" name="evaluation_start" id="evaluation_start_time" placeholder="开启匿评日期" class="InputBox fl W120 calendar_input" readonly="readonly" value="<%= @homework_detail_manual.evaluation_start%>"/>
<input type="text" name="evaluation_start" id="evaluation_start_time" placeholder="开启匿评日期" class="InputBox fl W120 calendar_input" readonly="readonly" value="<%= @homework_detail_manual.evaluation_start%>"/>
<%#= calendar_for('evaluation_start_time')%>
</div>
<div class="cl"></div>
@ -29,15 +30,15 @@
</li>
<li class="mb10 clear">
<label class="fl pop_box_label">&nbsp;匿评人数&nbsp;&nbsp;:&nbsp;</label>
<input type="radio" class="fl" value="1" name="evaluation_limit" id="limit"/>
<input <%= not_allow_edit ? 'disabled' : '' %> type="radio" class="fl" value="1" name="evaluation_limit" id="limit"/>
<label for="limit" class="fl ml5">限定</label>
<input type="text" name="evaluation_num" id="evaluation_num" maxlength="2" class="radio-width90 fl ml10" value="<%= @homework_detail_manual.evaluation_num == -1 ? 3 : @homework_detail_manual.evaluation_num%>"/>
<input <%= not_allow_edit ? 'disabled' : '' %> type="text" name="evaluation_num" id="evaluation_num" maxlength="2" class="radio-width90 fl ml10" value="<%= @homework_detail_manual.evaluation_num == -1 ? 3 : @homework_detail_manual.evaluation_num%>"/>
<div class="cl"></div>
<p id="evaluation_num_notice" class="c_red ml100"></p>
</li>
<li class="mb10 clear">
<label class="fl pop_box_label">&nbsp;&nbsp;</label>
<input type="radio" class="fl" value="0" name="evaluation_limit" id="no_limit"/>
<input <%= not_allow_edit ? 'disabled' : '' %> type="radio" class="fl" value="0" name="evaluation_limit" id="no_limit"/>
<label for="no_limit" class="fl ml5">不限定</label>
</li>
</ul>
@ -67,7 +68,7 @@
<div class="alert alert-orange mb15 ml30 mr80 mt10">
注意:开启匿评时尚未提交作品的同学,将不参与匿评
</div>
<a href="javascript:void(0);" class="fr sy_btn_blue mr80" onclick="submit_set_evaluation_attr('<%= @homework.end_time%>');">确定</a>
<a href="javascript:void(0);" class="fr sy_btn_blue mr80" onclick="submit_set_evaluation_attr('<%= @homework.end_time.strftime("%Y-%m-%d")%>');">确定</a>
<a href="javascript:void(0);" class="fr sy_btn_grey mr5" onclick="hideModal();">取消</a>
</div>
</div>

View File

@ -101,39 +101,60 @@
<div class="cl"></div>
<span class="separator_long"></span>
<li class="mb10 mt10 fl">
<li class="fl mt10">
<label class="pop_box_label fl">最终得分&nbsp;&nbsp;:&nbsp;</label>
<input type="radio" class="fl" value="1" id="teacher_score" name="teacher_priority"/><label for="teacher_score" class=" fl ml5">教师评分</label>
<ul class="fl">
<li class="fl">
<input type="radio" class="fl" id="final_mode" value="0" name="final_mode"/>
<label for="final_mode" class="fl ml5">多项评分配比</label>
</li>
<div class="cl"></div>
<ul class="fl ml18">
<li class="clear">
<span class="fl">教师评分</span>
<%= select_tag :te_proportion,options_for_select(ta_proportion_option,homework.homework_detail_manual.te_proportion), {:class => "w61 fl ml15"} %>
</li>
<li class="clear mt5">
<span class="fl">助教评分</span>
<%= select_tag :ta_proportion,options_for_select(ta_proportion_option_to(100-(homework.homework_detail_manual.te_proportion * 100).to_i),homework.homework_detail_manual.ta_proportion), {:class => "w61 fl ml15"} %>
</li>
<li class="clear mt5">
<span class="fl">学生匿评</span>
<input type="text" style="width: 49px; padding-left: 10px;" id="student_proportion" value="<%= 100 - (homework.homework_detail_manual.te_proportion * 100).to_i - (homework.homework_detail_manual.ta_proportion * 100).to_i%>%" class="fl ml15" readonly>
</li>
</ul>
</ul>
</li>
<div class="fl ml20 clear popup_tip_box fontGrey2 mb10 mt10 w230" style="margin-left: 141px;">
<div class="fl ml20 clear popup_tip_box fontGrey2 mb10 mt10 w230" style="margin-left: 65px;">
<em></em>
<span></span>
<p>教师评分-迟交扣分-缺评扣分-违规匿评扣分</p>
<p>教师评分 * 其百分比 + <br/>
助教评分 * 其百分比 + <br/>
学生匿评平均分 * 其百分比 - <br/>
( 迟交扣分+缺评扣分+违规匿评扣分 ) <br/>
注意:非零百分比的评分选项,在没有评分 <br/>记录的情况下,其百分比平摊到另外的非零 <br/>评分选项上
</p>
</div>
<ul class="fl mb10">
<li class="fl">
<label class="pop_box_label fl">&nbsp;&nbsp;</label>
<input type="radio" class="fl" value="1" id="no_final_mode" name="final_mode"/><label for="no_final_mode" class="fl ml5">单项评分优先</label>
</li>
<div class="cl"></div>
<li class="fl ml18">
<label class="pop_box_label fl">&nbsp;&nbsp;</label>教师 --> 助教 --> 匿评
</li>
</ul>
<div class="fl clear popup_tip_box fontGrey2 mb10 w230" style="margin-left: 64px;">
<em></em>
<span></span>
<p>优先顺序排前的非零评分 * 100% - <br/>
(迟交扣分+缺评扣分+违规匿评扣分) <br/>
有教师评分则教师评分100%,否则 <br/>
助教评分100%,依次类推
</p>
</div>
<li class="mb10 fl">
<label class="pop_box_label fl">&nbsp;&nbsp;</label>
<ul class="fl">
<li class="clear">
<input type="radio" class="fl" id="other_score" value="0" name="teacher_priority"/>
<label for="other_score" class="fl ml5">助教评分+学生匿评</label>
</li>
<li class="clear">
<%= select_tag :ta_proportion,options_for_select(ta_proportion_option_to(100),homework.homework_detail_manual.ta_proportion), {:class => "w61 fl ml15"} %>
<span class="fl ml5">助教评分</span>
</li>
<li class="clear">
<input type="text" style="width: 49px; padding-left: 10px;" id="student_proportion" value="<%= (100 - homework.homework_detail_manual.ta_proportion * 100).to_i%>%" class="fl ml15" readonly>
<span class="fl ml5">学生匿评</span>
</li>
</ul>
<div class="fl clear popup_tip_box fontGrey2 w230" style="margin-left: 78px;">
<em></em>
<span></span>
<p >助教评分*其百分比+ <br/>
学生匿评平均分*其百分比- <br/>
( 迟交扣分+缺评扣分+违规匿评扣分 )</p>
</div>
</li>
</ul>
<div class="cl"></div>
<a href="javascript:void(0);" class="fr sy_btn_blue mr50" onclick="set_score_rule_submit();">确定</a>
@ -145,36 +166,44 @@
<script>
$(function(){
$("#ta_proportion").change(function(){
var ta_proportion = parseFloat($("#ta_proportion").val());
$("#student_proportion").val((100 - parseFloat(parseInt(ta_proportion * 100))) + "%");
$("#te_proportion").die();
$("#ta_proportion").die();
$("#te_proportion").live('change', function(){
var ta_proportion = 100 - parseInt(parseFloat($("#te_proportion").val()) * 100);
$("#ta_proportion").replaceWith(build_selector(ta_proportion));
$("#student_proportion").val("0%");
});
<% if homework.teacher_priority == 1 %>
$("#teacher_score").attr("checked", "checked");
<% else %>
$("#other_score").attr("checked", "checked");
<% end %>
$("#ta_proportion").live('change', function(){
var ta_proportion = 100 - parseInt(parseFloat($("#te_proportion").val()) * 100) - parseInt(parseFloat($("#ta_proportion").val()) * 100);
$("#student_proportion").val(ta_proportion + "%");
});
<% if homework.homework_detail_manual.ta_mode == 1 %>
$("#ta_normal_mode").attr("checked", "checked");
<% else %>
$("#ta_re_mode").attr("checked", "checked");
<% end %>
$("#teacher_score").change(function(){
if($("#teacher_score").attr("checked")){
$("#late_penalty_num").val("0");
$("#absence_penalty_num").val("0");
<% if homework.homework_detail_manual.final_mode %>
$("#no_final_mode").attr("checked", "checked");
$("#te_proportion").attr("disabled", "disabled");
$("#ta_proportion").attr("disabled", "disabled");
<% else %>
$("#final_mode").attr("checked", "checked");
<% end %>
$("#final_mode").click(function(){
if($("#final_mode").attr("checked")){
$("#te_proportion").removeAttr("disabled");
$("#ta_proportion").removeAttr("disabled");
}
});
$("#other_score").change(function(){
if($("#other_score").attr("checked")){
$("#late_penalty_num").val("10");
<% if homework.homework_detail_manual && homework.homework_detail_manual.evaluation_num == -1 %>
$("#absence_penalty_num").val("0");
<% else %>
$("#absence_penalty_num").val("5");
<% end %>
$("#no_final_mode").click(function(){
if($("#no_final_mode").attr("checked")){
$("#te_proportion").attr("disabled", "disabled");
$("#ta_proportion").attr("disabled", "disabled");
}
});
<% if homework.anonymous_appeal == 1 %>
$("#anonymous_appeal").attr("checked", "checked");
<% else %>

View File

@ -1,4 +1,4 @@
<div id="muban_popup_box" style="width:530px;">
<div id="muban_popup_box" style="width:560px;">
<div class="muban_popup_top">
<h3 class="fl">评分设置</h3>
<a href="javascript:void(0);" class="muban_icons_close fr"></a>
@ -12,7 +12,7 @@
<label class="pop_box_label fl">迟交扣分&nbsp;&nbsp;:&nbsp;</label>
<input type="text" name="late_penalty" id="late_penalty_num" placeholder="0-50" class="fl issues_calendar_input" value="<%= homework.late_penalty%>" onkeyup="check_late_penalty('late_penalty_num')"/>
</li>
<div class="fl ml20 clear popup_tip_box fontGrey2 mb10 w190">
<div class="fl ml20 clear popup_tip_box fontGrey2 mb10 w230">
<em></em>
<span></span>
<p >请输入数值0-50</p>
@ -24,7 +24,7 @@
<input type="radio" class="fl" value="1" id="ta_normal_mode" name="ta_mode"/>
<label for="ta_normal_mode" class=" fl ml5">普通模式</label>
</li>
<div class="fl clear popup_tip_box fontGrey2 mb10 w190" style="margin-left: 92px;">
<div class="fl clear popup_tip_box fontGrey2 mb10 w230" style="margin-left: 92px;">
<em></em>
<span></span>
<p >助教评分 = 各助教最新评分的平均分</p>
@ -34,36 +34,67 @@
<input type="radio" class="fl" id="ta_re_mode" value="2" name="ta_mode"/>
<label for="ta_re_mode" class="fl ml5">复审模式</label>
</li>
<div class="fl clear popup_tip_box fontGrey2 mb10 w190" style="margin-left: 92px;">
<div class="fl clear popup_tip_box fontGrey2 mb10 w230" style="margin-left: 92px;">
<em></em>
<span></span>
<p >助教评分 = 最新的助教评分</p>
</div>
<div class="cl"></div>
<span class="separator_short"></span>
<li class="mb10">
<li class="fl mt10">
<label class="pop_box_label fl">最终得分&nbsp;&nbsp;:&nbsp;</label>
<input type="radio" class="fl" value="1" id="teacher_score" name="teacher_priority"/>
<label for="teacher_score" class=" fl ml5">教师评分</label>
<ul class="fl">
<li class="fl">
<input type="radio" class="fl" id="final_mode" value="0" name="final_mode"/>
<label for="final_mode" class="fl ml5">多项评分配比</label>
</li>
<div class="cl"></div>
<ul class="fl ml18">
<li class="clear">
<span class="fl">教师评分</span>
<%= select_tag :te_proportion,options_for_select(ta_proportion_option,homework.homework_detail_manual.te_proportion), {:class => "w61 fl ml15"} %>
</li>
<li class="clear mt5">
<span class="fl">助教评分</span>
<input type="hidden" name="ta_proportion" value="<%= homework.homework_detail_manual.ta_proportion %>">
<input type="text" style="width: 49px; padding-left: 10px;" id="ta_proportion" value="<%= (homework.homework_detail_manual.ta_proportion * 100).to_i %>%" class="fl ml15" readonly>
</li>
</ul>
</ul>
</li>
<div class="fl clear popup_tip_box fontGrey2 mb10 w190" style="margin-left: 92px;">
<div class="fl ml20 clear popup_tip_box fontGrey2 mb10 mt10 w230" style="margin-left: 16px;">
<em></em>
<span></span>
<p >教师评分 - 迟交扣分 </p>
<p>教师评分 * 其百分比 + <br/>
助教评分 * 其百分比 - <br/>
迟交扣分 <br/>
注意:非零百分比的评分选项,在没有评分 <br/>记录的情况下,其百分比平摊到另外的非零 <br/>评分选项上
</p>
</div>
<li class="mb10">
<label class="pop_box_label fl">&nbsp;&nbsp;</label>
<input type="radio" class="fl" id="other_score" value="0" name="teacher_priority"/>
<label for="other_score" class="fl ml5">助教评分</label>
</li>
<div class="fl clear popup_tip_box fontGrey2 mb10 w190" style="margin-left: 92px;">
<ul class="fl mb10">
<li class="fl">
<label class="pop_box_label fl">&nbsp;&nbsp;</label>
<input type="radio" class="fl" value="1" id="no_final_mode" name="final_mode"/><label for="no_final_mode" class="fl ml5">单项评分优先</label>
</li>
<div class="cl"></div>
<li class="fl ml18">
<label class="pop_box_label fl">&nbsp;&nbsp;</label>教师 --> 助教
</li>
</ul>
<div class="fl clear popup_tip_box fontGrey2 mb10 w230" style="margin-left: 66px;">
<em></em>
<span></span>
<p >助教评分 - 迟交扣分 </p>
<p>优先顺序排前的非零评分 * 100% - <br/>
迟交扣分 <br/>
有教师评分则教师评分100%,否则 <br/>
助教评分100%,依次类推
</p>
</div>
</ul>
<div class="cl"></div>
<a href="javascript:void(0);" class="fr sy_btn_blue mr40" onclick="set_score_rule_submit();">确定</a>
<a href="javascript:void(0);" class="fr sy_btn_blue mr30" onclick="set_score_rule_submit();">确定</a>
<a href="javascript:void(0);" class="fr sy_btn_grey mr5" onclick="hideModal();">取消</a>
</div>
</div>
@ -72,24 +103,36 @@
<script>
$(function(){
<% if homework.teacher_priority == 1 %>
$("#teacher_score").attr("checked", "checked");
<% else %>
$("#other_score").attr("checked", "checked");
<% end %>
$("#te_proportion").die();
$("#te_proportion").live('change', function(){
var ta_proportion = 100 - parseInt(parseFloat($("#te_proportion").val()) * 100);
$("#ta_proportion").val(ta_proportion + "%");
$("input[name='ta_proportion']").val(ta_proportion/100);
});
<% if homework.homework_detail_manual.ta_mode == 1 %>
$("#ta_normal_mode").attr("checked", "checked");
<% else %>
$("#ta_re_mode").attr("checked", "checked");
<% end %>
$("#teacher_score").change(function(){
if($("#teacher_score").attr("checked")){
$("#late_penalty_num").val("0");
<% if homework.homework_detail_manual.final_mode %>
$("#no_final_mode").attr("checked", "checked");
$("#te_proportion").attr("disabled", "disabled");
$("#ta_proportion").attr("disabled", "disabled");
<% else %>
$("#final_mode").attr("checked", "checked");
<% end %>
$("#final_mode").click(function(){
if($("#final_mode").attr("checked")){
$("#te_proportion").removeAttr("disabled");
$("#ta_proportion").removeAttr("disabled");
}
});
$("#other_score").change(function(){
if($("#other_score").attr("checked")){
$("#late_penalty_num").val("10");
$("#no_final_mode").click(function(){
if($("#no_final_mode").attr("checked")){
$("#te_proportion").attr("disabled", "disabled");
$("#ta_proportion").attr("disabled", "disabled");
}
});
});

View File

@ -101,90 +101,123 @@
<div class="cl"></div>
<span class="separator_long"></span>
<li class="mb10 mt10 fl">
<li class="fl mt10">
<label class="pop_box_label fl">最终得分&nbsp;&nbsp;:&nbsp;</label>
<input type="radio" class="fl" value="1" id="teacher_score" name="teacher_priority"/><label for="teacher_score" class=" fl ml5">教师评分</label>
<ul class="fl">
<li class="fl">
<input type="radio" class="fl" id="final_mode" value="0" name="final_mode"/>
<label for="final_mode" class="fl ml5">多项评分配比</label>
</li>
<div class="cl"></div>
<ul class="fl ml18">
<li class="clear">
<span class="fl">教师评分</span>
<%= select_tag :te_proportion,options_for_select(ta_proportion_option,homework.homework_detail_manual.te_proportion), {:class => "w61 fl ml15"} %>
</li>
<li class="clear mt5">
<span class="fl">助教评分</span>
<%= select_tag :ta_proportion,options_for_select(ta_proportion_option_to(100-(homework.homework_detail_manual.te_proportion * 100).to_i),homework.homework_detail_manual.ta_proportion), {:class => "w61 fl ml15"} %>
</li>
<li class="clear mt5">
<span class="fl">系统评分</span>
<%= select_tag :sy_proportion,options_for_select(ta_proportion_option_to(100-(homework.homework_detail_manual.te_proportion * 100).to_i-(homework.homework_detail_manual.ta_proportion * 100).to_i),homework.homework_detail_programing.ta_proportion), {:class => "w61 fl ml15"} %>
</li>
<li class="clear mt5">
<span class="fl">学生匿评</span>
<input type="text" style="width: 49px; padding-left: 10px;" id="student_proportion" value="<%= 100 - (homework.homework_detail_manual.te_proportion * 100).to_i - (homework.homework_detail_manual.ta_proportion * 100).to_i - (homework.homework_detail_programing.ta_proportion * 100).to_i%>%" class="fl ml15" readonly>
</li>
</ul>
</ul>
</li>
<div class="fl ml20 clear popup_tip_box fontGrey2 mb10 mt10 w230" style="margin-left: 141px;">
<div class="fl ml20 clear popup_tip_box fontGrey2 mb10 mt10 w230" style="margin-left: 65px;">
<em></em>
<span></span>
<p>教师评分-迟交扣分-缺评扣分-违规匿评扣分</p>
<p>教师评分 * 其百分比 + <br/>
助教评分 * 其百分比 + <br/>
系统评分 * 其百分比 + <br/>
学生匿评平均分 * 其百分比 - <br/>
( 迟交扣分+缺评扣分+违规匿评扣分 ) <br/>
注意:非零百分比的评分选项,在没有评分 <br/>记录的情况下,其百分比平摊到另外的非零 <br/>评分选项上
</p>
</div>
<ul class="fl mb10">
<li class="fl">
<label class="pop_box_label fl">&nbsp;&nbsp;</label>
<input type="radio" class="fl" value="1" id="no_final_mode" name="final_mode"/><label for="no_final_mode" class="fl ml5">单项评分优先</label>
</li>
<div class="cl"></div>
<li class="fl ml18">
<label class="pop_box_label fl">&nbsp;&nbsp;</label>教师 --> 助教 --> 系统 --> 匿评
</li>
</ul>
<div class="fl clear popup_tip_box fontGrey2 mb10 w230" style="margin-left: 14px;">
<em></em>
<span></span>
<p>优先顺序排前的非零评分 * 100% - <br/>
(迟交扣分+缺评扣分+违规匿评扣分) <br/>
有教师评分则教师评分100%,否则 <br/>
助教评分100%,依次类推
</p>
</div>
<li class="mb10 fl">
<label class="pop_box_label fl">&nbsp;&nbsp;</label>
<ul class="fl">
<li class="clear">
<input type="radio" class="fl" id="other_score" value="0" name="teacher_priority"/>
<label for="other_score" class="fl ml5">系统评分+助教评分+学生匿评</label>
</li>
<li class="clear">
<%= select_tag :sy_proportion,options_for_select(ta_proportion_option,homework.homework_detail_programing.ta_proportion), {:class => "w61 fl ml15"} %>
<span class="fl ml5">系统评分</span>
</li>
<li class="clear">
<%= select_tag :ta_proportion,options_for_select(ta_proportion_option_to(100-(homework.homework_detail_programing.ta_proportion * 100).to_i),homework.homework_detail_manual.ta_proportion), {:class => "w61 fl ml15"} %>
<span class="fl ml5">助教评分</span>
</li>
<li class="clear">
<input type="text" style="width: 49px; padding-left: 10px;" id="student_proportion" value="<%= (100 - homework.homework_detail_manual.ta_proportion * 100).to_i - (homework.homework_detail_programing.ta_proportion * 100).to_i%>" class="fl ml15" readonly>
<span class="fl ml5">学生匿评</span>
</li>
</ul>
<div class="fl clear popup_tip_box fontGrey2 w230" style="margin-left: 27px;">
<em></em>
<span></span>
<p>系统评分*其百分比+ <br/>
助教评 *其百分比+ <br/>
学生匿评平均分*其百分比 - <br/>
( 迟交扣分+缺评扣分+违规匿评扣分 )</p>
</div>
</li>
</ul>
<div class="cl"></div>
<a href="javascript:void(0);" class="fr sy_btn_blue mr50" onclick="set_score_rule_submit();">确定</a>
<a href="javascript:void(0);" class="fr sy_btn_grey mr5" onclick="hideModal();">取消</a>
</div>
</div>
<% end%>
</div>
<script>
$(function(){
$("#sy_proportion").live('change', function(){
var ta_proportion = 100 - parseInt(parseFloat($("#sy_proportion").val()) * 100);
$("#te_proportion").die();
$("#ta_proportion").die();
$("#sy_proportion").die();
$("#te_proportion").live('change', function(){
var ta_proportion = 100 - parseInt(parseFloat($("#te_proportion").val()) * 100);
$("#ta_proportion").replaceWith(build_selector(ta_proportion));
$("#sy_proportion").replaceWith(build_selector_sy(0));
$("#student_proportion").val("0%");
});
$("#ta_proportion").live("change",function(){
var ta_proportion = 100 - parseInt(parseFloat($("#sy_proportion").val()) * 100) - parseInt(parseFloat($("#ta_proportion").val()) * 100);
$("#student_proportion").val(ta_proportion + "%");
var sy_proportion = 100 - parseInt(parseFloat($("#te_proportion").val()) * 100) - parseInt(parseFloat($("#ta_proportion").val()) * 100);
$("#sy_proportion").replaceWith(build_selector_sy(sy_proportion));
$("#student_proportion").val("0%");
});
<% if homework.teacher_priority == 1 %>
$("#teacher_score").attr("checked", "checked");
<% else %>
$("#other_score").attr("checked", "checked");
<% end %>
$("#sy_proportion").live("change",function(){
var sy_proportion = 100 - parseInt(parseFloat($("#te_proportion").val()) * 100) - parseInt(parseFloat($("#ta_proportion").val()) * 100) - parseInt(parseFloat($("#sy_proportion").val()) * 100);
$("#student_proportion").val(sy_proportion + "%");
});
<% if homework.homework_detail_manual.ta_mode == 1 %>
$("#ta_normal_mode").attr("checked", "checked");
<% else %>
$("#ta_re_mode").attr("checked", "checked");
<% end %>
$("#teacher_score").change(function(){
if($("#teacher_score").attr("checked")){
$("#late_penalty_num").val("0");
$("#absence_penalty_num").val("0");
<% if homework.homework_detail_manual.final_mode %>
$("#no_final_mode").attr("checked", "checked");
$("#te_proportion").attr("disabled", "disabled");
$("#ta_proportion").attr("disabled", "disabled");
$("#sy_proportion").attr("disabled", "disabled");
<% else %>
$("#final_mode").attr("checked", "checked");
<% end %>
$("#final_mode").click(function(){
if($("#final_mode").attr("checked")){
$("#te_proportion").removeAttr("disabled");
$("#ta_proportion").removeAttr("disabled");
$("#sy_proportion").removeAttr("disabled");
}
});
$("#other_score").change(function(){
if($("#other_score").attr("checked")){
$("#late_penalty_num").val("10");
<% if homework.homework_detail_manual && homework.homework_detail_manual.evaluation_num == -1 %>
$("#absence_penalty_num").val("0");
<% else %>
$("#absence_penalty_num").val("5");
<% end %>
$("#no_final_mode").click(function(){
if($("#no_final_mode").attr("checked")){
$("#te_proportion").attr("disabled", "disabled");
$("#ta_proportion").attr("disabled", "disabled");
$("#sy_proportion").attr("disabled", "disabled");
}
});
<% if homework.anonymous_appeal == 1 %>
$("#anonymous_appeal").attr("checked", "checked");
<% else %>

View File

@ -1,4 +1,4 @@
<div id="muban_popup_box" style="width:530px;">
<div id="muban_popup_box" style="width:560px;">
<div class="muban_popup_top">
<h3 class="fl">评分设置</h3>
<a href="javascript:void(0);" class="muban_icons_close fr"></a>
@ -12,7 +12,7 @@
<label class="pop_box_label fl">迟交扣分&nbsp;&nbsp;:&nbsp;</label>
<input type="text" name="late_penalty" id="late_penalty_num" placeholder="0-50" class="fl issues_calendar_input" value="<%= homework.late_penalty%>" onkeyup="check_late_penalty('late_penalty_num')"/>
</li>
<div class="fl ml20 clear popup_tip_box fontGrey2 mb10 w190">
<div class="fl ml20 clear popup_tip_box fontGrey2 mb10 w230">
<em></em>
<span></span>
<p >请输入数值0-50</p>
@ -24,7 +24,7 @@
<input type="radio" class="fl" value="1" id="ta_normal_mode" name="ta_mode"/>
<label for="ta_normal_mode" class=" fl ml5">普通模式</label>
</li>
<div class="fl clear popup_tip_box fontGrey2 mb10 w190" style="margin-left: 92px;">
<div class="fl clear popup_tip_box fontGrey2 mb10 w230" style="margin-left: 92px;">
<em></em>
<span></span>
<p >助教评分 = 各助教最新评分的平均分</p>
@ -34,49 +34,72 @@
<input type="radio" class="fl" id="ta_re_mode" value="2" name="ta_mode"/>
<label for="ta_re_mode" class="fl ml5">复审模式</label>
</li>
<div class="fl clear popup_tip_box fontGrey2 mb10 w190" style="margin-left: 92px;">
<div class="fl clear popup_tip_box fontGrey2 mb10 w230" style="margin-left: 92px;">
<em></em>
<span></span>
<p >助教评分 = 最新的助教评分</p>
</div>
<div class="cl"></div>
<span class="separator_short"></span>
<li class="mb10 fl">
<li class="fl mt10">
<label class="pop_box_label fl">最终得分&nbsp;&nbsp;:&nbsp;</label>
<input type="radio" class="fl" value="1" id="teacher_score" name="teacher_priority"/>
<label for="teacher_score" class=" fl ml5">教师评分</label>
<ul class="fl">
<li class="fl">
<input type="radio" class="fl" id="final_mode" value="0" name="final_mode"/>
<label for="final_mode" class="fl ml5">多项评分配比</label>
</li>
<div class="cl"></div>
<ul class="fl ml18">
<li class="clear">
<span class="fl">教师评分</span>
<%= select_tag :te_proportion,options_for_select(ta_proportion_option,homework.homework_detail_manual.te_proportion), {:class => "w61 fl ml15"} %>
</li>
<li class="clear mt5">
<span class="fl">助教评分</span>
<%= select_tag :ta_proportion,options_for_select(ta_proportion_option_to(100-(homework.homework_detail_manual.te_proportion * 100).to_i),homework.homework_detail_manual.ta_proportion), {:class => "w61 fl ml15"} %>
</li>
<li class="clear mt5">
<span class="fl">系统评分</span>
<input name="sy_proportion" type="hidden" value="<%= homework.homework_detail_programing.ta_proportion %>">
<input type="text" style="width: 49px; padding-left: 10px;" id="sy_proportion" value="<%= (homework.homework_detail_programing.ta_proportion * 100).to_i %>%" class="fl ml15" readonly>
</li>
</ul>
</ul>
</li>
<div class="fl clear popup_tip_box fontGrey2 mb10 w190" style="margin-left: 92px;">
<div class="fl ml20 clear popup_tip_box fontGrey2 mb10 mt10 w230" style="margin-left: 16px;">
<em></em>
<span></span>
<p >教师评分 - 迟交扣分 </p>
<p>教师评分 * 其百分比 + <br/>
助教评分 * 其百分比 + <br/>
系统评分 * 其百分比 - <br/>
迟交扣分 <br/>
注意:非零百分比的评分选项,在没有评分 <br/>记录的情况下,其百分比平摊到另外的非零 <br/>评分选项上
</p>
</div>
<ul class="fl mb10">
<li class="fl">
<label class="pop_box_label fl">&nbsp;&nbsp;</label>
<input type="radio" class="fl" value="1" id="no_final_mode" name="final_mode"/><label for="no_final_mode" class="fl ml5">单项评分优先</label>
</li>
<div class="cl"></div>
<li class="fl ml18">
<label class="pop_box_label fl">&nbsp;&nbsp;</label>教师 --> 助教 --> 系统
</li>
</ul>
<div class="fl clear popup_tip_box fontGrey2 mb10 w230" style="margin-left: 16px;">
<em></em>
<span></span>
<p>优先顺序排前的非零评分 * 100% - <br/>
迟交扣分 <br/>
有教师评分则教师评分100%,否则 <br/>
助教评分100%,依次类推
</p>
</div>
<li class="mb10 fl">
<label class="pop_box_label fl">&nbsp;&nbsp;</label>
<ul class="fl">
<li class="clear">
<input type="radio" class="fl" id="other_score" value="0" name="teacher_priority"/><label for="other_score" class="fl ml5">系统评分+助教评分</label>
</li>
<li class="clear">
<%= select_tag :sy_proportion,options_for_select(ta_proportion_option,homework.homework_detail_programing.ta_proportion), {:class => "w61 fl ml15"} %>
<span class="fl ml5">系统评分</span>
</li>
<li class="clear">
<%= select_tag :ta_proportion,options_for_select(ta_proportion_option_to(100-(homework.homework_detail_programing.ta_proportion * 100).to_i),homework.homework_detail_manual.ta_proportion), {:class => "w61 fl ml15"} %>
<span class="fl ml5">助教评分</span>
</li>
</ul>
<div class="fl clear popup_tip_box fontGrey2 mb10 w190 ml30">
<em></em>
<span></span>
<p >系统评分 * 其百分比 + <br/>
助教评分 * 其百分比 - <br/>
迟交扣分 </p>
</div>
</li>
</ul>
<div class="cl"></div>
<a href="javascript:void(0);" class="fr sy_btn_blue mr40" onclick="set_score_rule_submit();">确定</a>
<a href="javascript:void(0);" class="fr sy_btn_blue mr30" onclick="set_score_rule_submit();">确定</a>
<a href="javascript:void(0);" class="fr sy_btn_grey mr5" onclick="hideModal();">取消</a>
</div>
@ -86,32 +109,43 @@
<script>
$(function(){
$("#sy_proportion").live('change', function(){
var ta_proportion = 100 - parseInt(parseFloat($("#sy_proportion").val()) * 100);
$("#te_proportion").die();
$("#ta_proportion").die();
$("#te_proportion").live('change', function(){
var ta_proportion = 100 - parseInt(parseFloat($("#te_proportion").val()) * 100);
$("#ta_proportion").replaceWith(build_selector(ta_proportion));
$("#sy_proportion").val("0%");
$("input[name='sy_proportion']").val(0);
});
$("#ta_proportion").live('change', function(){
var sy_proportion = 100 - parseInt(parseFloat($("#ta_proportion").val()) * 100);
$("#sy_proportion").replaceWith(build_selector_sy(sy_proportion));
var ta_proportion = 100 - parseInt(parseFloat($("#te_proportion").val()) * 100) - parseInt(parseFloat($("#ta_proportion").val()) * 100);
$("#sy_proportion").val(ta_proportion + "%");
$("input[name='sy_proportion']").val(ta_proportion/100);
});
<% if homework.teacher_priority == 1 %>
$("#teacher_score").attr("checked", "checked");
<% else %>
$("#other_score").attr("checked", "checked");
<% end %>
<% if homework.homework_detail_manual.ta_mode == 1 %>
$("#ta_normal_mode").attr("checked", "checked");
<% else %>
$("#ta_re_mode").attr("checked", "checked");
<% end %>
$("#teacher_score").change(function(){
if($("#teacher_score").attr("checked")){
$("#late_penalty_num").val("0");
<% if homework.homework_detail_manual.final_mode %>
$("#no_final_mode").attr("checked", "checked");
$("#te_proportion").attr("disabled", "disabled");
$("#ta_proportion").attr("disabled", "disabled");
<% else %>
$("#final_mode").attr("checked", "checked");
<% end %>
$("#final_mode").click(function(){
if($("#final_mode").attr("checked")){
$("#te_proportion").removeAttr("disabled");
$("#ta_proportion").removeAttr("disabled");
}
});
$("#other_score").change(function(){
if($("#other_score").attr("checked")){
$("#late_penalty_num").val("10");
$("#no_final_mode").click(function(){
if($("#no_final_mode").attr("checked")){
$("#te_proportion").attr("disabled", "disabled");
$("#ta_proportion").attr("disabled", "disabled");
}
});
});

View File

@ -45,7 +45,7 @@
<% if @homework.homework_type == 1 %>
<p class="c_red mb5">已有<%=committed_work_count %>个学生提交作品,不允许再修改作业类型。</p>
<% elsif @homework.homework_type == 2 %>
<p class="c_red mb5">已有<%=committed_work_count %>个学生提交作品,不允许再修改作业类型和测试集。</p>
<p class="c_red mb5">已有<%=committed_work_count %>个学生提交作品,不允许再修改作业类型。</p>
<% elsif @homework.homework_type == 3 %>
<p class="c_red mb5">已有<%=committed_work_count %>个学生提交作品,不允许再修改作业类型和分组设置(可扩大分组范围)。</p>
<% end %>

View File

@ -4,7 +4,7 @@
pop_box_new(htmlvalue, 630, 500);
<% else %>
var htmlvalue = "<%= escape_javascript(render :partial => 'homework_common/set_score_rule_pro_anon',:locals => {:homework => @homework, :student_path => false, :user_activity_id => @user_activity_id,:hw_status => @hw_status}) %>";
pop_box_new(htmlvalue, 530, 404);
pop_box_new(htmlvalue, 560, 522);
<% end %>
<% else %>
<% if @homework.anonymous_comment == 0 %>
@ -12,7 +12,7 @@
pop_box_new(htmlvalue, 630, 500);
<% else %>
var htmlvalue = "<%= escape_javascript(render :partial => 'homework_common/set_score_rule_none_pro_anon',:locals => {:homework => @homework, :student_path => false, :user_activity_id => @user_activity_id,:hw_status => @hw_status}) %>";
pop_box_new(htmlvalue, 530, 332);
pop_box_new(htmlvalue, 560, 507);
<% end %>
<% end %>
function set_score_rule_submit() {

View File

@ -1,6 +1,9 @@
var htmlvalue = "<%= escape_javascript(render :partial => 'homework_common/set_evalutation_att',:locals => {:user_activity_id => @user_activity_id,:hw_status => @hw_status,:remote=>true}) %>";
pop_box_new(htmlvalue, 550, 315);
var datepickerOptions={dateFormat: 'yy-mm-dd', firstDay: 0, showOn: 'button', buttonImageOnly: true, buttonImage: '/images/public_icon.png', showButtonPanel: true, showWeek: true, showOtherMonths: true, selectOtherMonths: true};
$(function() { $('#evaluation_start_time').datepicker(datepickerOptions);
$(function() {
<% if @homework.homework_detail_manual.comment_status < 2 %>
$('#evaluation_start_time').datepicker(datepickerOptions);
<% end %>
$('#evaluation_end_time').datepicker(datepickerOptions);
});

View File

@ -12,7 +12,7 @@
<% elsif ma.course_message_type == "Comment" %>
<li><a href="<%=news_path(ma.course_message.commented.id) %>" target="_blank" title="<%=ma.course_message.author.show_name %> 评论了通知:<%=ma.course_message.commented.title%>"><span class="shadowbox_news_user"><%=ma.course_message.author.show_name %> </span>评论了通知:<%= ma.course_message.commented.title%></a></li>
<% elsif ma.course_message_type == "HomeworkCommon" && ma.status.nil? %>
<li><a href="<%= (!User.current.allowed_to?(:as_teacher, ma.course_message.course) && cur_user_works_for_homework(ma.course_message).nil?) ? new_student_work_path(:homework => ma.course_message.id) : student_work_index_path(:homework => ma.course_message.id) %>" target="_blank" title="<%=ma.course_message.user.show_name %>老师 发布了班级作业:作业标题:<%= ma.course_message.name%>"><span class="shadowbox_news_user"><%=ma.course_message.user.show_name %>老师 </span>发布了班级作业:作业标题:<%= ma.course_message.name%></a></li>
<li><a href="<%= student_work_index_path(:homework => ma.course_message.id) %>" target="_blank" title="<%=ma.course_message.user.show_name %>老师 发布了班级作业:作业标题:<%= ma.course_message.name%>"><span class="shadowbox_news_user"><%=ma.course_message.user.show_name %>老师 </span>发布了班级作业:作业标题:<%= ma.course_message.name%></a></li>
<% elsif ma.course_message_type == "HomeworkCommon" && ma.status == 1 %>
<li><a href="<%= student_work_index_path(:homework => ma.course_message.id) %>" target="_blank" title="<%=ma.course_message.user.show_name %>老师 发布的作业:作业标题:<%= ma.course_message.name%>的截止日期快到了"><span class="shadowbox_news_user"><%=ma.course_message.user.show_name %>老师 </span>发布的作业:作业标题:<%= ma.course_message.name%>的截止日期快到了</a></li>
<% elsif ma.course_message_type == "HomeworkCommon" && ma.status == 2 %>
@ -101,7 +101,7 @@
<% elsif ma.contest_message_type == "Comment" %>
<li><a href="<%=news_path(ma.contest_message.commented.id) %>" target="_blank" title="<%=ma.contest_message.author.show_name %> 回复了竞赛通知:<%=ma.contest_message.commented.title%>"><span class="shadowbox_news_user"><%=ma.contest_message.author.show_name %> </span>回复了竞赛通知:<%= ma.contest_message.commented.title%></a></li>
<% elsif ma.contest_message_type == "Work" && ma.status.nil? %>
<li><a href="<%= User.current.contestant_of_contest?(ma.contest_message.contest) && cur_user_works_for_work(ma.contest_message).nil? && ma.contest_message.work_status == 1 ? new_contestant_work_path(:work => ma.contest_message.id) : contestant_works_path(:work => ma.contest_message.id) %>" target="_blank" title="<%=ma.contest_message.user.show_name %> 发布了竞赛题:<%= ma.contest_message.name%>"><span class="shadowbox_news_user"><%=ma.contest_message.user.show_name %> </span>发布了竞赛题:<%= ma.contest_message.name%></a></li>
<li><a href="<%= contestant_works_path(:work => ma.contest_message.id) %>" target="_blank" title="<%=ma.contest_message.user.show_name %> 发布了竞赛题:<%= ma.contest_message.name%>"><span class="shadowbox_news_user"><%=ma.contest_message.user.show_name %> </span>发布了竞赛题:<%= ma.contest_message.name%></a></li>
<% elsif ma.contest_message_type == "Work" && ma.status == 1 %>
<li><a href="<%= contestant_works_path(:work => ma.contest_message.id) %>" target="_blank" title="<%=ma.contest_message.user.show_name %> 发布的竞赛题:<%= ma.contest_message.name%>的截止日期快到了"><span class="shadowbox_news_user"><%=ma.contest_message.user.show_name %> </span>发布的竞赛题:<%= ma.contest_message.name%>的截止时间快到啦</a></li>
<% elsif ma.contest_message_type == "Work" && ma.status == 2 %>

View File

@ -1,6 +1,6 @@
<span>
<div class="user_info_intro">
<% if !user.user_extensions.school_id.blank? %>
<% if !(user.user_extensions.school_id.blank? || user.user_extensions.school.nil?) %>
<%= user.user_extensions.school.name %>
<% end %>
</div>

View File

@ -99,7 +99,7 @@
</h3>
<h4 class="fontGrey2 mb5"><%= @user.login %></h4>
<p class="fontGrey2">
<% if !@user.user_extensions.school_id.blank? %>
<% if !(@user.user_extensions.school_id.blank? || @user.user_extensions.school.nil?) %>
<%= @user.user_extensions.school.name %>
<% end %>
</p>
@ -318,6 +318,8 @@
len = t.length;
for(var i=0;i<len;i++){
t[i].href = 'javascript:void(0)';
// 火狐浏览器点击弹开空白页
t[i].target = '_self';
}
// 退出按钮可用
var d = document.getElementById("logout_trustie");

View File

@ -1,5 +1,5 @@
<%= content_for(:header_tags) do %>
<%= import_ke(enable_at: false, prettify: false, init_activity: true) %>
<%= import_ke(enable_at: true, prettify: false, init_activity: true) %>
<% end %>
@ -105,11 +105,18 @@
<em class="talkWrapArrow"></em>
<div class="cl"></div>
<div class="talkConIpt ml5 mb10" id="reply<%= @topic.id %>">
<%= form_for @reply, :as => :reply, :url => {:action => 'reply', :id => @topic}, :html => {:multipart => true, :id => 'message_form'} do |f| %>
<%= render :partial => 'form_course', :locals => {:f => f, :replying => true} %>
<%= link_to l(:button_cancel), "javascript:void(0)", :onclick => 'course_board_canel_message_replay();', :class => "grey_btn fr c_white mt10 mr5 ml10" %>
<%= link_to l(:button_submit), "javascript:void(0)", :onclick => 'course_board_submit_message_replay();', :class => "blue_btn fr c_white mt10", :style => "margin-left: 50px;" %>
<% end %>
<div nhname='new_message_<%= @topic.id%>' style="display:none;">
<%= form_for @reply, :as => :reply, :url => {:action => 'reply', :id => @topic}, :html => {:multipart => true, :id => 'message_form'} do |f| %>
<input type="hidden" name="journal_id" value="<%= @topic.id %>"/>
<div nhname='toolbar_container_<%= @topic.id %>' ></div>
<div class="cl"></div>
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= @topic.id%>' name="content"></textarea>
<div class="cl"></div>
<span nhname='contentmsg_<%= @topic.id%>' class="fl"></span>
<a id="new_message_submit_btn_<%= @topic.id%>" href="javascript:void(0)" onclick="this.style.display='none'" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>
<div class="cl"></div>
<% end %>
</div>
<div class="cl"></div>
</div>
</div>

View File

@ -88,7 +88,7 @@
}
}
$(function() {
sd_create_editor_from_data(<%= @topic.id%>,null,"100%", "<%=@topic.class.to_s%>");
sd_create_editor_from_data(<%= @topic.id%>,null,"100%", "<%= @topic.class.to_s %>");
showNormalImage('message_description_<%= @topic.id %>');
});
</script>

View File

@ -1,15 +1,29 @@
<%if @project%>
<% if params[:is_project] %>
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'projects/act_messages', :locals => {:activity => @topic,:user_activity_id =>@user_activity_id,:is_course=>@is_course,:is_board=>@is_board}) %>");
<% else %>
$("#activity_post_reply_<%= @user_activity_id%>").html("<%= escape_javascript(render :partial => 'users/course_message_post_reply', :locals => {:activity => @topic,:user_activity_id =>@user_activity_id}) %>");
<% end %>
<% if @project %>
<% if params[:is_project] %>
$("#user_activity_<%= @user_activity_id %>").replaceWith("<%= escape_javascript(render :partial => 'projects/act_messages',
:locals => { :activity => @topic,
:user_activity_id => @user_activity_id,
:is_course => @is_course,
:is_board => @is_board}) %>");
// ForgeActivity是具体项目的动态UserActivity是社区的动态
// sd_create_editor_from_data(<%#= @user_activity_id %>, "", "100%", "ForgeActivity");
<% else %>
$("#activity_post_reply_<%= @user_activity_id %>").html("<%= escape_javascript(render :partial => 'users/course_message_post_reply',
:locals => { :activity => @topic,
:user_activity_id => @user_activity_id}) %>");
<%elsif @course%>
$("#activity_post_reply_<%= @user_activity_id%>").html("<%= escape_javascript(render :partial => 'users/course_message_post_reply', :locals => {:activity => @topic,:user_activity_id =>@user_activity_id}) %>");
<%elsif @contest%>
$("#activity_post_reply_<%= @user_activity_id%>").html("<%= escape_javascript(render :partial => 'users/contest_message_post_reply', :locals => {:activity => @topic,:user_activity_id =>@user_activity_id}) %>");
<% end %>
<% elsif @course %>
$("#activity_post_reply_<%= @user_activity_id %>").html("<%= escape_javascript(render :partial => 'users/course_message_post_reply',
:locals => { :activity => @topic,
:user_activity_id => @user_activity_id}) %>");
<% elsif @contest %>
$("#activity_post_reply_<%= @user_activity_id%>").html("<%= escape_javascript(render :partial => 'users/contest_message_post_reply',
:locals => { :activity => @topic,
:user_activity_id => @user_activity_id}) %>");
<% elsif @org_subfield %>
$("#activity_post_reply_<%= @user_activity_id%>").html("<%= escape_javascript(render :partial => 'organizations/org_message_post_reply', :locals => {:activity => @topic,:user_activity_id =>@user_activity_id}) %>");
<%end%>
sd_create_editor_from_data(<%= @user_activity_id %>,"","100%", "UserActivity");
$("#activity_post_reply_<%= @user_activity_id%>").html("<%= escape_javascript(render :partial => 'organizations/org_message_post_reply',
:locals => { :activity => @topic,
:user_activity_id => @user_activity_id}) %>");
<% end %>
sd_create_editor_from_data(<%= @user_activity_id %>, "", "100%", "UserActivity");

View File

@ -221,6 +221,7 @@
},
success:function(){
if(!$is_exist){
$("#apply_hint").text("");
$.ajax({
url:"<%= apply_subdomain_organization_path %>",
type:'post',

View File

@ -4,11 +4,11 @@
<div>
<div title="<%= poll_name %>">
<div style="width: 600px;float: left;">
<% if has_commit %>
<%= link_to (index.to_i+1).to_s+". "+poll_name, poll_result_poll_path(poll.id), :class => "polls_title polls_title_w fl c_dblue mw550", :title => "#{poll_name}" %>
<% else %>
<%# if has_commit %>
<%#= link_to (index.to_i+1).to_s+". "+poll_name, poll_result_poll_path(poll.id), :class => "polls_title polls_title_w fl c_dblue mw550", :title => "#{poll_name}" %>
<%# else %>
<%= link_to (index.to_i+1).to_s+". "+poll_name, poll_path(poll.id), :class => "polls_title polls_title_w fl c_dblue mw550", :title => "#{poll_name}" %>
<% end %>
<%# end %>
<% if poll.polls_status == 1 %>
<span class="exercise_status_nop fl mt3"></span>
<% elsif poll.polls_status == 2 %>
@ -67,13 +67,13 @@
<% else%>
<% if poll.polls_status == 2%>
<div>
<% if has_commit%>
<%= link_to (index.to_i+1).to_s+". "+poll_name, poll_result_poll_path(poll.id), :title => "#{poll_name}", :class => "polls_title polls_title_st fl c_dblue mw550"%>
<span class="exercise_status_com fl ml5"></span>
<%else%>
<%# if has_commit%>
<%#= link_to (index.to_i+1).to_s+". "+poll_name, poll_result_poll_path(poll.id), :title => "#{poll_name}", :class => "polls_title polls_title_st fl c_dblue mw550"%>
<!--<span class="exercise_status_com fl ml5"></span>-->
<%#else%>
<%= link_to (index.to_i+1).to_s+". "+poll_name, poll_path(poll.id), :title => "#{poll_name}", :class => "polls_title polls_title_st fl c_dblue mw550"%>
<span class="exercise_status_nocom fl ml5"></span>
<%end%>
<span class="<%= has_commit ? 'exercise_status_com' : 'exercise_status_nocom' %> fl ml5"></span>
<%#end%>
</div>
<div class="cl"></div>
<div class="mt10">

View File

@ -75,8 +75,8 @@ function add_MC(){
'<label class="questionLabel mt8">问题:&nbsp;&nbsp;</label>'+
'<input type="hidden" name="quest_id" value="'+quest_id+'"/>'+
'<input type="hidden" name="question_type" value="1"/>'+
'<textarea maxlength="250" class="questionTitle w570" type="text" name="poll_questions_title" id="poll_questions_title" placeholder="请输入单选题题目"></textarea>'+
'<input type="checkbox" name="is_necessary" value="true" checked/>'+
'<textarea maxlength="250" class="questionTitle w570 ml3" type="text" name="poll_questions_title" id="poll_questions_title" placeholder="请输入单选题题目"></textarea>'+
'<input class="ml3" type="checkbox" name="is_necessary" value="true" checked/>'+
'<label>必答</label>'+
'</div>'+
'<div class="ur_editor_content">'+
@ -164,8 +164,8 @@ function insert_MCQ(quest_type,quest_id){
'<label class="questionLabel mt8">问题:&nbsp;&nbsp;</label>'+
'<input type="hidden" name="quest_id" value="'+quest_id+'"/>'+
'<input type="hidden" name="question_type" value="2"/>'+
'<textarea maxlength="250" class="questionTitle w570" type="text" name="poll_questions_title" id="poll_questions_title" placeholder="请输入多选题题目"></textarea>'+
'<input type="checkbox" name="is_necessary" value="true" checked/>'+
'<textarea maxlength="250" class="questionTitle w570 ml3" type="text" name="poll_questions_title" id="poll_questions_title" placeholder="请输入多选题题目"></textarea>'+
'<input class="ml3" type="checkbox" name="is_necessary" value="true" checked/>'+
'<label>必答</label>'+
'</div>'+
'<div class="ur_editor_content">'+
@ -279,8 +279,8 @@ function insert_MCQ(quest_type,quest_id){
'<label for="ur_question_title" class="questionLabel mt8">问题:&nbsp;&nbsp;</label>'+
'<input type="hidden" name="quest_id" value="'+quest_id+'"/>'+
'<input type="hidden" name="question_type" value="3"/>'+
'<textarea maxlength="250" id="poll_questions_title" class="questionTitle w570" contenteditable="true" type="text" name="poll_questions_title" placeholder="请输入单行主观题"></textarea>'+
'<input type="checkbox" name="is_necessary" value="true" checked/>'+
'<textarea maxlength="250" id="poll_questions_title" class="questionTitle w570 ml3" contenteditable="true" type="text" name="poll_questions_title" placeholder="请输入单行主观题"></textarea>'+
'<input class="ml3" type="checkbox" name="is_necessary" value="true" checked/>'+
'<label for="ur_question_require">必答</label>'+
'</div>'+
'<div class="ur_editor_footer">'+
@ -333,12 +333,12 @@ function insert_MCQ(quest_type,quest_id){
'<div class="questionEditContainer">'+
'<div class="ur_editor_title">'+
'<label for="ur_question_title" class="questionLabel mt8">问题:&nbsp;&nbsp;</label>'+
'<input type="hidden" name="quest_id" value="'+quest_id+'"/>'+
'<input type="hidden" name="question_type" value="4"/>'+
'<textarea maxlength="250" id="poll_questions_title" class="questionTitle w570" contenteditable="true" type="text" name="poll_questions_title" placeholder="请输入多行主观题的问题描述"></textarea>'+
'<label><input type="checkbox" name="is_necessary" value="true" checked/>'+
'<textarea maxlength="250" id="poll_questions_title" class="questionTitle w570 ml3" contenteditable="true" type="text" name="poll_questions_title" placeholder="请输入多行主观题的问题描述"></textarea>'+
'<label class="ml3"><input type="checkbox" name="is_necessary" value="true" checked/>'+
'必答</label>'+
'</div>'+
'<input type="hidden" name="quest_id" value="'+quest_id+'"/>'+
'<div class="ur_editor_content">'+
'<ul>'+
'<li class="ur_item new_answer">'+
@ -619,26 +619,26 @@ function insert_MCQ(quest_type,quest_id){
<div class="testQuestion">
<span class="fl mt10 mr18">题型</span>
<ul class="tabs_list fl">
<li class="tab_item02 mr95">
<li class="tab_item02">
<a title="<%= l(:label_MC) %>" class="tab_icon icon_radio" onclick="add_MC();">
<%= l(:label_MC) %>
</a>
</li>
<li class="tab_item02 mr95" >
<li class="tab_item02">
<a title="<%= l(:label_MCQ) %>" class=" tab_icon icon_checkbox" onclick="add_MCQ();">
<%= l(:label_MCQ) %>
</a>
</li>
<li class="tab_item02 " >
<li class="tab_item02">
<a title="<%= l(:label_subjective) %>" class="tab_icon icon_text" onclick="add_single();">
<%= l(:label_subjective) %>
</a>
</li>
<!--<li class="tab_item02 " >-->
<!--<a title="<%#= l(:label_mulit)%>" class="tab_icon icon_textarea" onclick="add_mulit();">-->
<!--<%#= l(:label_mulit)%>-->
<!--</a>-->
<!--</li>-->
<li class="tab_item02">
<a title="<%= l(:label_mulit)%>" class="tab_icon icon_textarea" onclick="add_mulit();">
<%= l(:label_mulit)%>
</a>
</li>
</ul>
<div class="cl"></div>
</div><!--选项 end-->

View File

@ -17,7 +17,8 @@
<ul class="poll-add-menu fontGrey3">
<li><a href="javascript:void(0);" onclick=" dismiss('<%=type %>',<%=poll_question.id%>);insert_MC('<%=type %>',<%=poll_question.id%>);">单选题</a></li>
<li><a href="javascript:void(0);" onclick=" dismiss('<%=type %>',<%=poll_question.id%>);insert_MCQ('<%=type %>',<%=poll_question.id%>);">多选题</a></li>
<li><a href="javascript:void(0);" onclick=" dismiss('<%=type %>',<%=poll_question.id%>);insert_SINGLE('<%=type %>',<%=poll_question.id%>);">主观题</a></li>
<li><a href="javascript:void(0);" onclick=" dismiss('<%=type %>',<%=poll_question.id%>);insert_SINGLE('<%=type %>',<%=poll_question.id%>);">单行主观题</a></li>
<li><a href="javascript:void(0);" onclick=" dismiss('<%=type %>',<%=poll_question.id%>);insert_MULIT('<%=type %>',<%=poll_question.id%>);">多行主观题</a></li>
</ul>
</div>

View File

@ -241,7 +241,7 @@
}
}
</script>
<textarea class="fillInput" placeholder="在此填入答案" type="text" style="height:54px" value="<%= get_anwser_vote_text(pq.id, User.current.id).html_safe %>" onblur="onblur_<%= pq.id %>(this);" <%= @can_edit_poll ? "" : "disabled=disabled" %>></textarea>
<textarea class="fillInput" placeholder="在此填入答案" type="text" style="height:54px" onblur="onblur_<%= pq.id %>(this);" <%= @can_edit_poll ? "" : "disabled=disabled" %>><%= get_anwser_vote_text(pq.id, User.current.id).html_safe %></textarea>
</div>
</div>
</div>

View File

@ -1,3 +1,6 @@
<%= content_for(:header_tags) do %>
<%= import_ke(enable_at: true, prettify: false, init_activity: true) %>
<% end %>
<div class="container-big mt10" id="user_activity_<%= user_activity_id%>">
<div class="pr">
<div class="homepagePostPortrait">

View File

@ -22,6 +22,7 @@
<div class="cl"></div>
<div class="courseSendCancel mr15" style="float:right;"><a href="javascript:void(0);" class="sendSourceText" onclick="clickCanel();">取消</a></div>
<div class="courseSendSubmit" style="float:right;"><a href="javascript:void(0);" class="sendSourceText" onclick="clickOK()">确定</a></div>
<span class="c_red fl" id="choose_member_notice"></span>
<div class="cl"></div>
</div>
<script type="text/javascript">
@ -82,10 +83,8 @@
}
function delete_student(id) {
$("#choose_member_notice").hide();
$("#choose_student_"+id).remove();
$("#student_"+id).one("click",function choose_student() {
$("#choose_students_list").append("<li id='choose_student_"+id+"' onclick='delete_student("+id+");'>"+$("#student_"+id).html()+"</li>");
});
}
$(document).ready(function(){

View File

@ -107,7 +107,7 @@
<em></em>
<font></font>
现共有
<span class="c_red">&nbsp;<%= student_work.student_works_scores.where("reviewer_role = 3 and appeal_status != 3").group_by(&:user_id).count%>&nbsp;</span>
<span class="c_red">&nbsp;<%= student_work.student_works_scores.where(:reviewer_role => 3).group_by(&:user_id).count%>&nbsp;</span>
名学生进行了匿评,平均分为
<span class="c_red">&nbsp;<%= format("%.1f",student_work.student_score)%>&nbsp;</span>分。
</div>

View File

@ -52,7 +52,7 @@
</div>
<% if test.status.to_i == -2 %>
<div class="ProResultCon ">
<%= test.results.first %>
<%= test.results.first.to_s.force_encoding("UTF-8") %>
</div>
<% else %>
<div class="ProResultTable">

View File

@ -21,22 +21,39 @@ $("#all_students_list").empty();
}
<% if user.id.to_i != User.current.id.to_i && (@commit_student_ids.find{|e| e.to_i == user.id.to_i}).nil? && user.member_of_course?(@course) %>
if (str.indexOf(<%=user.id.to_s %>) < 0 && choose_str.indexOf(<%=user.id.to_s %>) < 0) {
$("#student_<%=user.id %>").one("click",function choose_student() {
var li = "<li id='choose_student_<%=user.id %>'";
<% if user.id.to_i != User.current.id.to_i %>
$("#student_<%=user.id %>").on("click",function choose_student() {
if($("#choose_student_<%=user.id %>").length > 0){
$("#choose_member_notice").html("该成员已添加");
$("#choose_member_notice").show();
} else{
$("#choose_member_notice").hide();
var li = "<li id='choose_student_<%=user.id %>'";
<% if user.id.to_i != User.current.id.to_i %>
li += " onclick='delete_student(<%=user.id %>);'";
<% end %>
li += ">" + $("#student_<%=user.id %>").html()+"<input name='member_id[]' value='<%=user.id %>' type='hidden'/></li>";
$("#choose_students_list").append(li);
<% end %>
li += ">" + $("#student_<%=user.id %>").html()+"<input name='member_id[]' value='<%=user.id %>' type='hidden'/></li>";
$("#choose_students_list").append(li);
}
});
}
<% elsif !user.member_of_course?(@course) %>
if (str.indexOf(<%=user.id.to_s %>) < 0) {
$("#student_<%=user.id %>").attr("title","该项目成员不是本课程的学生");
$("#student_<%=user.id %>").on("click",function() {
$("#choose_member_notice").html("该项目成员不是本班级的学生");
$("#choose_member_notice").show();
});
}
<% else %>
if (str.indexOf(<%=user.id.to_s %>) < 0) {
$("#student_<%=user.id %>").attr("title","该学生已加入其它分组");
$("#student_<%=user.id %>").on("click",function() {
$("#choose_member_notice").html("该学生已加入其它分组");
$("#choose_member_notice").show();
});
} else{
$("#student_<%=user.id %>").on("click",function() {
$("#choose_member_notice").html("该成员已添加");
$("#choose_member_notice").show();
});
}
<% end %>
<% end %>

View File

@ -1,17 +1,27 @@
<br>
<div style='width:470px;text-align:center;font-family: "微软雅黑","宋体"' class="f14">
<% if @syllabus.courses.not_deleted.empty? %>
确认删除该课程吗?
<% else %>
该课程下已经存在班级,不能删除。
<% end %>
</div>
</br>
<div style='width:164px; margin:0 auto; text-align:center; font-family: "微软雅黑","宋体"'>
<% if @syllabus.courses.not_deleted.empty? %>
<%=link_to '确认', syllabus_path(@syllabus), :class => 'Blue-btn fl', :method => 'delete'%>
<a href='javascript:void(0);' class='Blue-btn fl' onclick='hideModal()'>取消</a>
<% else %>
<a href='javascript:void(0);' class='Blue-btn' style="margin-left: 50px;" onclick='hideModal()'>取消</a>
<% end %>
<div id="muban_popup_box" style="width:470px;">
<div class="muban_popup_top">
<h3 class="fl">删除课程</h3>
<a href="javascript:void(0);" class="muban_icons_close fr"></a>
<div class="cl"></div>
</div>
<div style='text-align:center;font-family: "微软雅黑","宋体"' class="mt20 f14">
<% if @status == 1 %>
确认删除该课程吗?
<% elsif @status == 2 %>
该课程下存在归档班级,不能删除。
<% else %>
该课程下已经存在班级,不能删除。
<% end %>
</div>
<div style='width:164px; margin:0 auto; margin-top: 15px; text-align:center; font-family: "微软雅黑","宋体"'>
<% if @status == 1 %>
<a href='javascript:void(0);' class='sy_btn_grey fl mr5' style="margin-left: 25px;" onclick='hideModal()'>取消</a>
<%=link_to '确认', syllabus_path(@syllabus), :class => 'sy_btn_blue fl', :method => 'delete'%>
<% else %>
<a href='javascript:void(0);' class='sy_btn_blue' onclick='hideModal()'>确定</a>
<% end %>
<div class="cl"></div>
</div>
</div>

View File

@ -68,11 +68,34 @@
<%= link_to "加入班级",join_private_courses_courses_path,:remote => true,:class => "hw_btn_green fr mt5",:method => "post"%>
<% end %>
<% if User.current == course.teacher || User.current.admin? %>
<a href="javascript:void(0)" onclick="archive_course(<%=course.id %>, 0, 1);" class="btn_grey_big fr mt5 mr5" style="width: 56px;">归档</a>
<div class="pr">
<a href="javascript:void(0)" onclick="archive_course(<%=course.id %>, 0, 1);" onmouseover="$('#archive_notice_<%=course.id %>').show();" onmouseout="$('#archive_notice_<%=course.id %>').hide();"
class="btn_grey_big fr mt5 mr5" style="width: 56px;">归档</a>
<div class="archive_course_notice fontGrey2 none" id="archive_notice_<%=course.id %>" style="width: 230px; right: -275px;">
<em></em>
<span></span>
<p class="mt5 mb5 break_word">
此班级的信息将不再显示<br/>
您和您的学生将不能在此班级中继续互动<br/>
但您可以点击“归档管理”重新恢复
</p>
</div>
</div>
<% end %>
<% else %>
<% if User.current == course.teacher || User.current.admin? %>
<a href="javascript:void(0)" onclick="archive_course(<%=course.id %>, 1, 1);" class="btn_grey_big fr mt5" style="width: 56px;">恢复</a>
<div class="pr">
<a href="javascript:void(0)" onclick="archive_course(<%=course.id %>, 1, 1);" onmouseover="$('#archive_notice_<%=course.id %>').show();" onmouseout="$('#archive_notice_<%=course.id %>').hide();"
class="btn_grey_big fr mt5" style="width: 56px;">恢复</a>
<div class="archive_course_notice fontGrey2 none" id="archive_notice_<%=course.id %>" style="width: 230px; right: -275px; top: -10px;">
<em style="top: 21px;"></em>
<span style="top: 21px;"></span>
<p class="mt5 mb5 break_word">
此班级的信息将恢复显示<br/>
您和您的学生将可以重新在此班级中互动
</p>
</div>
</div>
<% end %>
<% end %>
<div class="cl"></div>

View File

@ -1,2 +1,2 @@
var htmlvalue = "<%=escape_javascript(render :partial => 'delete_syllabus') %>";
pop_up_box(htmlvalue,500,30,50);
pop_box_new(htmlvalue, 470, 30);

View File

@ -1,7 +1,11 @@
<div class = "cl"> </div>
<div id="course-boardlist">
<div class="listbox mt10" >
<p class="list-h2">讨论区列表</p>
<p class="list-h2">讨论区列表
<% if @board.parent_id.nil? && (User.current.admin? || User.current.allowed_to?(:as_teacher,@board.course)) %>
<%= link_to '历史讨论', boards_board_history_path(:course => @board.course_id), :class => 'link-blue fr f14', :remote => true %>
<% end %>
</p>
<div class="category">
<span class="grayTxt ">排序:</span>
<%= link_to "时间", {:controller => 'boards', :action => 'index', :board_id =>@board.id, :type => @type, :sort => @b_sort, :order => 1 }, :class => "sortTxt", :remote => true %>

View File

@ -1,3 +1,6 @@
<%= content_for(:header_tags) do %>
<%= import_ke(enable_at: true, prettify: false, init_activity: true) %>
<% end %>
<% all_replies = Message.where("root_id = #{activity.id}").reorder("created_on desc") %>
<% count = all_replies.count %>
<% no_children_comments = get_no_children_comments all_replies %>

View File

@ -26,9 +26,9 @@
<div class="pr">
<a href="javascript:void(0)" onclick="archive_course(<%=course.id %>, <%=course.is_delete %>, 0);" onmouseover="$('#archive_notice_<%=course.id %>').show();" onmouseout="$('#archive_notice_<%=course.id %>').hide();"
class="btn_grey_big fr mt5 mr15" style="width: 56px;"><%= course.is_delete == 0 ? '归档' : '恢复' %></a>
<div class="archive_course_notice fontGrey2 none" id="archive_notice_<%=course.id %>" style="width: 230px;">
<em></em>
<span></span>
<div class="archive_course_notice fontGrey2 none" id="archive_notice_<%=course.id %>" style="width: 230px; top: -10px;">
<em style="top: 21px;"></em>
<span style="top: 21px;"></span>
<p class="mt5 mb5 break_word">
<% if course.is_delete == 0 %>
此班级的信息将不再显示<br/>

View File

@ -105,7 +105,7 @@
</li>
<% if activity.anonymous_comment == 0 %>
<li>
<%= link_to("匿评设置", start_evaluation_set_homework_common_path(activity,:user_activity_id => user_activity_id, :hw_status => hw_status),:class => "wpostOptionLink", :remote => true) if activity.homework_detail_manual.comment_status < 2%>
<%= link_to("匿评设置", start_evaluation_set_homework_common_path(activity,:user_activity_id => user_activity_id, :hw_status => hw_status),:class => "wpostOptionLink", :remote => true) if activity.homework_detail_manual.comment_status < 3%>
</li>
<li>
<%= homework_anonymous_comment activity,hw_status,user_activity_id %>
@ -122,17 +122,16 @@
:title => "匿评是同学之间的双盲互评过程:每个同学将评阅系统分配给他/她的若干个作品", :remote => true)%>
</li>
<% end %>
<% if (User.current.teacher_of_course(activity.course) || activity.user == User.current) && User.current.homework_banks.where(:homework_common_id => activity.id).empty? %>
<li>
<%= link_to("加入题库", add_to_homework_bank_homework_common_path(activity,:user_activity_id => user_activity_id, :hw_status => hw_status, :type => 1),:class => "wpostOptionLink", :remote => true)%>
</li>
<% end %>
<% if activity.user == User.current %>
<% if activity.homework_bank_id.nil? %>
<% if activity.is_update && !User.current.homework_banks.where(:homework_common_id => activity.id).blank? %>
<li>
<%= link_to("加入题库", add_to_homework_bank_homework_common_path(activity,:user_activity_id => user_activity_id, :hw_status => hw_status, :type => 1),:class => "wpostOptionLink", :remote => true)%>
<%= link_to("同步到题库", add_to_homework_bank_homework_common_path(activity,:user_activity_id => user_activity_id, :hw_status => hw_status, :type => 2),:class => "wpostOptionLink", :remote => true)%>
</li>
<% elsif activity.is_update %>
<% if activity.user == activity.homework_bank.user %>
<li>
<%= link_to("同步到题库", add_to_homework_bank_homework_common_path(activity,:user_activity_id => user_activity_id, :hw_status => hw_status, :type => 2),:class => "wpostOptionLink", :remote => true)%>
</li>
<% end %>
<li>
<%= link_to("另存到题库", add_to_homework_bank_homework_common_path(activity,:user_activity_id => user_activity_id, :hw_status => hw_status, :type => 3),:class => "wpostOptionLink", :remote => true)%>
</li>

View File

@ -46,7 +46,7 @@
<li>
<%=link_to '查看课程', syllabus_path(syllabus.id), :class => 'postOptionLink',:target =>'_blank', :title => '查看课程' %>
</li>
<% if User.current == syllabus.user %>
<% if User.current == syllabus.user || User.current.admin? %>
<li><%=link_to '删除课程', delete_syllabus_syllabus_path(syllabus), :class => 'postOptionLink', :remote => 'true'%></li>
<% end %>
</ul>

View File

@ -368,6 +368,7 @@
<span class="fr mr10 mt3">或</span>
<a href="javascript:void(0);" id="new_message_cancel_btn" class="fr mr10 mt3">取消</a>
<% end %>
<p id="modify_inputs_notice" class="mt3 fr none c_red mr10"></p>
<div class="cl"></div>
</div>
</div>

View File

@ -8,13 +8,13 @@
<span style="font-size:14px;">已处理</span>
<% elsif ma.status == 4 %>
<% operator_message = AppliedMessage.where("applied_id=? and user_id=? and status = 4", ma.applied_id, ma.user_id).first %>
<% operator = User.find(operator_message.applied_user_id).show_name %>
<% operator = User.find(operator_message.applied_user_id).try(:show_name) %>
<span style="font-size:14px" title="<%= operator %>已拒绝">
<%= operator %>已拒绝
</span>
<% elsif ma.status == 5 %>
<% elsif ma.status == 5 && !AppliedMessage.where("applied_id=? and user_id=? and status = 4", ma.applied_id, ma.applied_user_id).first.nil? %>
<% operator_message = AppliedMessage.where("applied_id=? and user_id=? and status = 4", ma.applied_id, ma.applied_user_id).first %>
<% operator = User.find(operator_message.applied_user_id).show_name %>
<% operator = User.find(operator_message.applied_user_id).try(:show_name) %>
<span style="font-size:14px" title="<%= operator %>已拒绝">
<%= operator %>已拒绝
</span>

View File

@ -141,19 +141,11 @@
<span class="homepageNewsType fl">发布了竞赛题:</span>
</li>
<li class="messageInformationContents">
<% if User.current.contestant_of_contest?(ma.contest_message.contest) && cur_user_works_for_work(ma.contest_message).nil? && ma.contest_message.work_status == 1 %>
<%= link_to ma.contest_message.name, new_contestant_work_path(:work => ma.contest_message.id),
:class =>"#{!ma.viewed ? "newsBlack" : "newsGrey"}",
:target => '_blank',
:title => "竞赛题:#{ma.contest_message.name}"
%>
<% else %>
<%= link_to ma.contest_message.name, contestant_works_path(:work => ma.contest_message.id),
:class => "#{!ma.viewed ? "newsBlack" : "newsGrey"}",
:target => '_blank',
:title => "竞赛题:#{ma.contest_message.name}"
%>
<% end %>
<%= link_to ma.contest_message.name, contestant_works_path(:work => ma.contest_message.id),
:class => "#{!ma.viewed ? "newsBlack" : "newsGrey"}",
:target => '_blank',
:title => "竞赛题:#{ma.contest_message.name}"
%>
</li>
</div>
<li class="homepageNewsTime fr"><%= time_tag(ma.created_at).html_safe %> </li>

View File

@ -66,62 +66,14 @@
<span class="homepageNewsType fl">发布了班级作业:</span>
</li>
<li class="messageInformationContents">
<% if !User.current.allowed_to?(:as_teacher, ma.course_message.course) && cur_user_works_for_homework(ma.course_message).nil? %>
<%= link_to "作业标题:" + ma.course_message.name, new_student_work_path(:homework => ma.course_message.id),
:class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
:target => '_blank',
:title => "作业标题:#{ma.course_message.name}"
%>
<!--:onmouseover =>"message_titile_show($(this),event)",-->
<!--:onmouseout => "message_titile_hide($(this))" %>-->
<% else %>
<%= link_to "作业标题:" + ma.course_message.name, student_work_index_path(:homework => ma.course_message.id),
:class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
:target => '_blank',
:title => "作业标题:#{ma.course_message.name}"
%>
<!--:onmouseover => "message_titile_show($(this),event)",-->
<!--:onmouseout => "message_titile_hide($(this))" %>-->
<% end %>
<%= link_to "作业标题:" + ma.course_message.name, student_work_index_path(:homework => ma.course_message.id),
:class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
:target => '_blank',
:title => "作业标题:#{ma.course_message.name}"
%>
</li>
</div>
<div style="display: none" class="message_title_red system_message_style">
<% if User.current.allowed_to?(:as_teacher,ma.course_message.course) %>
<p>
<%= User.current.lastname + User.current.firstname %>老师您好!
<%= User.current.eql?(ma.course_message.user)?"您":(ma.course_message.user.show_name + "老师")%>刚刚发布了一个作业:
</p>
<ul class="ul_normal_color">
<li>班级名称:<%= ma.course_message.course.name %>
(<%= ma.course_message.course.time.to_s + '年'+ ma.course_message.course.term %>)</li>
<li>作业标题:<span style="color:Red"><%= ma.course_message.name %></span></li>
<li>发布时间:<span style="color:Red;"><%= DateTime.parse(ma.course_message.created_at.to_s).strftime('%Y-%m-%d %H:%M').to_s %></span></li>
<li>提交截止:<span style="color:Red;"><%= ma.course_message.end_time %>&nbsp;23:59</span></li>
<li>匿评开始:<span style="color:Red;"><%= ma.course_message.homework_detail_manual.evaluation_start %>&nbsp;23:59</span></li>
<li>匿评关闭:<span style="color:Red;"><%= ma.course_message.homework_detail_manual.evaluation_end %>&nbsp;23:59</span></li>
<li>迟交扣分:<span style="color:Red;"><%= ma.course_message.late_penalty %>分</span></li>
<li>缺评扣分:<span style="color:Red;"><%= ma.course_message.homework_detail_manual.absence_penalty %>分</span></li>
</ul>
<p>
您可以修改作业内容、评分规则、匿评过程等,谢谢!
</p>
<% else %>
<p><%= User.current.lastname + User.current.firstname %>同学您好!<%= ma.course_message.user.lastname + ma.course_message.user.firstname %>老师刚刚发布了一个作业:</p>
<ul class="ul_normal_color">
<li>班级名称:<%= ma.course_message.course.name %>
(<%= ma.course_message.course.time.to_s + '年'+ ma.course_message.course.term %>)</li>
<li>作业标题:<span style="color:Red;"><%= ma.course_message.name %></span></li>
<li>提交截止:<span style="color:Red;"><%= ma.course_message.end_time %>&nbsp;&nbsp;23:59</span></li>
<li>匿评开始:<span style="color:Red;"><%= ma.course_message.homework_detail_manual.evaluation_start %>&nbsp;&nbsp;23:59</span></li>
<li>匿评关闭:<span style="color:Red;"><%= ma.course_message.homework_detail_manual.evaluation_end %>&nbsp;&nbsp;23:59</span></li>
<li>迟交扣分:<span style="color:Red;"><%= ma.course_message.late_penalty %>分</span></li>
<li>缺评扣分:<span style="color:Red;"><%= ma.course_message.homework_detail_manual.absence_penalty %>分</span></li>
</ul>
<p>
请抓紧时间提交您的作品,谢谢!
</p>
<% end %>
</div>
<li class="homepageNewsTime fr"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<% end %>
@ -413,7 +365,7 @@
user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
<% end %>
<span class="homepageNewsType fl">
<%= ma.status == 0 ? "评阅了您的作品:" : "重新评阅了您的作品:" %>
<%= ma.status == 0 ? "评阅了您的作品:" : "重新评阅了您的作品" %>
</span>
</li>
<li class="messageInformationContents">
@ -674,23 +626,23 @@
<!--:onmouseout => "message_titile_hide($(this))" %>-->
</li>
</div>
<div style="display: none" class="message_title_red system_message_style">
<p>
<%= User.current.lastname + User.current.firstname %>老师您好!您成功创建了一个班级,详情如下:
</p>
<p>班级名称:<%= ma.course_message.name %></p>
<p>开课学期:<%= ma.course_message.time.to_s + '年' + ma.course_message.term %></p>
<p>班级ID<span style="color:red;"><%= ma.course_message.id %></span></p>
<p>班级密码:<span style="color:red;"><%= ma.course_message.password %></span></p>
<p>学时总数:<%= ma.course_message.class_period %></p>
<p>创建时间:<%= format_time(ma.course_message.created_at) %></p>
<p>您可以点击左上角的“配置”按钮,修改班级基本信息,添加及删除班级成员。您也可以把邀请码告诉学生和其他成员,让他们输入邀请码加入班级。</p>
<% if ma.course_message.is_public %>
<p>您的班级是公开的,所有人都能访问您的班级。若不想设置为公开,您可以在配置中设置。</p>
<% else %>
<p>您的班级是私有的,非班级成员不能访问您的班级。如果想设置为公开,您可以在配置中设置。</p>
<% end %>
</div>
<!--<div style="display: none" class="message_title_red system_message_style">-->
<!--<p>-->
<%#= User.current.lastname + User.current.firstname %>老师您好!您成功创建了一个班级,详情如下:
<!--</p>-->
<!--<p>班级名称:<%#= ma.course_message.name %></p>-->
<!--<p>开课学期:<%#= ma.course_message.time.to_s + '年' + ma.course_message.term %></p>-->
<!--<p>班级ID<span style="color:red;"><%#= ma.course_message.id %></span></p>-->
<!--<p>班级密码:<span style="color:red;"><%#= ma.course_message.password %></span></p>-->
<!--<p>学时总数:<%#= ma.course_message.class_period %></p>-->
<!--<p>创建时间:<%#= format_time(ma.course_message.created_at) %></p>-->
<!--<p>您可以点击左上角的“配置”按钮,修改班级基本信息,添加及删除班级成员。您也可以把邀请码告诉学生和其他成员,让他们输入邀请码加入班级。</p>-->
<!--<%# if ma.course_message.is_public %>-->
<!--<p>您的班级是公开的,所有人都能访问您的班级。若不想设置为公开,您可以在配置中设置。</p>-->
<!--<%# else %>-->
<!--<p>您的班级是私有的,非班级成员不能访问您的班级。如果想设置为公开,您可以在配置中设置。</p>-->
<!--<%# end %>-->
<!--</div>-->
<li class="homepageNewsTime fr"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<% end %>

View File

@ -41,3 +41,19 @@
<li class="homepageNewsTime fr"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<% end %>
<% if ma.message_type == 'DisagreeApplySubdomain'%>
<ul class="homepageNewsList fl">
<div class="longMessageWidth">
<li class="homepageNewsPortrait fl">
<div class="navHomepageLogo fl"><%= image_tag("/images/trustie_logo1.png", width: "30px", height: "30px", class: "mt3") %></div>
</li>
<li class="homepageNewsPubType fl">
<span class='homepageNewsType fl'>管理员拒绝了您的子域名申请:</span>
</li>
<li class="messageInformationContents">
<%= ma.content %>
</li>
</div>
<li class="homepageNewsTime fr"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<% end %>

View File

@ -8,15 +8,13 @@
<% homework.homework_samples.each_with_index do |sample, index| %>
<div class="mt10" style="margin-left:57px;">
<label class="fl fontGrey2 mr10 mt5 w20" name="sample_inputs_label"><%= index+1 %>&nbsp;&nbsp;</label>
<textarea class="InputBox w547 fl mr5" placeholder="样例输入" name="sample[input][]" <%= not_allow_select ? 'disabled' : '' %>><%= sample.input %></textarea>
<% unless not_allow_select %>
<a href="javascript:void(0);" class="fl icon_add sample_icon_add" title="增加样例组"></a>
<% if index != 0 %>
<a href="javascript:void(0);" class="fl icon_remove sample_icon_remove" title="删除样例组"></a>
<% end %>
<textarea class="InputBox w547 fl mr5" placeholder="样例输入" name="sample[input][]"><%= sample.input %></textarea>
<a href="javascript:void(0);" class="fl icon_add sample_icon_add" title="增加样例组"></a>
<% if index != 0 %>
<a href="javascript:void(0);" class="fl icon_remove sample_icon_remove" title="删除样例组"></a>
<% end %>
<div class="cl"></div>
<textarea class="InputBox w547 fl ml30 mt10" placeholder="样例输出" name="sample[output][]" <%= not_allow_select ? 'disabled' : '' %>><%= sample.output %></textarea>
<textarea class="InputBox w547 fl ml30 mt10" placeholder="样例输出" name="sample[output][]"><%= sample.output %></textarea>
<div class="cl"></div>
</div>
<% end %>
@ -40,17 +38,16 @@
<span class="f12 c_red mt5 fr">温馨提示:您可以在发布作业后,在作业"模拟答题"中进行标准代码的检测。</span>
<div class="cl"></div>
<div id="input_boxes_div">
<% if edit_mode && homework.is_program_homework? %>
<% homework.homework_tests.each_with_index do |test, index| %>
<div class="mt10" style="margin-left:57px;">
<label class="fl fontGrey2 mr10 mt5 w20" name="inputs_label"><%= index+1 %>&nbsp;&nbsp;</label>
<textarea class="InputBox w265 fl mr10" placeholder="测试输入" name="program[input][]" <%= not_allow_select ? 'disabled' : '' %>><%= test.input %></textarea>
<textarea class="InputBox w265 fl mr5" placeholder="测试输出" name="program[output][]" <%= not_allow_select ? 'disabled' : '' %>><%= test.output %></textarea>
<% unless not_allow_select %>
<a href="javascript:void(0);" class=" fl icon_add test_icon_add" title="增加测试组"></a>
<% if index != 0 %>
<a href="javascript:void(0);" class=" fl icon_remove test_icon_remove" title="删除测试组"></a>
<% end %>
<textarea class="InputBox w265 fl mr10" placeholder="测试输入" name="program[input][]"><%= test.input %></textarea>
<textarea class="InputBox w265 fl mr5" placeholder="测试输出" name="program[output][]"><%= test.output %></textarea>
<a href="javascript:void(0);" class=" fl icon_add test_icon_add" title="增加测试组"></a>
<% if index != 0 %>
<a href="javascript:void(0);" class=" fl icon_remove test_icon_remove" title="删除测试组"></a>
<% end %>
<div class="cl"></div>
</div>
@ -65,6 +62,7 @@
<div class="cl"></div>
</div>
<% end %>
</div>
</div>
</div>
@ -74,6 +72,10 @@
bt.LEFT_DELIMITER = '<!';
bt.RIGHT_DELIMITER = '!>';
<% if not_allow_select %>
$("#input_boxes_div .InputBox").on('focus', modify_input_notice);
<% end %>
$("#programHomework").on('click', 'a.test_icon_add', function () {
var html = bt('t:test-answer-list', null);
$(this).parent('.mt10').after(html);
@ -90,6 +92,9 @@
}
}
$(inputs[inputs.length - 1]).focus();
<% if not_allow_select %>
$("#input_boxes_div .InputBox").on('focus', modify_input_notice);
<% end %>
});
$("#programHomework").on('click', 'a.test_icon_remove', function () {
$(this).parent('.mt10').remove();
@ -152,4 +157,9 @@
}
}
<% end %>
function modify_input_notice(){
$("#modify_inputs_notice").html("修改测试集后请通知学生重新提交作品");
$("#modify_inputs_notice").show();
}
</script>

View File

@ -147,7 +147,7 @@
<div class="cl"></div>
</div>
<% if test.status.to_i == -2 %>
<div class="ProResultCon"><pre><%= test.results.first %></pre></div>
<div class="ProResultCon"><pre><%= test.results.first.to_s.force_encoding("UTF-8") %></pre></div>
<% else %>
<div class="ProResultTable " >
<ul class="ProResultUl " >

View File

@ -1,5 +1,6 @@
//$("#HomeWorkCon").replaceWith("<%#= escape_javascript(render :partial => 'users/user_homework_form', :locals => { :homework => @homework,:edit_mode => true })%>");
hideModal('#coursesChoosePopup');
$("#homework_editor").show();
$("#homework_name").val("<%= @homework.name%>");
//$("#homework_end_time").val("<%#= @homework.end_time%>");
<% if @select_course == "0"%>
@ -20,6 +21,5 @@ homework_description_editor.html("<%= escape_javascript(@homework.description.ht
<% end %>
document.getElementById("homework_type_option").options[<%=@homework.homework_type %>].selected = true;
$("#select_type_nitice").hide();
$("#homework_editor").show();
$("#join_bank").attr("checked",false);
$("#join_bank_li").hide();

View File

@ -52,7 +52,7 @@
<div class="mt5 fl"><%= image_tag("search_icon_03.png", :width=>"8", :height=>"16" ,:class=>"fl") %><span class="searchTag">班级</span></div>
<div class="cl"></div>
</li>
<li class="fontGrey3 mb5"><%= item.try(:highlight).try(:description) ? item.highlight.description[0].html_safe : (h item.description.html_safe) %></li>
<li class="fontGrey3 mb5"><%= item.try(:highlight).try(:description) ? item.highlight.description[0].html_safe : item.description %></li>
<li class="f12 fontGrey2">
<% user = User.find(item.tea_id)%>
<span class="mr30">教师:<%= user.realname %></span>

View File

@ -551,6 +551,7 @@ RedmineApp::Application.routes.draw do
post 'boards/:board_id/topics/:id/replies', :to => 'messages#reply'
post 'boards/:board_id/topics/:id/edit', :to => 'messages#edit'
post 'boards/:board_id/topics/:id/destroy', :to => 'messages#destroy',:as=>'delete_board_message'
get 'boards/board_history', :to => 'boards#board_history'
match 'messages/join_org_subfield', :to => 'messages#join_org_subfield'
match 'messages/get_subfield_on_click_org', :to => 'messages#get_subfield_on_click_org'
match 'messages/join_org_subfields', :to => 'messages#join_org_subfields'
@ -1222,6 +1223,7 @@ RedmineApp::Application.routes.draw do
get 'attachments/download/:id', :to => 'attachments#download', :id => /\d+/
get 'attachments/thumbnail/:id(/:size)', :to => 'attachments#thumbnail', :id => /\d+/, :size => /\d+/, :as => 'thumbnail'
get 'attachments/autocomplete'
get 'attachments/update_attachment_publish_time/:id',:to=>'attachments#update_attachment_publish_time',:as=>'update_attachment_publish_time'
match 'attachments/autocomplete', :to => 'attachments#autocomplete', :via => [:post]
post 'attachments/relationfile', to: 'attachments#add_exist_file_to_project', as: 'attach_relation'
post 'attachments/relationfiles', to: 'attachments#add_exist_file_to_projects', as: 'attach_relations'

View File

@ -20,7 +20,7 @@ class CreateCourseHomeworkStatistics < ActiveRecord::Migration
for i in 1 ... count do i
Course.page(i).per(30).each do |course|
hw_count = course.homework_commons.includes(:homework_detail_manual).where("homework_detail_manuals.comment_status > 0").count
homework_ids = course.homework_commons.empty? ? "(-1)" : "(" + course.homework_commons.map{|hw| hw.id}.join(",") + ")"
homework_ids = course.homework_commons.includes(:homework_detail_manual).where("homework_detail_manuals.comment_status > 0").empty? ? "(-1)" : "(" + course.homework_commons.includes(:homework_detail_manual).where("homework_detail_manuals.comment_status > 0").map{|hw| hw.id}.join(",") + ")"
student_works = StudentWork.where("homework_common_id in #{homework_ids} and work_status !=0")
is_eva_homeworks = course.homework_commons.includes(:homework_detail_manual).where("homework_commons.anonymous_comment = 0 and homework_detail_manuals.comment_status = 2")
is_eva_student_works = StudentWork.where(:homework_common_id => is_eva_homeworks.map{|hw| hw.id})

View File

@ -1,43 +1,43 @@
class HomeworkBankMigration < ActiveRecord::Migration
def up
# add_column :homework_commons, :homework_bank_id, :integer
# add_column :homework_commons, :is_update, :boolean, :default => false
#
# count =Course.all.count / 30 + 2
# transaction do
# for i in 1 ... count do i
# Course.page(i).per(30).each do |course|
# if course.is_delete == 0
# course.homework_commons.each do |homework|
# unless homework.user.homework_banks.select("name").to_s.include?(homework.name)
# homework_bank = HomeworkBank.create(:user_id => homework.user_id, :name => homework.name, :description => homework.description, :homework_type => homework.homework_type,
# :quotes => 1, :is_public => course.is_public, :applicable_syllabus => course.syllabus.title, :homework_common_id => homework.id, :created_at => homework.created_at)
# if homework.homework_type == 2 && homework.homework_detail_programing
# homework_bank.update_attributes(:language => homework.homework_detail_programing.language, :standard_code => homework.homework_detail_programing.standard_code)
# homework.homework_tests.each do |test|
# homework_bank.homework_bank_tests << HomeworkBankTest.create(
# input: test.input,
# output: test.output,
# test_type: true
# )
# end
# homework.homework_samples.each do |test|
# homework_bank.homework_bank_tests << HomeworkBankTest.create(
# input: test.input,
# output: test.output,
# test_type: false
# )
# end
# elsif homework.homework_type == 3 && homework.homework_detail_group
# homework_bank.update_attributes(:min_num => homework.homework_detail_group.min_num, :max_num => homework.homework_detail_group.max_num, :base_on_project => homework.homework_detail_group.base_on_project)
# end
# homework.update_column('homework_bank_id', homework_bank.id)
# end
# end
# end
# end
# end
# end
add_column :homework_commons, :homework_bank_id, :integer
add_column :homework_commons, :is_update, :boolean, :default => false
count =Course.all.count / 30 + 2
transaction do
for i in 1 ... count do i
Course.page(i).per(30).each do |course|
if course.is_delete == 0
course.homework_commons.each do |homework|
unless homework.user.homework_banks.select("name").to_s.include?(homework.name)
homework_bank = HomeworkBank.create(:user_id => homework.user_id, :name => homework.name, :description => homework.description, :homework_type => homework.homework_type,
:quotes => 1, :is_public => course.is_public, :applicable_syllabus => course.syllabus.title, :homework_common_id => homework.id, :created_at => homework.created_at)
if homework.homework_type == 2 && homework.homework_detail_programing
homework_bank.update_attributes(:language => homework.homework_detail_programing.language, :standard_code => homework.homework_detail_programing.standard_code)
homework.homework_tests.each do |test|
homework_bank.homework_bank_tests << HomeworkBankTest.create(
input: test.input,
output: test.output,
test_type: true
)
end
homework.homework_samples.each do |test|
homework_bank.homework_bank_tests << HomeworkBankTest.create(
input: test.input,
output: test.output,
test_type: false
)
end
elsif homework.homework_type == 3 && homework.homework_detail_group
homework_bank.update_attributes(:min_num => homework.homework_detail_group.min_num, :max_num => homework.homework_detail_group.max_num, :base_on_project => homework.homework_detail_group.base_on_project)
end
homework.update_column('homework_bank_id', homework_bank.id)
end
end
end
end
end
end
end
def down

View File

@ -0,0 +1,27 @@
class AddTeProportionToHomework < ActiveRecord::Migration
def change
add_column :homework_detail_manuals, :te_proportion, :float, :default => 1.0
count = HomeworkDetailManual.all.count / 30 + 2
transaction do
for i in 1 ... count do i
HomeworkDetailManual.page(i).per(30).each do |homework|
if homework.homework_common
homework_common = homework.homework_common
homework_detail_programing = homework_common.homework_detail_programing
if homework_common.teacher_priority == 1
if homework_detail_programing
homework_detail_programing.update_column("ta_proportion", 0.0)
end
homework.update_column("ta_proportion", 0.0)
else
homework.update_column("te_proportion", 0.0)
end
else
homework.destroy
end
end
end
end
end
end

View File

@ -0,0 +1,42 @@
class CourseStatisticsMigration < ActiveRecord::Migration
def up
CourseHomeworkStatistics.destroy_all
count =Course.all.count / 30 + 2
transaction do
for i in 1 ... count do i
Course.page(i).per(30).each do |course|
hw_count = course.homework_commons.includes(:homework_detail_manual).where("homework_detail_manuals.comment_status > 0").count
homework_ids = course.homework_commons.includes(:homework_detail_manual).where("homework_detail_manuals.comment_status > 0").empty? ? "(-1)" : "(" + course.homework_commons.includes(:homework_detail_manual).where("homework_detail_manuals.comment_status > 0").map{|hw| hw.id}.join(",") + ")"
student_works = StudentWork.where("homework_common_id in #{homework_ids} and work_status !=0")
is_eva_homeworks = course.homework_commons.includes(:homework_detail_manual).where("homework_commons.anonymous_comment = 0 and homework_detail_manuals.comment_status = 2")
is_eva_student_works = StudentWork.where(:homework_common_id => is_eva_homeworks.map{|hw| hw.id})
has_eva_homeworks = course.homework_commons.includes(:homework_detail_manual).where("homework_commons.anonymous_comment = 0 and homework_detail_manuals.comment_status = 3")
has_eva_student_works = StudentWork.where(:homework_common_id => has_eva_homeworks.map{|hw| hw.id})
course.student.each do |student|
user = student.student
if user
committed_work_num = user.student_works.where("homework_common_id in #{homework_ids} and work_status != 0").count
un_commit_work_num = (hw_count - committed_work_num) < 0 ? 0 : (hw_count - committed_work_num)
late_commit_work_num = user.student_works.where("homework_common_id in #{homework_ids} and work_status = 2").count
absence_evaluation_work_num = user.student_works_evaluation_distributions.where(:student_work_id => has_eva_student_works.map(&:id)).count -
user.student_works_scores.where(:reviewer_role => 3, :student_work_id => has_eva_student_works.map(&:id)).group_by(&:student_work_id).count
absence_evaluation_work_num = absence_evaluation_work_num < 0 ? 0 : absence_evaluation_work_num
un_evaluation_work_num = user.student_works_evaluation_distributions.where(:student_work_id => is_eva_student_works.map(&:id)).count -
user.student_works_scores.where(:reviewer_role => 3, :student_work_id => is_eva_student_works.map(&:id)).group_by(&:student_work_id).count
un_evaluation_work_num = un_evaluation_work_num < 0 ? 0 : un_evaluation_work_num
appeal_num = user.student_works_scores.where(:student_work_id => student_works.map(&:id), :appeal_status => 3).count
average_score = user.student_works.where(:id => student_works.map(&:id)).select("AVG(student_works.work_score) as score").first ? user.student_works.where(:id => student_works.map(&:id)).select("AVG(student_works.work_score) as score").first.score : 0
total_score = user.student_works.where(:id => student_works.map(&:id)).select("SUM(student_works.work_score) as score").first ? user.student_works.where(:id => student_works.map(&:id)).select("SUM(student_works.work_score) as score").first.score : 0
CourseHomeworkStatistics.create(:course_id => course.id, :user_id => user.id, :committed_work_num => committed_work_num, :un_commit_work_num => un_commit_work_num,
:late_commit_work_num => late_commit_work_num, :absence_evaluation_work_num => absence_evaluation_work_num, :un_evaluation_work_num => un_evaluation_work_num,
:appeal_num => appeal_num, :average_score => average_score, :total_score => total_score)
end
end
end
end
end
end
def down
end
end

View File

@ -0,0 +1,5 @@
class AddFinalModeToHomeworkDetailManuals < ActiveRecord::Migration
def change
add_column :homework_detail_manuals, :final_mode, :boolean, :default => 0
end
end

View File

@ -0,0 +1,13 @@
class PollQuestionMigration < ActiveRecord::Migration
def up
pqs = PollQuestion.where(:question_type => 4)
pqs.each do |pq|
if pq.poll_answers.empty?
pq.update_column("question_type", 3)
end
end
end
def down
end
end

View File

@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20170309024921) do
ActiveRecord::Schema.define(:version => 20170425030242) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
@ -84,6 +84,21 @@ ActiveRecord::Schema.define(:version => 20170309024921) do
t.integer "role", :default => 0
end
create_table "apply_add_departments", :force => true do |t|
t.string "name"
t.integer "department_id"
t.integer "school_id"
t.text "remarks"
t.integer "user_id"
t.integer "status"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
add_index "apply_add_departments", ["department_id"], :name => "index_apply_add_departments_on_department_id"
add_index "apply_add_departments", ["school_id"], :name => "index_apply_add_departments_on_school_id"
add_index "apply_add_departments", ["user_id"], :name => "index_apply_add_departments_on_user_id"
create_table "apply_add_schools", :force => true do |t|
t.string "name"
t.string "province"
@ -180,23 +195,24 @@ ActiveRecord::Schema.define(:version => 20170309024921) do
create_table "attachments", :force => true do |t|
t.integer "container_id"
t.string "container_type", :limit => 30
t.string "filename", :default => "", :null => false
t.string "disk_filename", :default => "", :null => false
t.integer "filesize", :default => 0, :null => false
t.string "content_type", :default => ""
t.string "digest", :limit => 40, :default => "", :null => false
t.integer "downloads", :default => 0, :null => false
t.integer "author_id", :default => 0, :null => false
t.string "container_type", :limit => 30
t.string "filename", :default => "", :null => false
t.string "disk_filename", :default => "", :null => false
t.integer "filesize", :default => 0, :null => false
t.string "content_type", :default => ""
t.string "digest", :limit => 40, :default => "", :null => false
t.integer "downloads", :default => 0, :null => false
t.integer "author_id", :default => 0, :null => false
t.datetime "created_on"
t.text "description"
t.string "disk_directory"
t.integer "attachtype", :default => 1
t.integer "is_public", :default => 1
t.integer "attachtype", :default => 1
t.integer "is_public", :default => 1
t.integer "copy_from"
t.integer "quotes"
t.integer "is_publish", :default => 1
t.integer "is_publish", :default => 1
t.datetime "publish_time"
t.integer "resource_bank_id"
end
add_index "attachments", ["author_id"], :name => "index_attachments_on_author_id"
@ -274,6 +290,7 @@ ActiveRecord::Schema.define(:version => 20170309024921) do
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.integer "root_id"
t.integer "visits", :default => 0
end
add_index "blog_comments", ["root_id"], :name => "index_blog_comments_on_root_id"
@ -329,6 +346,42 @@ ActiveRecord::Schema.define(:version => 20170309024921) do
t.datetime "updated_at", :null => false
end
create_table "challenge_samples", :force => true do |t|
t.string "input"
t.string "output"
t.integer "challenge_id"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.integer "game_id"
end
create_table "challenge_tags", :force => true do |t|
t.string "name"
t.integer "challenge_id"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "challenges", :force => true do |t|
t.integer "shixun_id"
t.string "subject"
t.text "description"
t.integer "user_id"
t.integer "status", :limit => 1, :default => 0
t.integer "position", :limit => 1, :default => 1
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.text "ready_knowledge"
t.text "task_pass", :limit => 2147483647
t.text "answer", :limit => 2147483647
t.integer "score"
t.integer "visits", :default => 0
t.string "path"
t.integer "evaluation_way", :default => 0
t.integer "difficulty", :default => 1
t.text "pipeline_script"
end
create_table "changes", :force => true do |t|
t.integer "changeset_id", :null => false
t.string "action", :limit => 1, :default => "", :null => false
@ -521,6 +574,13 @@ ActiveRecord::Schema.define(:version => 20170309024921) do
add_index "contest_messages", ["contest_id"], :name => "index_contest_messages_on_contest_id"
add_index "contest_messages", ["user_id"], :name => "index_contest_messages_on_user_id"
create_table "contest_notifications", :force => true do |t|
t.text "title"
t.text "content"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "contestant_for_contests", :force => true do |t|
t.integer "student_id"
t.integer "contest_id"
@ -588,6 +648,37 @@ ActiveRecord::Schema.define(:version => 20170309024921) do
add_index "contestant_works", ["user_id"], :name => "index_contestant_works_on_user_id"
add_index "contestant_works", ["work_id"], :name => "index_contestant_works_on_work_id"
create_table "contesting_projects", :force => true do |t|
t.integer "project_id"
t.string "contest_id"
t.integer "user_id"
t.string "description"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.string "reward"
end
create_table "contesting_softapplications", :force => true do |t|
t.integer "softapplication_id"
t.integer "contest_id"
t.integer "user_id"
t.string "description"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.string "reward"
end
create_table "contestnotifications", :force => true do |t|
t.integer "contest_id"
t.string "title"
t.string "summary"
t.text "description"
t.integer "author_id"
t.integer "notificationcomments_count"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "contests", :force => true do |t|
t.integer "user_id"
t.string "name"
@ -820,6 +911,35 @@ ActiveRecord::Schema.define(:version => 20170309024921) do
add_index "delayed_jobs", ["priority", "run_at"], :name => "delayed_jobs_priority"
create_table "delayed_jobs_20161218", :id => false, :force => true do |t|
t.integer "id", :default => 0, :null => false
t.integer "priority", :default => 0, :null => false
t.integer "attempts", :default => 0, :null => false
t.text "handler", :null => false
t.text "last_error"
t.datetime "run_at"
t.datetime "locked_at"
t.datetime "failed_at"
t.string "locked_by"
t.string "queue"
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "departments", :force => true do |t|
t.string "name"
t.integer "school_id"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
add_index "departments", ["school_id"], :name => "index_departments_on_school_id"
create_table "discipline_categories", :force => true do |t|
t.integer "major_level"
t.string "name"
end
create_table "discuss_demos", :force => true do |t|
t.string "title"
t.text "body"
@ -957,6 +1077,13 @@ ActiveRecord::Schema.define(:version => 20170309024921) do
t.integer "choice_random", :default => 0
end
create_table "first_level_disciplines", :force => true do |t|
t.integer "discipline_category_id"
t.string "name"
end
add_index "first_level_disciplines", ["discipline_category_id"], :name => "index_first_level_disciplines_on_discipline_category_id"
create_table "first_pages", :force => true do |t|
t.string "web_title"
t.string "title"
@ -1021,6 +1148,26 @@ ActiveRecord::Schema.define(:version => 20170309024921) do
t.datetime "created_at"
end
create_table "game_outputs", :force => true do |t|
t.integer "code"
t.integer "game_id"
t.text "msg"
t.text "out_put"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "games", :force => true do |t|
t.integer "myshixun_id"
t.integer "user_id"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.integer "status", :default => 0
t.integer "final_score", :default => 0
t.integer "challenge_id"
t.datetime "open_time"
end
create_table "groups_users", :id => false, :force => true do |t|
t.integer "group_id", :null => false
t.integer "user_id", :null => false
@ -1090,8 +1237,8 @@ ActiveRecord::Schema.define(:version => 20170309024921) do
t.integer "homework_type", :default => 1
t.string "late_penalty"
t.integer "course_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.integer "teacher_priority", :default => 1
t.integer "anonymous_comment", :default => 0
t.integer "quotes", :default => 0
@ -1099,6 +1246,8 @@ ActiveRecord::Schema.define(:version => 20170309024921) do
t.datetime "simi_time"
t.integer "score_open", :default => 1
t.integer "anonymous_appeal", :default => 0
t.integer "homework_bank_id"
t.boolean "is_update", :default => false
end
add_index "homework_commons", ["course_id", "id"], :name => "index_homework_commons_on_course_id_and_id"
@ -1122,11 +1271,13 @@ ActiveRecord::Schema.define(:version => 20170309024921) do
t.integer "evaluation_num"
t.integer "absence_penalty", :default => 1
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.integer "no_anon_penalty", :default => 1
t.integer "appeal_penalty", :default => 0
t.integer "ta_mode", :default => 1
t.float "te_proportion", :default => 1.0
t.boolean "final_mode", :default => false
end
create_table "homework_detail_programings", :force => true do |t|
@ -1345,6 +1496,12 @@ ActiveRecord::Schema.define(:version => 20170309024921) do
t.integer "owner_type", :default => 0
end
create_table "mark_downs", :force => true do |t|
t.text "description"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "member_roles", :force => true do |t|
t.integer "member_id", :null => false
t.integer "role_id", :null => false
@ -1437,6 +1594,27 @@ ActiveRecord::Schema.define(:version => 20170309024921) do
add_index "messages", ["parent_id"], :name => "messages_parent_id"
add_index "messages", ["root_id"], :name => "index_messages_on_root_id"
create_table "myshixun_members", :force => true do |t|
t.integer "myshixun_id"
t.integer "user_id"
t.integer "role"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "myshixuns", :force => true do |t|
t.string "name"
t.text "description"
t.integer "shixun_id"
t.boolean "is_public", :default => true
t.integer "user_id"
t.integer "gpid"
t.integer "visits", :default => 0
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.integer "status", :default => 0
end
create_table "news", :force => true do |t|
t.integer "project_id"
t.string "title", :limit => 60, :default => "", :null => false
@ -1632,6 +1810,15 @@ ActiveRecord::Schema.define(:version => 20170309024921) do
t.integer "allow_teacher", :default => 0
end
create_table "outputs", :force => true do |t|
t.integer "code"
t.integer "game_id"
t.text "msg"
t.text "out_put", :limit => 2147483647
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "phone_app_versions", :force => true do |t|
t.string "version"
t.text "description"
@ -1849,6 +2036,17 @@ ActiveRecord::Schema.define(:version => 20170309024921) do
add_index "queries", ["project_id"], :name => "index_queries_on_project_id"
add_index "queries", ["user_id"], :name => "index_queries_on_user_id"
create_table "reference_materials", :force => true do |t|
t.string "book"
t.string "editor"
t.string "press"
t.integer "syllabus_id"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
add_index "reference_materials", ["syllabus_id"], :name => "index_reference_materials_on_syllabus_id"
create_table "relative_memo_to_open_source_projects", :force => true do |t|
t.integer "osp_id"
t.integer "relative_memo_id"
@ -1903,10 +2101,37 @@ ActiveRecord::Schema.define(:version => 20170309024921) do
t.string "identifier"
t.boolean "is_default", :default => false
t.boolean "hidden", :default => false
t.integer "shixun_id"
t.integer "myshixun_id"
end
add_index "repositories", ["project_id"], :name => "index_repositories_on_project_id"
create_table "resource_banks", :force => true do |t|
t.integer "course_id"
t.integer "attachment_id"
t.string "filename"
t.string "disk_filename"
t.integer "filesize"
t.string "digest"
t.integer "downloads"
t.integer "user_id"
t.text "description"
t.string "disk_directory"
t.boolean "is_public"
t.integer "copy_from"
t.integer "quotes"
t.string "applicable_syllabus"
t.integer "major_level"
t.integer "discipline_category_id"
t.integer "first_level_discipline_id"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
add_index "resource_banks", ["course_id"], :name => "index_resource_banks_on_course_id"
add_index "resource_banks", ["user_id"], :name => "index_resource_banks_on_user_id"
create_table "rich_rich_files", :force => true do |t|
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
@ -1937,6 +2162,8 @@ ActiveRecord::Schema.define(:version => 20170309024921) do
t.string "logo_link"
t.string "pinyin"
t.integer "school_type", :default => 0
t.string "city"
t.string "address"
end
create_table "secdomains", :force => true do |t|
@ -2007,6 +2234,29 @@ ActiveRecord::Schema.define(:version => 20170309024921) do
t.datetime "updated_at", :null => false
end
create_table "shixun_members", :force => true do |t|
t.integer "user_id"
t.integer "shixun_id"
t.integer "role"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "shixuns", :force => true do |t|
t.string "name"
t.text "description"
t.text "script"
t.boolean "is_public", :default => true
t.integer "user_id"
t.integer "gpid"
t.integer "visits", :default => 0
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.integer "changeset_num"
t.integer "status", :default => 0
t.string "language"
end
create_table "softapplications", :force => true do |t|
t.string "name"
t.text "description"
@ -2187,12 +2437,23 @@ ActiveRecord::Schema.define(:version => 20170309024921) do
add_index "syllabus_members", ["syllabus_id"], :name => "index_syllabus_members_on_syllabus_id"
add_index "syllabus_members", ["user_id"], :name => "index_syllabus_members_on_user_id"
create_table "syllabus_update_records", :force => true do |t|
t.integer "user_id"
t.integer "syllabus_id"
t.integer "property"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
add_index "syllabus_update_records", ["syllabus_id"], :name => "index_syllabus_update_records_on_syllabus_id"
add_index "syllabus_update_records", ["user_id"], :name => "index_syllabus_update_records_on_user_id"
create_table "syllabuses", :force => true do |t|
t.string "title"
t.text "description"
t.integer "user_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.string "eng_name"
t.integer "syllabus_type"
t.integer "credit"
@ -2201,8 +2462,11 @@ ActiveRecord::Schema.define(:version => 20170309024921) do
t.integer "practice_hours"
t.string "applicable_major"
t.string "pre_course"
t.integer "visits", :default => 0
t.integer "des_status", :default => 0
t.integer "visits", :default => 0
t.integer "des_status", :default => 0
t.integer "major_level"
t.integer "discipline_category_id"
t.integer "first_level_discipline_id"
end
add_index "syllabuses", ["user_id"], :name => "index_syllabuses_on_user_id"
@ -2244,6 +2508,19 @@ ActiveRecord::Schema.define(:version => 20170309024921) do
t.string "extra"
end
create_table "test_sets", :force => true do |t|
t.string "input"
t.text "output"
t.integer "challenge_id"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.integer "game_id"
t.string "actual_output"
t.boolean "is_public", :default => true
t.boolean "result", :default => true
t.integer "position"
end
create_table "time_entries", :force => true do |t|
t.integer "project_id", :null => false
t.integer "user_id", :null => false
@ -2335,6 +2612,7 @@ ActiveRecord::Schema.define(:version => 20170309024921) do
t.string "location_city"
t.integer "school_id"
t.string "description", :default => ""
t.integer "department_id"
end
add_index "user_extensions", ["user_id"], :name => "index_user_extensions_on_user_id"
@ -2457,12 +2735,24 @@ ActiveRecord::Schema.define(:version => 20170309024921) do
t.integer "visits", :default => 0
t.integer "excellent_teacher", :default => 0
t.integer "excellent_student", :default => 0
t.string "phone"
t.boolean "authentication", :default => false
end
add_index "users", ["auth_source_id"], :name => "index_users_on_auth_source_id"
add_index "users", ["id", "type"], :name => "index_users_on_id_and_type"
add_index "users", ["type"], :name => "index_users_on_type"
create_table "verification_codes", :force => true do |t|
t.string "code"
t.integer "code_type"
t.integer "status"
t.string "phone"
t.string "email"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "versions", :force => true do |t|
t.integer "project_id", :default => 0, :null => false
t.string "name", :default => "", :null => false

View File

@ -92,11 +92,12 @@ namespace :homework_evaluation do
work_ids = "(" + homework_common.student_works.has_committed.map(&:id).join(",") + ")"
homework_common.student_works.where("work_status != 0").each do |student_work|
absence_penalty_count = student_work.user.student_works_evaluation_distributions.where("student_work_id IN #{work_ids}").count - student_work.user.student_works_scores.where("student_work_id IN #{work_ids} and reviewer_role = 3").count
absence_penalty_count = student_work.user.student_works_evaluation_distributions.where("student_work_id IN #{work_ids}").count - student_work.user.student_works_scores.where("student_work_id IN #{work_ids} and reviewer_role = 3").group_by(&:student_work_id).count
student_work.absence_penalty = absence_penalty_count > 0 ? absence_penalty_count * homework_detail_manual.absence_penalty : 0
student_work.save
#更新CourseHomeworkStatistics中该学生的待匿评数和缺评数
absence_penalty_count = absence_penalty_count > 0 ? absence_penalty_count : 0
course_statistics = CourseHomeworkStatistics.find_by_course_id_and_user_id(homework_common.course_id, student_work.user_id)
course_statistics.update_attribute('un_evaluation_work_num', (course_statistics.un_evaluation_work_num - absence_penalty_count) < 0 ? 0 : (course_statistics.un_evaluation_work_num - absence_penalty_count)) if course_statistics
course_statistics.update_attribute('absence_evaluation_work_num', course_statistics.absence_evaluation_work_num + absence_penalty_count) if course_statistics

View File

@ -35,20 +35,20 @@ module Trustie
def compress(size=300)
backup if @bak
begin
f = Magick::ImageList.new(@file)
if f.format != 'GIF'
width = size
if f[0].columns > width
proportion = (width/f[0].columns.to_f)
height = (f[0].rows*proportion)
f.resize_to_fill!(width,height.to_i)
f.write(@file)
end
end
rescue Exception => e
Rails.logger.error "[Error] compress : ===> #{e}"
end
# begin
# f = Magick::ImageList.new(@file)
# if f.format != 'GIF'
# width = size
# if f[0].columns > width
# proportion = (width/f[0].columns.to_f)
# height = (f[0].rows*proportion)
# f.resize_to_fill!(width,height.to_i)
# f.write(@file)
# end
# end
# rescue Exception => e
# Rails.logger.error "[Error] compress : ===> #{e}"
# end
end
def backup

View File

@ -6079,7 +6079,7 @@ _plugin('core', function(K) {
// if (imglist.length > 0){
// df(self);
// }
self.insertHtml(html, true);
self.insertHtml(html, true); // 火狐浏览器复制图片会出现2个
df(self);
}
K(doc.body).bind('paste', function(e){

View File

@ -658,7 +658,7 @@ function build_selector(max_num){
}
function build_selector_sy(max_num){
var html = "<select class='w61 fl ml15' id='sy_proportion' name='sy_proportion'>";
for(var i = 0; i <= 100; i += 10){
for(var i = 0; i <= max_num; i += 10){
if( i == max_num){
html += "<option value='" + parseFloat(i)/100 + "' selected='selected'>" + i + "%</option>";
}else{

View File

@ -86,7 +86,7 @@ h4{ font-size:14px;}/*color:#3b3b3b;*/
.markPercentage {margin:10px 0; border:1px solid #e6e6e6; width:70px; height:30px; outline:none; font-size:12px; color:#3d3c3c;}
/* Spacing */
.ml2{ margin-left:2px;}.ml3{ margin-left:3px;}.ml4{ margin-left:4px;}.ml5{ margin-left:5px;}.ml7 {margin-left:7px;}.ml8{ margin-left:8px;}.ml9{ margin-left:9px;}
.ml10{ margin-left:10px;}.ml14{ margin-left:14px;}.ml15{ margin-left:15px;}.ml16{ margin-left:16px;}.ml20{ margin-left:20px;}.ml21{ margin-left:21px;}
.ml10{ margin-left:10px;}.ml14{ margin-left:14px;}.ml15{ margin-left:15px;}.ml16{ margin-left:16px;}.ml18{ margin-left:18px;}.ml20{ margin-left:20px;}.ml21{ margin-left:21px;}
.ml24{margin-left:24px;}.ml25{margin-left:25px;}.ml30{margin-left:30px !important;}.ml35{margin-left: 35px;}.ml36{ margin-left:36px; }.ml38{ margin-left:38px;}
.ml39{ margin-left:39px;}.ml40{ margin-left:40px;}.ml41{ margin-left:41px;}.ml42{ margin-left:42px;}.ml45{ margin-left:45px;}.ml48{ margin-left:48px;}.ml50{ margin-left: 50px;}
.ml53{margin-left:53px;}.ml55{ margin-left:55px;}.ml56{ margin-left:56px !important;}.ml58{margin-left:58px;}.ml60{ margin-left:60px;}.ml65{ margin-left:65px;}
@ -424,7 +424,7 @@ a.export_icon:hover {background: url(/images/item.png) -58px -60px no-repeat;}
.icons-user-homework{background:url(/images/user/home-user-left.png) 0px -150px no-repeat; }
.homework-user-leftnav-li{ height: 25px; line-height: 40px; padding-left: 25px; color: #666;background:url(/images/user/home-user-left.png) 0px -149px no-repeat; font-size: 14px; position: relative; }
.homework-user-leftnav-li:hover{ height: 25px; line-height: 40px; padding-left: 25px; background:#f4f4f4; background:url(/images/user/home-user-left.png) 0px -186px no-repeat; font-size: 14px; position: relative; }
.separator_short{margin-top: 5px; margin-bottom: 5px; margin-left: 37px; width: 433px; display: block; border-bottom: 1px solid #d9d9d9;}
.separator_short{margin-top: 5px; margin-bottom: 5px; margin-left: 37px; width: 473px; display: block; border-bottom: 1px solid #d9d9d9;}
.separator_long{margin-top: 5px; margin-bottom: 5px; margin-left: 37px; width: 522px; display: block; border-bottom: 1px solid #d9d9d9;}
/* 模板弹框 20161013byLB */
#muban_popup_box{ background:#fff;padding-bottom:15px;-webkit-border-radius:5px;-moz-border-radius:5px;-o-border-radius:5px;border-radius:5px;box-shadow: 0px 2px 8px rgba(146, 153, 169, 0.5);}

View File

@ -470,7 +470,7 @@ a:hover.blueCir{ background:#3598db; color:#fff;}
.poll-delete:hover{ background:url(/images/course/icons.png) -17px -343px no-repeat;}
.poll-edit{ background:url(/images/course/icons.png) 0px -272px no-repeat; width:16px; height:27px; display:block;float:right;}
.poll-edit:hover{ background:url(/images/course/icons.png) -21px -272px no-repeat;}
.poll-add-menu {border:1px solid #eaeaea; background:#fff; padding:5px 8px; width:50px; left:0px; top:20px; position:absolute; z-index:9999; line-height:2; box-shadow: 0px 2px 8px rgba(146, 153, 169, 0.5); display:none;}
.poll-add-menu {border:1px solid #eaeaea; background:#fff; padding:5px 8px; width:60px; left:0px; top:20px; position:absolute; z-index:9999; line-height:2; box-shadow: 0px 2px 8px rgba(146, 153, 169, 0.5); display:none;}
.poll-multiple-limit {width:70px; outline: none;}
/*黄色边框的提示信息 */
.ye_tips_box_inner{ position: absolute;line-height: 1.5;padding: 5px 10px; white-space: nowrap; background-color: #FFFEF4; left:30px; top: -5px; border: solid 1px #F3DDB3;}

View File

@ -153,7 +153,7 @@ a:hover.btn_pu{ background:#3cb761;}
.polls_alert_box_p{ font-size:14px; padding-left: 45px;padding-top: 10px;}
.import_poll_div{width: 430px; max-height: 550px; overflow-x:hidden; overflow-y: auto; margin: 10px auto;}
.w520 {width: 520px !important;}
/*测验*/
.exercise_inputs{ color:#666;}
.exercise_inputs tr td{ width:98%; float: right;}