题库改版
This commit is contained in:
parent
832446849a
commit
0e40bf6daf
|
@ -553,7 +553,7 @@ class CoursesController < ApplicationController
|
||||||
@all_members = searchmember_by_name(student_homework_score(0, 0, 10,"desc"), q)
|
@all_members = searchmember_by_name(student_homework_score(0, 0, 10,"desc"), q)
|
||||||
end
|
end
|
||||||
|
|
||||||
@homeworks = @course.homework_commons.where("publish_time <= '#{Date.today}'").order("created_at asc")
|
@homeworks = @course.homework_commons.where("publish_time <= '#{Time.now}'").order("created_at asc")
|
||||||
filename="#{@course.teacher.lastname.to_s + @course.teacher.firstname.to_s }_#{@course.name}_#{@course.time.to_s + @course.term}#{l(:excel_member_list)}";
|
filename="#{@course.teacher.lastname.to_s + @course.teacher.firstname.to_s }_#{@course.name}_#{@course.time.to_s + @course.term}#{l(:excel_member_list)}";
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
|
@ -756,8 +756,8 @@ class CoursesController < ApplicationController
|
||||||
new_homework.name = homework.name
|
new_homework.name = homework.name
|
||||||
new_homework.user_id = User.current.id
|
new_homework.user_id = User.current.id
|
||||||
new_homework.description = homework.description
|
new_homework.description = homework.description
|
||||||
new_homework.publish_time = Date.today + 30
|
new_homework.publish_time = Time.now + 30.days
|
||||||
new_homework.end_time = Date.today + 60
|
new_homework.end_time = Time.now + 60
|
||||||
new_homework.homework_type = homework.homework_type
|
new_homework.homework_type = homework.homework_type
|
||||||
new_homework.late_penalty = homework.late_penalty
|
new_homework.late_penalty = homework.late_penalty
|
||||||
new_homework.course_id = @course.id
|
new_homework.course_id = @course.id
|
||||||
|
@ -821,7 +821,7 @@ class CoursesController < ApplicationController
|
||||||
attach_copied_obj.author_id = User.current.id
|
attach_copied_obj.author_id = User.current.id
|
||||||
attach_copied_obj.copy_from = attachment.copy_from.nil? ? attachment.id : attachment.copy_from
|
attach_copied_obj.copy_from = attachment.copy_from.nil? ? attachment.id : attachment.copy_from
|
||||||
attach_copied_obj.is_publish = 0
|
attach_copied_obj.is_publish = 0
|
||||||
attach_copied_obj.publish_time = Date.today + 30
|
attach_copied_obj.publish_time = Time.now + 30.days
|
||||||
if attach_copied_obj.attachtype == nil
|
if attach_copied_obj.attachtype == nil
|
||||||
attach_copied_obj.attachtype = 4
|
attach_copied_obj.attachtype = 4
|
||||||
end
|
end
|
||||||
|
@ -1407,7 +1407,7 @@ class CoursesController < ApplicationController
|
||||||
if @is_teacher
|
if @is_teacher
|
||||||
@homeworks = @course.homework_commons.where("name like '%#{@search}%'").order("created_at desc").limit(10).offset(@page * 10)
|
@homeworks = @course.homework_commons.where("name like '%#{@search}%'").order("created_at desc").limit(10).offset(@page * 10)
|
||||||
else
|
else
|
||||||
@homeworks = @course.homework_commons.where("name like '%#{@search}%' and publish_time <= '#{Date.today}'").order("created_at desc").limit(10).offset(@page * 10)
|
@homeworks = @course.homework_commons.where("name like '%#{@search}%' and publish_time <= '#{Time.now}'").order("created_at desc").limit(10).offset(@page * 10)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -6,8 +6,12 @@ class HomeworkCommonController < ApplicationController
|
||||||
|
|
||||||
include StudentWorkHelper
|
include StudentWorkHelper
|
||||||
before_filter :find_course, :only => [:index,:new,:create]
|
before_filter :find_course, :only => [:index,:new,:create]
|
||||||
before_filter :find_homework, :only => [:edit,:update,:alert_anonymous_comment,:start_anonymous_comment,:stop_anonymous_comment,:destroy,:start_evaluation_set,:set_evaluation_attr,:score_rule_set,:alert_forbidden_anonymous_comment,:alert_open_student_works,:open_student_works,:set_score_open,:alert_score_open_modal]
|
before_filter :find_homework, :only => [:edit,:update,:alert_anonymous_comment,:start_anonymous_comment,:stop_anonymous_comment,:destroy,:start_evaluation_set,
|
||||||
before_filter :teacher_of_course, :only => [:new, :create, :edit, :update, :destroy, :start_anonymous_comment, :stop_anonymous_comment, :alert_anonymous_comment,:start_evaluation_set,:set_evaluation_attr,:score_rule_set,:alert_forbidden_anonymous_comment,:alert_open_student_works,:open_student_works]
|
:set_evaluation_attr,:score_rule_set,:alert_forbidden_anonymous_comment,:alert_open_student_works,:open_student_works,
|
||||||
|
:set_score_open,:alert_score_open_modal,:add_to_homework_bank,:publish_homework]
|
||||||
|
before_filter :teacher_of_course, :only => [:new, :create, :edit, :update, :destroy, :start_anonymous_comment, :stop_anonymous_comment, :alert_anonymous_comment,
|
||||||
|
:start_evaluation_set,:set_evaluation_attr,:score_rule_set,:alert_forbidden_anonymous_comment,:alert_open_student_works,
|
||||||
|
:open_student_works,:add_to_homework_bank,:publish_homework]
|
||||||
before_filter :member_of_course, :only => [:index]
|
before_filter :member_of_course, :only => [:index]
|
||||||
|
|
||||||
def index
|
def index
|
||||||
|
@ -25,7 +29,7 @@ class HomeworkCommonController < ApplicationController
|
||||||
@homework_commons = @course.homework_commons.where("name like '%#{search}%'").order("created_at desc")
|
@homework_commons = @course.homework_commons.where("name like '%#{search}%'").order("created_at desc")
|
||||||
else
|
else
|
||||||
#@homeworks = @course.homework_commons.where("publish_time <= '#{Date.today}'").order("created_at desc").limit(10).offset(@page * 10)
|
#@homeworks = @course.homework_commons.where("publish_time <= '#{Date.today}'").order("created_at desc").limit(10).offset(@page * 10)
|
||||||
@homework_commons = @course.homework_commons.where("name like '%#{search}%' and publish_time <= '#{Date.today}'").order("created_at desc")
|
@homework_commons = @course.homework_commons.where("name like '%#{search}%' and publish_time <= '#{Time.now}'").order("created_at desc")
|
||||||
end
|
end
|
||||||
#update_homework_time @homework_commons
|
#update_homework_time @homework_commons
|
||||||
@is_student = User.current.logged? && (User.current.admin? || (User.current.member_of_course?(@course) && !@is_teacher))
|
@is_student = User.current.logged? && (User.current.admin? || (User.current.member_of_course?(@course) && !@is_teacher))
|
||||||
|
@ -80,89 +84,105 @@ class HomeworkCommonController < ApplicationController
|
||||||
|
|
||||||
def update
|
def update
|
||||||
if params[:homework_common]
|
if params[:homework_common]
|
||||||
|
is_update = @homework.name != params[:homework_common][:name] || @homework.description != params[:homework_common][:description] || params[:homework_type].to_i != @homework.homework_type
|
||||||
|
if params[:homework_type].to_i == 2
|
||||||
|
is_update = is_update || params[:language_type] != @homework.homework_detail_programing.language
|
||||||
|
if !is_update && params[:sample] && params[:program]
|
||||||
|
is_update = params[:sample][:input] != @homework.homework_samples.map(&:input) || params[:sample][:output] != @homework.homework_samples.map(&:output) || params[:program][:input] != @homework.homework_tests.map(&:input)|| params[:program][:output] != @homework.homework_tests.map(&:output)
|
||||||
|
end
|
||||||
|
elsif params[:homework_type].to_i == 3
|
||||||
|
base_on_project = params[:base_on_project] ? 1 : 0
|
||||||
|
is_update = is_update || params[:min_num].to_i != @homework.homework_detail_group.min_num || params[:max_num].to_i != @homework.homework_detail_group.max_num || base_on_project != @homework.homework_detail_group.base_on_project
|
||||||
|
end
|
||||||
|
@homework.is_update = @homework.is_update || is_update
|
||||||
|
|
||||||
@homework.name = params[:homework_common][:name]
|
@homework.name = params[:homework_common][:name]
|
||||||
@homework.description = params[:homework_common][:description]
|
@homework.description = params[:homework_common][:description]
|
||||||
if params[:homework_common][:publish_time] == ""
|
|
||||||
@homework.publish_time = Date.today
|
|
||||||
else
|
|
||||||
@homework.publish_time = params[:homework_common][:publish_time]
|
|
||||||
end
|
|
||||||
homework_detail_manual = @homework.homework_detail_manual || HomeworkDetailManual.new
|
homework_detail_manual = @homework.homework_detail_manual || HomeworkDetailManual.new
|
||||||
param_end_time = Time.parse(params[:homework_common][:end_time]).strftime("%Y-%m-%d")
|
if params[:homework_common][:end_time] != ""
|
||||||
homework_end_time = @homework.end_time ? Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") : ''
|
if params[:homework_common][:publish_time] == ""
|
||||||
if homework_end_time != param_end_time
|
@homework.publish_time = Time.now
|
||||||
if homework_end_time > param_end_time
|
|
||||||
@homework.student_works.where("work_status = 1").each do |st|
|
|
||||||
if param_end_time < Time.parse(st.commit_time.to_s).strftime("%Y-%m-%d")
|
|
||||||
st.late_penalty = @homework.late_penalty
|
|
||||||
st.work_status = 2
|
|
||||||
st.save
|
|
||||||
#更新CourseHomeworkStatistics中学生的迟交作品数
|
|
||||||
course_statistics = CourseHomeworkStatistics.find_by_course_id_and_user_id(@homework.course_id, st.user_id)
|
|
||||||
course_statistics.update_attribute('late_commit_work_num', course_statistics.late_commit_work_num + 1) if course_statistics
|
|
||||||
end
|
|
||||||
end
|
|
||||||
else
|
else
|
||||||
@homework.student_works.where("work_status = 2").each do |st|
|
@homework.publish_time = params[:homework_common][:publish_time]
|
||||||
if param_end_time >= Time.parse(st.commit_time.to_s).strftime("%Y-%m-%d")
|
end
|
||||||
st.late_penalty = 0
|
param_end_time = Time.parse(params[:homework_common][:end_time])
|
||||||
st.work_status = 1
|
homework_end_time = @homework.end_time ? @homework.end_time : ''
|
||||||
st.save
|
if homework_end_time != param_end_time
|
||||||
#更新CourseHomeworkStatistics中学生的迟交作品数
|
if homework_end_time > param_end_time
|
||||||
course_statistics = CourseHomeworkStatistics.find_by_course_id_and_user_id(@homework.course_id, st.user_id)
|
@homework.student_works.where("work_status = 1").each do |st|
|
||||||
course_statistics.update_attribute('late_commit_work_num', (course_statistics.late_commit_work_num - 1) < 0 ? 0 : (course_statistics.late_commit_work_num - 1)) if course_statistics
|
if param_end_time < st.commit_time
|
||||||
|
st.late_penalty = @homework.late_penalty
|
||||||
|
st.work_status = 2
|
||||||
|
st.save
|
||||||
|
#更新CourseHomeworkStatistics中学生的迟交作品数
|
||||||
|
course_statistics = CourseHomeworkStatistics.find_by_course_id_and_user_id(@homework.course_id, st.user_id)
|
||||||
|
course_statistics.update_attribute('late_commit_work_num', course_statistics.late_commit_work_num + 1) if course_statistics
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
@homework.student_works.where("work_status = 2").each do |st|
|
||||||
|
if param_end_time >= Time.parse(st.commit_time.to_s).strftime("%Y-%m-%d")
|
||||||
|
st.late_penalty = 0
|
||||||
|
st.work_status = 1
|
||||||
|
st.save
|
||||||
|
#更新CourseHomeworkStatistics中学生的迟交作品数
|
||||||
|
course_statistics = CourseHomeworkStatistics.find_by_course_id_and_user_id(@homework.course_id, st.user_id)
|
||||||
|
course_statistics.update_attribute('late_commit_work_num', (course_statistics.late_commit_work_num - 1) < 0 ? 0 : (course_statistics.late_commit_work_num - 1)) if course_statistics
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@homework.end_time = params[:homework_common][:end_time] || Time.now
|
||||||
|
|
||||||
|
status = false
|
||||||
|
if @homework.publish_time > Time.now && homework_detail_manual.comment_status == 1
|
||||||
|
homework_detail_manual.comment_status = 0
|
||||||
|
@homework.student_works.destroy_all
|
||||||
|
#更新CourseHomeworkStatistics中每个学生的未交作品数
|
||||||
|
@homework.course.student.each do |student|
|
||||||
|
course_statistics = CourseHomeworkStatistics.find_by_course_id_and_user_id(@homework.course_id, student.student_id)
|
||||||
|
course_statistics.update_attribute('un_commit_work_num', (course_statistics.un_commit_work_num - 1) < 0 ? 0 : (course_statistics.un_commit_work_num - 1)) if course_statistics
|
||||||
|
end
|
||||||
|
elsif @homework.publish_time <= Time.now && homework_detail_manual.comment_status == 0
|
||||||
|
homework_detail_manual.comment_status = 1
|
||||||
|
create_works_list @homework if params[:homework_type].to_i != 3
|
||||||
|
status = true
|
||||||
|
#更新CourseHomeworkStatistics中每个学生的未交作品数
|
||||||
|
@homework.course.student.each do |student|
|
||||||
|
course_statistics = CourseHomeworkStatistics.find_by_course_id_and_user_id(@homework.course_id, student.student_id)
|
||||||
|
course_statistics.update_attribute('un_commit_work_num', course_statistics.un_commit_work_num + 1) if course_statistics
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
eval_start = homework_detail_manual.evaluation_start
|
||||||
|
if eval_start.nil? || (Time.parse(eval_start.to_s) <= @homework.end_time && homework_detail_manual.comment_status <= 1)
|
||||||
|
homework_detail_manual.evaluation_start = @homework.end_time + 7
|
||||||
|
homework_detail_manual.evaluation_end = homework_detail_manual.evaluation_start + 7
|
||||||
|
end
|
||||||
end
|
end
|
||||||
@homework.end_time = params[:homework_common][:end_time] || Time.now
|
|
||||||
@homework.course_id = params[:course_id]
|
|
||||||
if params[:homework_type] && params[:homework_type].to_i != @homework.homework_type
|
if params[:homework_type] && params[:homework_type].to_i != @homework.homework_type
|
||||||
if @homework.homework_type == 2
|
if @homework.homework_type == 2
|
||||||
@homework.homework_detail_programing.destroy if @homework.homework_detail_programing
|
@homework.homework_detail_programing.destroy if @homework.homework_detail_programing
|
||||||
@homework.homework_tests.destroy_all
|
@homework.homework_tests.destroy_all
|
||||||
elsif @homework.homework_type == 3
|
elsif @homework.homework_type == 3
|
||||||
@homework.homework_detail_group.destroy if @homework.homework_detail_group
|
@homework.homework_detail_group.destroy if @homework.homework_detail_group
|
||||||
create_works_list @homework
|
create_works_list @homework if homework_detail_manual.comment_status > 0 && @homework.student_works.empty?
|
||||||
end
|
end
|
||||||
if params[:homework_type].to_i == 3
|
if params[:homework_type].to_i == 3
|
||||||
@homework.student_works.destroy_all
|
@homework.student_works.destroy_all
|
||||||
end
|
end
|
||||||
|
@homework.homework_type = params[:homework_type].to_i
|
||||||
end
|
end
|
||||||
@homework.homework_type = params[:homework_type].to_i || @homework.homework_type
|
|
||||||
anonymous = params[:homework_common][:anonymous_comment] ? params[:homework_common][:anonymous_comment].to_i : 1
|
anonymous = params[:homework_common][:anonymous_comment] ? params[:homework_common][:anonymous_comment].to_i : 1
|
||||||
if anonymous != @homework.anonymous_comment
|
if anonymous != @homework.anonymous_comment
|
||||||
if anonymous == 1
|
if anonymous == 1
|
||||||
homework_detail_manual.ta_proportion = @homework.homework_type == 2 ? 0.4 : 1.0
|
homework_detail_manual.ta_proportion = @homework.homework_type == 2 ? 0.4 : 1.0
|
||||||
else
|
else
|
||||||
homework_detail_manual.ta_proportion = @homework.homework_type == 2 ? 0.3 : 0.6
|
homework_detail_manual.ta_proportion = @homework.homework_type == 2 ? 0.3 : 0.6
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
status = false
|
|
||||||
if @homework.publish_time > Date.today && homework_detail_manual.comment_status == 1
|
|
||||||
homework_detail_manual.comment_status = 0
|
|
||||||
@homework.student_works.destroy_all
|
|
||||||
#更新CourseHomeworkStatistics中每个学生的未交作品数
|
|
||||||
@homework.course.student.each do |student|
|
|
||||||
course_statistics = CourseHomeworkStatistics.find_by_course_id_and_user_id(@homework.course_id, student.student_id)
|
|
||||||
course_statistics.update_attribute('un_commit_work_num', (course_statistics.un_commit_work_num - 1) < 0 ? 0 : (course_statistics.un_commit_work_num - 1)) if course_statistics
|
|
||||||
end
|
|
||||||
elsif @homework.publish_time <= Date.today && homework_detail_manual.comment_status == 0
|
|
||||||
homework_detail_manual.comment_status = 1
|
|
||||||
create_works_list @homework
|
|
||||||
status = true
|
|
||||||
#更新CourseHomeworkStatistics中每个学生的未交作品数
|
|
||||||
@homework.course.student.each do |student|
|
|
||||||
course_statistics = CourseHomeworkStatistics.find_by_course_id_and_user_id(@homework.course_id, student.student_id)
|
|
||||||
course_statistics.update_attribute('un_commit_work_num', course_statistics.un_commit_work_num + 1) if course_statistics
|
|
||||||
end
|
|
||||||
end
|
|
||||||
eval_start = homework_detail_manual.evaluation_start
|
|
||||||
if eval_start.nil? || (eval_start <= @homework.end_time && homework_detail_manual.comment_status <= 1)
|
|
||||||
homework_detail_manual.evaluation_start = @homework.end_time + 7
|
|
||||||
homework_detail_manual.evaluation_end = homework_detail_manual.evaluation_start + 7
|
|
||||||
end
|
|
||||||
@homework.save_attachments(params[:attachments])
|
@homework.save_attachments(params[:attachments])
|
||||||
render_attachment_warning_if_needed(@homework)
|
render_attachment_warning_if_needed(@homework)
|
||||||
|
|
||||||
|
@ -223,9 +243,9 @@ class HomeworkCommonController < ApplicationController
|
||||||
@homework_detail_programing.save if @homework_detail_programing
|
@homework_detail_programing.save if @homework_detail_programing
|
||||||
@homework_detail_group.save if @homework_detail_group
|
@homework_detail_group.save if @homework_detail_group
|
||||||
|
|
||||||
if @homework.homework_type != 3 && homework_detail_manual.comment_status == 1 && status
|
# if @homework.homework_type != 3 && homework_detail_manual.comment_status == 1 && status
|
||||||
create_works_list @homework
|
# create_works_list @homework
|
||||||
end
|
# end
|
||||||
|
|
||||||
@hw_status = params[:hw_status].to_i
|
@hw_status = params[:hw_status].to_i
|
||||||
if params[:is_manage] == "1"
|
if params[:is_manage] == "1"
|
||||||
|
@ -292,6 +312,77 @@ class HomeworkCommonController < ApplicationController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
#加入到题库
|
||||||
|
def add_to_homework_bank
|
||||||
|
if params[:type] && (params[:type].to_i == 1 || params[:type].to_i == 3)
|
||||||
|
homework_bank = add_to_homework_bank_f @homework
|
||||||
|
homework_bank.save
|
||||||
|
@homework.update_attributes(:homework_bank_id => homework_bank.id)
|
||||||
|
elsif params[:type].to_i == 2
|
||||||
|
homework_bank = HomeworkBank.where(:id => @homework.homework_bank_id).first
|
||||||
|
if homework_bank
|
||||||
|
homework_bank.update_attributes(:name => @homework.name, :description => @homework.description, :homework_type => @homework.homework_type)
|
||||||
|
if @homework.homework_type == 2 && @homework.homework_detail_programing
|
||||||
|
homework_bank.update_attributes(:language => @homework.homework_detail_programing.language)
|
||||||
|
homework_bank.homework_bank_tests.destroy_all
|
||||||
|
@homework.homework_tests.each_with_index do |homework_test|
|
||||||
|
homework_bank.homework_bank_tests << HomeworkBankTest.new(
|
||||||
|
test_type: 1,
|
||||||
|
input: homework_test.input,
|
||||||
|
output: homework_test.output
|
||||||
|
)
|
||||||
|
end
|
||||||
|
@homework.homework_samples.each_with_index do |homework_test|
|
||||||
|
homework_bank.homework_bank_tests << HomeworkBankTest.new(
|
||||||
|
test_type: 0,
|
||||||
|
input: homework_test.input,
|
||||||
|
output: homework_test.output
|
||||||
|
)
|
||||||
|
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
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if @homework.is_update
|
||||||
|
@homework.update_attributes(:is_update => 0)
|
||||||
|
end
|
||||||
|
@user_activity_id = params[:user_activity_id].to_i
|
||||||
|
@hw_status = params[:hw_status].to_i
|
||||||
|
@is_teacher = User.current.admin? || User.current.allowed_to?(:as_teacher, @course)
|
||||||
|
end
|
||||||
|
|
||||||
|
def publish_homework
|
||||||
|
if @homework.homework_detail_manual.comment_status > 0
|
||||||
|
@status = 1
|
||||||
|
elsif @homework.publish_time.nil?
|
||||||
|
@status = 2
|
||||||
|
else
|
||||||
|
homework_detail_manual = @homework.homework_detail_manual
|
||||||
|
homework_detail_manual.update_column('comment_status', 1)
|
||||||
|
@homework.update_attributes(:publish_time => Time.now)
|
||||||
|
@status = 3
|
||||||
|
if @homework.homework_type != 3
|
||||||
|
create_works_list @homework
|
||||||
|
end
|
||||||
|
#更新CourseHomeworkStatistics中每个学生的未交作品数
|
||||||
|
@course.student.each do |student|
|
||||||
|
course_statistics = CourseHomeworkStatistics.find_by_course_id_and_user_id(@homework.course_id, student.student_id)
|
||||||
|
course_statistics.update_attribute('un_commit_work_num', course_statistics.un_commit_work_num + 1) if course_statistics
|
||||||
|
end
|
||||||
|
|
||||||
|
@course.members.each do |m|
|
||||||
|
@homework.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => @course.id, :viewed => false, :status => nil)
|
||||||
|
end
|
||||||
|
if @homework.course_acts.size == 0
|
||||||
|
@homework.course_acts << CourseActivity.new(:user_id => @homework.user_id,:course_id => @homework.course_id)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
@user_activity_id = params[:user_activity_id].to_i
|
||||||
|
@hw_status = params[:hw_status].to_i
|
||||||
|
@is_teacher = User.current.admin? || User.current.allowed_to?(:as_teacher, @course)
|
||||||
|
end
|
||||||
|
|
||||||
# 成绩公开范围弹框
|
# 成绩公开范围弹框
|
||||||
def alert_score_open_modal
|
def alert_score_open_modal
|
||||||
if params[:user_activity_id]
|
if params[:user_activity_id]
|
||||||
|
@ -313,7 +404,7 @@ class HomeworkCommonController < ApplicationController
|
||||||
#statue 1:启动成功,2:启动失败,作业总数大于等于2份时才能启动匿评,3:已开启匿评,请务重复开启,4:没有开启匿评的权限
|
#statue 1:启动成功,2:启动失败,作业总数大于等于2份时才能启动匿评,3:已开启匿评,请务重复开启,4:没有开启匿评的权限
|
||||||
def start_anonymous_comment
|
def start_anonymous_comment
|
||||||
@statue = 4 and return unless User.current.admin? || User.current.allowed_to?(:as_teacher,@course)
|
@statue = 4 and return unless User.current.admin? || User.current.allowed_to?(:as_teacher,@course)
|
||||||
@statue = 5 and return if Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d")
|
@statue = 5 and return if @homework.end_time >= Time.now
|
||||||
if @homework_detail_manual.comment_status == 1
|
if @homework_detail_manual.comment_status == 1
|
||||||
student_works = @homework.student_works.has_committed
|
student_works = @homework.student_works.has_committed
|
||||||
if student_works && student_works.size >= 2
|
if student_works && student_works.size >= 2
|
||||||
|
|
|
@ -41,7 +41,7 @@ class StudentWorkController < ApplicationController
|
||||||
else
|
else
|
||||||
student_work.name = params[:title]
|
student_work.name = params[:title]
|
||||||
student_work.description = params[:src]
|
student_work.description = params[:src]
|
||||||
if Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(Time.now.to_s).strftime("%Y-%m-%d")
|
if @homework.end_time < Time.now.to_s
|
||||||
student_work.late_penalty = @homework.late_penalty
|
student_work.late_penalty = @homework.late_penalty
|
||||||
else
|
else
|
||||||
student_work.late_penalty = 0
|
student_work.late_penalty = 0
|
||||||
|
@ -160,7 +160,7 @@ class StudentWorkController < ApplicationController
|
||||||
student_work.name = params[:title]
|
student_work.name = params[:title]
|
||||||
student_work.description = params[:src]
|
student_work.description = params[:src]
|
||||||
|
|
||||||
if Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(Time.now.to_s).strftime("%Y-%m-%d")
|
if @homework.end_time < Time.now.to_s
|
||||||
student_work.late_penalty = @homework.late_penalty
|
student_work.late_penalty = @homework.late_penalty
|
||||||
else
|
else
|
||||||
student_work.late_penalty = 0
|
student_work.late_penalty = 0
|
||||||
|
@ -365,7 +365,7 @@ class StudentWorkController < ApplicationController
|
||||||
end
|
end
|
||||||
##################################################################################################################
|
##################################################################################################################
|
||||||
@order,@b_sort,@name,@group = params[:order] || "score",params[:sort] || "desc",params[:name].to_s.strip || "",params[:group]
|
@order,@b_sort,@name,@group = params[:order] || "score",params[:sort] || "desc",params[:name].to_s.strip || "",params[:group]
|
||||||
@homework_commons = @course.homework_commons.where("publish_time <= ?",Time.now.strftime("%Y-%m-%d")).order("created_at desc")
|
@homework_commons = @course.homework_commons.where("publish_time <= ?",Time.now).order("created_at desc")
|
||||||
@all_homework_commons = @course.homework_commons.order("created_at desc")
|
@all_homework_commons = @course.homework_commons.order("created_at desc")
|
||||||
@is_teacher = User.current.allowed_to?(:as_teacher,@course) || User.current.admin?
|
@is_teacher = User.current.allowed_to?(:as_teacher,@course) || User.current.admin?
|
||||||
@is_evaluation = @homework.homework_detail_manual && @homework.homework_detail_manual.comment_status == 2 && !@is_teacher #是不是匿评
|
@is_evaluation = @homework.homework_detail_manual && @homework.homework_detail_manual.comment_status == 2 && !@is_teacher #是不是匿评
|
||||||
|
@ -398,7 +398,7 @@ class StudentWorkController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
#开放作品 || 老师 || 超级管理员 || 禁用匿评&&作业截止&&已提交作品 显示所有列表
|
#开放作品 || 老师 || 超级管理员 || 禁用匿评&&作业截止&&已提交作品 显示所有列表
|
||||||
if (@homework.is_open == 1 && @course.is_public == 1) || (@homework.is_open == 1 && @course.is_public == 0 && User.current.member_of_course?(@course)) || @is_teacher || User.current.admin? || (User.current.member_of_course?(@course) && @homework.anonymous_comment == 1 && Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.now.strftime("%Y-%m-%d") && !@homework.student_works.has_committed.where(:user_id => User.current.id).empty?)
|
if (@homework.is_open == 1 && @course.is_public == 1) || (@homework.is_open == 1 && @course.is_public == 0 && User.current.member_of_course?(@course)) || @is_teacher || User.current.admin? || (User.current.member_of_course?(@course) && @homework.anonymous_comment == 1 && @homework.end_time < Time.now && !@homework.student_works.has_committed.where(:user_id => User.current.id).empty?)
|
||||||
if @order == 'lastname'
|
if @order == 'lastname'
|
||||||
@stundet_works = search_homework_member @homework.student_works.no_copy.select("student_works.*,student_works.work_score as score").joins(:user).where("users.id in #{student_in_group}").order("CONVERT(lastname USING gbk) COLLATE gbk_chinese_ci #{@b_sort}, login #{@b_sort}"),@name
|
@stundet_works = search_homework_member @homework.student_works.no_copy.select("student_works.*,student_works.work_score as score").joins(:user).where("users.id in #{student_in_group}").order("CONVERT(lastname USING gbk) COLLATE gbk_chinese_ci #{@b_sort}, login #{@b_sort}"),@name
|
||||||
elsif @order == 'student_id'
|
elsif @order == 'student_id'
|
||||||
|
@ -464,7 +464,7 @@ class StudentWorkController < ApplicationController
|
||||||
|
|
||||||
@student_work_count = (search_homework_member @homework.student_works.has_committed.select("student_works.*,student_works.work_score as score").joins(:user).where("users.id in #{student_in_group}").order("#{@order} #{@b_sort}"),@name).count
|
@student_work_count = (search_homework_member @homework.student_works.has_committed.select("student_works.*,student_works.work_score as score").joins(:user).where("users.id in #{student_in_group}").order("#{@order} #{@b_sort}"),@name).count
|
||||||
else
|
else
|
||||||
if (@homework.is_open == 1 &&@course.is_public == 1) || (@homework.is_open == 1 && @course.is_public == 0 && User.current.member_of_course?(@course)) || @is_teacher || User.current.admin? || (User.current.member_of_course?(@course) && @homework.anonymous_comment == 1 && Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.now.strftime("%Y-%m-%d") && !@homework.student_works.has_committed.where(:user_id => User.current.id).empty?)
|
if (@homework.is_open == 1 &&@course.is_public == 1) || (@homework.is_open == 1 && @course.is_public == 0 && User.current.member_of_course?(@course)) || @is_teacher || User.current.admin? || (User.current.member_of_course?(@course) && @homework.anonymous_comment == 1 && @homework.end_time < Time.now && !@homework.student_works.has_committed.where(:user_id => User.current.id).empty?)
|
||||||
if @order == 'lastname'
|
if @order == 'lastname'
|
||||||
@stundet_works = search_homework_member @homework.student_works.no_copy.select("student_works.*,student_works.work_score as score").joins(:user).order("CONVERT(lastname USING gbk) COLLATE gbk_chinese_ci #{@b_sort}, login #{@b_sort}"),@name
|
@stundet_works = search_homework_member @homework.student_works.no_copy.select("student_works.*,student_works.work_score as score").joins(:user).order("CONVERT(lastname USING gbk) COLLATE gbk_chinese_ci #{@b_sort}, login #{@b_sort}"),@name
|
||||||
elsif @order == 'student_id'
|
elsif @order == 'student_id'
|
||||||
|
@ -596,7 +596,7 @@ class StudentWorkController < ApplicationController
|
||||||
student_work.project_id = @student_work_project.project_id
|
student_work.project_id = @student_work_project.project_id
|
||||||
end
|
end
|
||||||
#提交作品时,计算是否迟交
|
#提交作品时,计算是否迟交
|
||||||
if Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(Time.now.to_s).strftime("%Y-%m-%d")
|
if @homework.end_time < Time.now.to_s
|
||||||
student_work.late_penalty = @homework.late_penalty
|
student_work.late_penalty = @homework.late_penalty
|
||||||
student_work.work_status = 2
|
student_work.work_status = 2
|
||||||
# 缺评扣分
|
# 缺评扣分
|
||||||
|
@ -669,7 +669,7 @@ class StudentWorkController < ApplicationController
|
||||||
|
|
||||||
def edit
|
def edit
|
||||||
@user = User.current
|
@user = User.current
|
||||||
if (!User.current.admin? && @homework.homework_type == 2) || Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.now.strftime("%Y-%m-%d") #编程作业不能修改作业|| 截止日期已到不能修改作业
|
if (!User.current.admin? && @homework.homework_type == 2) || @homework.end_time < Time.now #编程作业不能修改作业|| 截止日期已到不能修改作业
|
||||||
render_403
|
render_403
|
||||||
else
|
else
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
|
@ -1131,7 +1131,7 @@ class StudentWorkController < ApplicationController
|
||||||
|
|
||||||
unless @homework.late_penalty.to_s == params[:late_penalty].to_s
|
unless @homework.late_penalty.to_s == params[:late_penalty].to_s
|
||||||
@homework.late_penalty = params[:late_penalty].to_s
|
@homework.late_penalty = params[:late_penalty].to_s
|
||||||
@homework.student_works.where("commit_time > '#{@homework.end_time} 23:59:59'").each do |student_work|
|
@homework.student_works.where("commit_time > '#{@homework.end_time}'").each do |student_work|
|
||||||
student_work.late_penalty = params[:late_penalty].to_i
|
student_work.late_penalty = params[:late_penalty].to_i
|
||||||
student_work.save
|
student_work.save
|
||||||
end
|
end
|
||||||
|
|
|
@ -118,7 +118,7 @@ class SyllabusesController < ApplicationController
|
||||||
if @order.to_i == 2
|
if @order.to_i == 2
|
||||||
@type = 2
|
@type = 2
|
||||||
@courses.each do |course|
|
@courses.each do |course|
|
||||||
course[:infocount] = (User.current.admin? || User.current.allowed_to?(:as_teacher,course)) ? (course.homework_commons.count + visable_attachemnts_incourse(course).count) : (course.homework_commons.where("publish_time <= '#{Date.today}'").count + visable_attachemnts_incourse(course).count)
|
course[:infocount] = (User.current.admin? || User.current.allowed_to?(:as_teacher,course)) ? (course.homework_commons.count + visable_attachemnts_incourse(course).count) : (course.homework_commons.where("publish_time <= '#{Time.now}'").count + visable_attachemnts_incourse(course).count)
|
||||||
if course[:infocount] < 0
|
if course[:infocount] < 0
|
||||||
course[:infocount] = 0
|
course[:infocount] = 0
|
||||||
end
|
end
|
||||||
|
|
|
@ -907,17 +907,19 @@ class UsersController < ApplicationController
|
||||||
|
|
||||||
#用户作业列表
|
#用户作业列表
|
||||||
def user_homeworks
|
def user_homeworks
|
||||||
@order,@b_sort = params[:order] || "publish_time",params[:sort] || "desc"
|
@order,@b_sort = params[:order] || "created_at",params[:sort] || "desc"
|
||||||
@user = User.current
|
@user = User.current
|
||||||
@r_sort = @b_sort == "desc" ? "asc" : "desc"
|
@r_sort = @b_sort == "desc" ? "asc" : "desc"
|
||||||
if(params[:type].blank? || params[:type] == "1") #我的题库
|
if(params[:type].blank? || params[:type] == "1") #我的题库
|
||||||
courses = @user.courses.where("is_delete = 1")
|
# courses = @user.courses.where("is_delete = 1")
|
||||||
course_ids = courses.empty? ? "(-1)" : "(" + courses.map{|course| course.id}.join(",") + ")"
|
# course_ids = courses.empty? ? "(-1)" : "(" + courses.map{|course| course.id}.join(",") + ")"
|
||||||
@homeworks = HomeworkCommon.where("user_id = #{@user.id} and course_id not in #{course_ids}").order("#{@order} #{@b_sort}")
|
# @homeworks = HomeworkCommon.where("user_id = #{@user.id} and course_id not in #{course_ids}").order("#{@order} #{@b_sort}")
|
||||||
|
@homeworks = @user.homework_banks.order("#{@order} #{@b_sort}")
|
||||||
elsif params[:type] == "2" #公共题库
|
elsif params[:type] == "2" #公共题库
|
||||||
visible_course = Course.where("is_delete = 0")
|
# visible_course = Course.where("is_delete = 0")
|
||||||
visible_course_ids = visible_course.empty? ? "(-1)" : "(" + visible_course.map{|course| course.id}.join(",") + ")"
|
# visible_course_ids = visible_course.empty? ? "(-1)" : "(" + visible_course.map{|course| course.id}.join(",") + ")"
|
||||||
@homeworks = HomeworkCommon.where("course_id in #{visible_course_ids} and publish_time <= '#{Date.today}'").order("#{@order} #{@b_sort}")
|
# @homeworks = HomeworkCommon.where("course_id in #{visible_course_ids} and publish_time <= '#{Date.today}'").order("#{@order} #{@b_sort}")
|
||||||
|
@homeworks = HomeworkBank.where(:is_public => true).order("#{@order} #{@b_sort}")
|
||||||
end
|
end
|
||||||
@type = params[:type] ? params[:type] : '1'
|
@type = params[:type] ? params[:type] : '1'
|
||||||
@limit = 10
|
@limit = 10
|
||||||
|
@ -941,7 +943,7 @@ class UsersController < ApplicationController
|
||||||
visibleCourse = @user.courses.empty? ? [] : @user.courses.where("is_delete = 0").visible
|
visibleCourse = @user.courses.empty? ? [] : @user.courses.where("is_delete = 0").visible
|
||||||
homework_ids = []
|
homework_ids = []
|
||||||
visibleCourse.each do |course|
|
visibleCourse.each do |course|
|
||||||
homeworks = HomeworkCommon.where("course_id = #{course.id} and publish_time <= '#{Date.today}'")
|
homeworks = HomeworkCommon.where("course_id = #{course.id} and publish_time <= '#{Time.now}'")
|
||||||
homework_ids << homeworks.pluck(:id) unless homeworks.empty?
|
homework_ids << homeworks.pluck(:id) unless homeworks.empty?
|
||||||
end
|
end
|
||||||
visible_homework_ids = homework_ids.size == 0 ? "(-1)" :"(" + homework_ids.join(",") + ")"
|
visible_homework_ids = homework_ids.size == 0 ? "(-1)" :"(" + homework_ids.join(",") + ")"
|
||||||
|
@ -958,7 +960,7 @@ class UsersController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def choose_user_course
|
def choose_user_course
|
||||||
homework = HomeworkCommon.find params[:homework].to_i
|
#homework = HomeworkCommon.find params[:homework].to_i
|
||||||
# if homework.user != User.current && homework.course.is_public == 0 && !User.current.allowed_to?(:as_teacher,homework.course)
|
# if homework.user != User.current && homework.course.is_public == 0 && !User.current.allowed_to?(:as_teacher,homework.course)
|
||||||
# ah = ApplyHomework.where("user_id = ? and homework_common_id = ?", User.current.id, params[:send_id].to_i)
|
# ah = ApplyHomework.where("user_id = ? and homework_common_id = ?", User.current.id, params[:send_id].to_i)
|
||||||
# if ah.empty?
|
# if ah.empty?
|
||||||
|
@ -969,9 +971,9 @@ class UsersController < ApplicationController
|
||||||
# end
|
# end
|
||||||
if !params[:search].nil?
|
if !params[:search].nil?
|
||||||
search = "%#{params[:search].to_s.strip.downcase}%"
|
search = "%#{params[:search].to_s.strip.downcase}%"
|
||||||
@course = @user.courses.where("is_delete = 0 and #{Course.table_name}.id != #{homework.course_id} and (#{Course.table_name}.id = #{params[:search].to_i } or #{Course.table_name}.name like :p)",:p=>search).select { |course| @user.allowed_to?(:as_teacher,course)}
|
@course = @user.courses.where("is_delete = 0 and (#{Course.table_name}.id = #{params[:search].to_i } or #{Course.table_name}.name like :p)",:p=>search).select { |course| @user.allowed_to?(:as_teacher,course)}
|
||||||
else
|
else
|
||||||
@course = @user.courses.where("is_delete = 0 and #{Course.table_name}.id != #{homework.course_id}").select { |course| @user.allowed_to?(:as_teacher,course)}
|
@course = @user.courses.where("is_delete = 0").select { |course| @user.allowed_to?(:as_teacher,course)}
|
||||||
end
|
end
|
||||||
@search = params[:search]
|
@search = params[:search]
|
||||||
#这里仅仅是传递需要发送的资源id
|
#这里仅仅是传递需要发送的资源id
|
||||||
|
@ -982,7 +984,7 @@ class UsersController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def send_homework_to_course
|
def send_homework_to_course
|
||||||
homework = HomeworkCommon.find params[:send_id].to_i
|
homework = HomeworkBank.find params[:send_id].to_i
|
||||||
course_ids = params[:course_ids]
|
course_ids = params[:course_ids]
|
||||||
course_ids.each do |course_id|
|
course_ids.each do |course_id|
|
||||||
course = Course.find course_id.to_i
|
course = Course.find course_id.to_i
|
||||||
|
@ -991,49 +993,60 @@ class UsersController < ApplicationController
|
||||||
new_homework.user_id = User.current.id
|
new_homework.user_id = User.current.id
|
||||||
new_homework.description = homework.description
|
new_homework.description = homework.description
|
||||||
new_homework.homework_type = homework.homework_type
|
new_homework.homework_type = homework.homework_type
|
||||||
new_homework.late_penalty = homework.late_penalty
|
new_homework.late_penalty = 0
|
||||||
new_homework.course_id = course.id
|
new_homework.course_id = course.id
|
||||||
new_homework.teacher_priority = homework.teacher_priority
|
new_homework.teacher_priority = 1
|
||||||
new_homework.anonymous_comment = homework.anonymous_comment
|
new_homework.anonymous_comment = 1
|
||||||
new_homework.quotes = 0
|
new_homework.quotes = 0
|
||||||
new_homework.is_open = homework.is_open
|
new_homework.is_open = 0
|
||||||
homework.attachments.each do |attachment|
|
# homework.attachments.each do |attachment|
|
||||||
att = attachment.copy
|
# att = attachment.copy
|
||||||
att.container_id = nil
|
# att.container_id = nil
|
||||||
att.container_type = nil
|
# att.container_type = nil
|
||||||
att.copy_from = attachment.id
|
# att.copy_from = attachment.id
|
||||||
att.save
|
# att.save
|
||||||
new_homework.attachments << att
|
# new_homework.attachments << att
|
||||||
end
|
# end
|
||||||
homework_detail_manual = homework.homework_detail_manual
|
#homework_detail_manual = homework.homework_detail_manual
|
||||||
homework_detail_programing = homework.homework_detail_programing
|
#homework_detail_programing = homework.homework_detail_programing
|
||||||
homework_detail_group = homework.homework_detail_group
|
#homework_detail_group = homework.homework_detail_group
|
||||||
if homework_detail_manual
|
#if homework_detail_manual
|
||||||
new_homework.homework_detail_manual = HomeworkDetailManual.new
|
new_homework.homework_detail_manual = HomeworkDetailManual.new
|
||||||
new_homework_detail_manual = new_homework.homework_detail_manual
|
new_homework_detail_manual = new_homework.homework_detail_manual
|
||||||
new_homework_detail_manual.ta_proportion = homework_detail_manual.ta_proportion
|
new_homework_detail_manual.ta_proportion = new_homework.homework_type == 2 ? 0.4 : 1.0
|
||||||
new_homework_detail_manual.comment_status = 0
|
new_homework_detail_manual.comment_status = 0
|
||||||
new_homework_detail_manual.evaluation_num = homework_detail_manual.evaluation_num
|
new_homework_detail_manual.evaluation_num = 3
|
||||||
new_homework_detail_manual.absence_penalty = homework_detail_manual.absence_penalty
|
new_homework_detail_manual.absence_penalty = 0
|
||||||
end
|
#end
|
||||||
if homework_detail_programing
|
#if homework_detail_programing
|
||||||
|
if new_homework.homework_type == 2
|
||||||
new_homework.homework_detail_programing = HomeworkDetailPrograming.new
|
new_homework.homework_detail_programing = HomeworkDetailPrograming.new
|
||||||
new_homework.homework_detail_programing.ta_proportion = homework_detail_programing.ta_proportion
|
new_homework.homework_detail_programing.ta_proportion = 0.6
|
||||||
new_homework.homework_detail_programing.language = homework_detail_programing.language
|
new_homework.homework_detail_programing.language = homework.language
|
||||||
homework.homework_tests.each_with_index do |homework_test|
|
homework.homework_bank_tests.each_with_index do |homework_test|
|
||||||
new_homework.homework_tests << HomeworkTest.new(
|
if homework_test.test_type
|
||||||
input: homework_test.input,
|
new_homework.homework_tests << HomeworkTest.new(
|
||||||
output: homework_test.output
|
input: homework_test.input,
|
||||||
)
|
output: homework_test.output
|
||||||
|
)
|
||||||
|
else
|
||||||
|
new_homework.homework_samples << HomeworkSample.new(
|
||||||
|
input: homework_test.input,
|
||||||
|
output: homework_test.output
|
||||||
|
)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
#end
|
||||||
|
|
||||||
if homework_detail_group
|
#if homework_detail_group
|
||||||
|
if new_homework.homework_type == 3
|
||||||
new_homework.homework_detail_group = HomeworkDetailGroup.new
|
new_homework.homework_detail_group = HomeworkDetailGroup.new
|
||||||
new_homework.homework_detail_group.min_num = homework_detail_group.min_num
|
new_homework.homework_detail_group.min_num = homework.min_num
|
||||||
new_homework.homework_detail_group.max_num = homework_detail_group.max_num
|
new_homework.homework_detail_group.max_num = homework.max_num
|
||||||
new_homework.homework_detail_group.base_on_project = homework_detail_group.base_on_project
|
new_homework.homework_detail_group.base_on_project = homework.base_on_project
|
||||||
end
|
end
|
||||||
|
#end
|
||||||
if new_homework.save
|
if new_homework.save
|
||||||
new_homework_detail_manual.save if new_homework_detail_manual
|
new_homework_detail_manual.save if new_homework_detail_manual
|
||||||
new_homework.homework_detail_programing.save if new_homework.homework_detail_programing
|
new_homework.homework_detail_programing.save if new_homework.homework_detail_programing
|
||||||
|
@ -1052,9 +1065,9 @@ class UsersController < ApplicationController
|
||||||
@user = User.current
|
@user = User.current
|
||||||
@select_course = params[:select_course] ? 1 : 0
|
@select_course = params[:select_course] ? 1 : 0
|
||||||
#@user_homeworks = HomeworkCommon.where(:user_id => @user.id).order("created_at desc")
|
#@user_homeworks = HomeworkCommon.where(:user_id => @user.id).order("created_at desc")
|
||||||
courses = @user.courses.where("is_delete = 1")
|
#courses = @user.courses.where("is_delete = 1")
|
||||||
course_ids = courses.empty? ? "(-1)" : "(" + courses.map{|course| course.id}.join(",") + ")"
|
#course_ids = courses.empty? ? "(-1)" : "(" + courses.map{|course| course.id}.join(",") + ")"
|
||||||
@homeworks = HomeworkCommon.where("user_id = #{@user.id} and course_id not in #{course_ids}").order("#{@order} #{@b_sort}")
|
@homeworks = @user.homework_banks.order("#{@order} #{@b_sort}")
|
||||||
@type = params[:type]
|
@type = params[:type]
|
||||||
@limit = 15
|
@limit = 15
|
||||||
@is_remote = true
|
@is_remote = true
|
||||||
|
@ -1068,17 +1081,17 @@ class UsersController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def user_homework_type
|
def user_homework_type
|
||||||
@order,@b_sort = params[:order] || "publish_time",params[:sort] || "desc"
|
@order,@b_sort = params[:order] || "created_at",params[:sort] || "desc"
|
||||||
@r_sort = @b_sort == "desc" ? "asc" : "desc"
|
@r_sort = @b_sort == "desc" ? "asc" : "desc"
|
||||||
@user = User.current
|
@user = User.current
|
||||||
if(params[:type].blank? || params[:type] == "1") #我的题库
|
if(params[:type].blank? || params[:type] == "1") #我的题库
|
||||||
courses = @user.courses.where("is_delete = 1")
|
#courses = @user.courses.where("is_delete = 1")
|
||||||
course_ids = courses.empty? ? "(-1)" : "(" + courses.map{|course| course.id}.join(",") + ")"
|
#course_ids = courses.empty? ? "(-1)" : "(" + courses.map{|course| course.id}.join(",") + ")"
|
||||||
@homeworks = HomeworkCommon.where("user_id = #{@user.id} and course_id not in #{course_ids}").order("#{@order} #{@b_sort}")
|
@homeworks = @user.homework_banks
|
||||||
elsif params[:type] == "2" #公共题库
|
elsif params[:type] == "2" #公共题库
|
||||||
visible_course = Course.where("is_public = 1 && is_delete = 0")
|
#visible_course = Course.where("is_public = 1 && is_delete = 0")
|
||||||
visible_course_ids = visible_course.empty? ? "(-1)" : "(" + visible_course.map{|course| course.id}.join(",") + ")"
|
#visible_course_ids = visible_course.empty? ? "(-1)" : "(" + visible_course.map{|course| course.id}.join(",") + ")"
|
||||||
@homeworks = HomeworkCommon.where("course_id in #{visible_course_ids} and publish_time <= '#{Date.today}'").order("#{@order} #{@b_sort}")
|
@homeworks = HomeworkBank.where(:is_public => true)
|
||||||
# elsif params[:type] == "3" #申请题库
|
# elsif params[:type] == "3" #申请题库
|
||||||
# none_visible_course = Course.where("is_delete = 1")
|
# none_visible_course = Course.where("is_delete = 1")
|
||||||
# none_visible_course_ids = none_visible_course.empty? ? "(-1)" : "(" + none_visible_course.map{|course| course.id}.join(",") + ")"
|
# none_visible_course_ids = none_visible_course.empty? ? "(-1)" : "(" + none_visible_course.map{|course| course.id}.join(",") + ")"
|
||||||
|
@ -1090,18 +1103,20 @@ class UsersController < ApplicationController
|
||||||
# @homeworks = HomeworkCommon.find_by_sql(sql)
|
# @homeworks = HomeworkCommon.find_by_sql(sql)
|
||||||
end
|
end
|
||||||
if params[:property]
|
if params[:property]
|
||||||
all_homework_ids = @homeworks.empty? ? "(-1)" : "(" + @homeworks.map{|h| h.id}.join(",") + ")"
|
@homeworks = @homeworks.where(:homework_type => params[:property].to_i)
|
||||||
if params[:property] == "1"
|
# all_homework_ids = @homeworks.empty? ? "(-1)" : "(" + @homeworks.map{|h| h.id}.join(",") + ")"
|
||||||
@homeworks = HomeworkCommon.find_by_sql("select * from homework_commons where id in #{all_homework_ids} and homework_type = 1")
|
# if params[:property] == "1"
|
||||||
#@homeworks = @homeworks.where("homework_type = 1").reorder("#{@order} #{@b_sort}")
|
# @homeworks = HomeworkCommon.find_by_sql("select * from homework_commons where id in #{all_homework_ids} and homework_type = 1")
|
||||||
elsif params[:property] == "2"
|
# #@homeworks = @homeworks.where("homework_type = 1").reorder("#{@order} #{@b_sort}")
|
||||||
@homeworks = HomeworkCommon.find_by_sql("select * from homework_commons where id in #{all_homework_ids} and homework_type = 2")
|
# elsif params[:property] == "2"
|
||||||
#@homeworks = @homeworks.where("homework_type = 2").reorder("#{@order} #{@b_sort}")
|
# @homeworks = HomeworkCommon.find_by_sql("select * from homework_commons where id in #{all_homework_ids} and homework_type = 2")
|
||||||
elsif params[:property] == "3"
|
# #@homeworks = @homeworks.where("homework_type = 2").reorder("#{@order} #{@b_sort}")
|
||||||
@homeworks = HomeworkCommon.find_by_sql("select * from homework_commons where id in #{all_homework_ids} and homework_type = 3")
|
# elsif params[:property] == "3"
|
||||||
#@homeworks = @homeworks.where("homework_type = 3").reorder("#{@order} #{@b_sort}")
|
# @homeworks = HomeworkCommon.find_by_sql("select * from homework_commons where id in #{all_homework_ids} and homework_type = 3")
|
||||||
end
|
# #@homeworks = @homeworks.where("homework_type = 3").reorder("#{@order} #{@b_sort}")
|
||||||
|
# end
|
||||||
end
|
end
|
||||||
|
@homeworks = @homeworks.reorder("#{@order} #{@b_sort}")
|
||||||
@type = params[:type] ? params[:type] : '1'
|
@type = params[:type] ? params[:type] : '1'
|
||||||
@property = params[:property]
|
@property = params[:property]
|
||||||
@is_import = params[:is_import]
|
@is_import = params[:is_import]
|
||||||
|
@ -1117,7 +1132,7 @@ class UsersController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def show_homework_detail
|
def show_homework_detail
|
||||||
@homework = HomeworkCommon.find params[:homework].to_i
|
@homework = HomeworkBank.find params[:homework].to_i
|
||||||
# if homework.course.is_public == 0 && !User.current.allowed_to?(:as_teacher,homework.course) && User.current != homework.user
|
# if homework.course.is_public == 0 && !User.current.allowed_to?(:as_teacher,homework.course) && User.current != homework.user
|
||||||
# ah = ApplyHomework.where("user_id = ? and homework_common_id = ?", User.current.id, params[:homework].to_i)
|
# ah = ApplyHomework.where("user_id = ? and homework_common_id = ?", User.current.id, params[:homework].to_i)
|
||||||
# if ah.empty?
|
# if ah.empty?
|
||||||
|
@ -1140,44 +1155,46 @@ class UsersController < ApplicationController
|
||||||
|
|
||||||
#用户主页过滤作业
|
#用户主页过滤作业
|
||||||
def user_search_homeworks
|
def user_search_homeworks
|
||||||
@order,@b_sort = params[:order] || "publish_time",params[:sort] || "desc"
|
@order,@b_sort = params[:order] || "created_at",params[:sort] || "desc"
|
||||||
@r_sort = @b_sort == "desc" ? "asc" : "desc"
|
@r_sort = @b_sort == "desc" ? "asc" : "desc"
|
||||||
@user = User.current
|
@user = User.current
|
||||||
search = params[:name].to_s.strip.downcase
|
search = params[:name].to_s.strip.downcase
|
||||||
type_ids = (params[:property]=="" || params[:property].nil? || params[:property]=="0") ? "(1, 2, 3)" : "(" + params[:property] + ")"
|
type_ids = (params[:property]=="" || params[:property].nil? || params[:property]=="0") ? "(1, 2, 3)" : "(" + params[:property] + ")"
|
||||||
if(params[:type].blank? || params[:type] == "1") #我的题库
|
if(params[:type].blank? || params[:type] == "1") #我的题库
|
||||||
courses = @user.courses.where("is_delete = 1")
|
#courses = @user.courses.where("is_delete = 1")
|
||||||
course_ids = courses.empty? ? "(-1)" : "(" + courses.map{|course| course.id}.join(",") + ")"
|
#course_ids = courses.empty? ? "(-1)" : "(" + courses.map{|course| course.id}.join(",") + ")"
|
||||||
if @order == "course_name"
|
@homeworks = @user.homework_banks.where("name like '%#{search}%' and homework_type in #{type_ids}").order("#{@order} #{@b_sort}")
|
||||||
sql = "SELECT homework_commons.* FROM homework_commons INNER JOIN courses ON homework_commons.course_id = courses.id where homework_commons.course_id not in #{course_ids} and homework_commons.user_id = #{@user.id} and homework_type in #{type_ids} and (homework_commons.name like '%#{search}%') order by CONVERT (courses.name USING gbk) COLLATE gbk_chinese_ci #{@b_sort}"
|
# if @order == "course_name"
|
||||||
@homeworks = HomeworkCommon.find_by_sql(sql)
|
# sql = "SELECT homework_commons.* FROM homework_commons INNER JOIN courses ON homework_commons.course_id = courses.id where homework_commons.course_id not in #{course_ids} and homework_commons.user_id = #{@user.id} and homework_type in #{type_ids} and (homework_commons.name like '%#{search}%') order by CONVERT (courses.name USING gbk) COLLATE gbk_chinese_ci #{@b_sort}"
|
||||||
elsif @order == "user_name"
|
# @homeworks = HomeworkCommon.find_by_sql(sql)
|
||||||
@homeworks = HomeworkCommon.where("user_id = #{@user.id} and course_id not in #{course_ids} and (name like '%#{search}%') and homework_type in #{type_ids}").joins(:user).order("CONVERT (lastname USING gbk) COLLATE gbk_chinese_ci #{@b_sort}, CONVERT (firstname USING gbk) COLLATE gbk_chinese_ci #{@b_sort},login #{@b_sort}")
|
# elsif @order == "user_name"
|
||||||
else
|
# @homeworks = HomeworkCommon.where("user_id = #{@user.id} and course_id not in #{course_ids} and (name like '%#{search}%') and homework_type in #{type_ids}").joins(:user).order("CONVERT (lastname USING gbk) COLLATE gbk_chinese_ci #{@b_sort}, CONVERT (firstname USING gbk) COLLATE gbk_chinese_ci #{@b_sort},login #{@b_sort}")
|
||||||
@homeworks = HomeworkCommon.where("user_id = #{@user.id} and course_id not in #{course_ids} and (name like '%#{search}%') and homework_type in #{type_ids}").order("#{@order} #{@b_sort}")
|
# else
|
||||||
end
|
# @homeworks = HomeworkCommon.where("user_id = #{@user.id} and course_id not in #{course_ids} and (name like '%#{search}%') and homework_type in #{type_ids}").order("#{@order} #{@b_sort}")
|
||||||
|
# end
|
||||||
elsif params[:type] == "2" #题库
|
elsif params[:type] == "2" #题库
|
||||||
visible_course = Course.where("is_public = 1 && is_delete = 0")
|
#visible_course = Course.where("is_public = 1 && is_delete = 0")
|
||||||
visible_course_ids = visible_course.empty? ? "(-1)" : "(" + visible_course.map{|course| course.id}.join(",") + ")"
|
#visible_course_ids = visible_course.empty? ? "(-1)" : "(" + visible_course.map{|course| course.id}.join(",") + ")"
|
||||||
all_homeworks = HomeworkCommon.where("course_id in #{visible_course_ids} and publish_time <= '#{Date.today}'")
|
all_homeworks = HomeworkBank.where(:is_public => true)
|
||||||
all_user_ids = all_homeworks.map{|hw| hw.user_id}
|
all_user_ids = all_homeworks.map{|hw| hw.user_id}
|
||||||
user_str_ids = search_user_by_name all_user_ids, search
|
user_str_ids = search_user_by_name all_user_ids, search
|
||||||
user_ids = user_str_ids.empty? ? "(-1)" : "(" + user_str_ids.join(",") + ")"
|
user_ids = user_str_ids.empty? ? "(-1)" : "(" + user_str_ids.join(",") + ")"
|
||||||
if @order == "course_name"
|
@homeworks = HomeworkBank.where("is_public = 1 and (name like '%#{search}%' or user_id in #{user_ids}) and homework_type in #{type_ids}").order("#{@order} #{@b_sort}")
|
||||||
sql = "SELECT homework_commons.* FROM homework_commons INNER JOIN courses ON homework_commons.course_id = courses.id where homework_type in #{type_ids} and course_id in #{visible_course_ids} and publish_time <= '#{Date.today}' and (homework_commons.name like '%#{search}%' or homework_commons.user_id in #{user_ids}) order by CONVERT (courses.name USING gbk) COLLATE gbk_chinese_ci #{@b_sort}"
|
# if @order == "course_name"
|
||||||
@homeworks = HomeworkCommon.find_by_sql(sql)
|
# sql = "SELECT homework_commons.* FROM homework_commons INNER JOIN courses ON homework_commons.course_id = courses.id where homework_type in #{type_ids} and course_id in #{visible_course_ids} and publish_time <= '#{Date.today}' and (homework_commons.name like '%#{search}%' or homework_commons.user_id in #{user_ids}) order by CONVERT (courses.name USING gbk) COLLATE gbk_chinese_ci #{@b_sort}"
|
||||||
elsif @order == "user_name"
|
# @homeworks = HomeworkCommon.find_by_sql(sql)
|
||||||
@homeworks = HomeworkCommon.where("course_id in #{visible_course_ids} and publish_time <= '#{Date.today}' and homework_type in #{type_ids} and (name like '%#{search}%' or user_id in #{user_ids})").joins(:user).order("CONVERT (lastname USING gbk) COLLATE gbk_chinese_ci #{@b_sort}, CONVERT (firstname USING gbk) COLLATE gbk_chinese_ci #{@b_sort},login #{@b_sort}")
|
# elsif @order == "user_name"
|
||||||
else
|
# @homeworks = HomeworkCommon.where("course_id in #{visible_course_ids} and publish_time <= '#{Date.today}' and homework_type in #{type_ids} and (name like '%#{search}%' or user_id in #{user_ids})").joins(:user).order("CONVERT (lastname USING gbk) COLLATE gbk_chinese_ci #{@b_sort}, CONVERT (firstname USING gbk) COLLATE gbk_chinese_ci #{@b_sort},login #{@b_sort}")
|
||||||
@homeworks = HomeworkCommon.where("course_id in #{visible_course_ids} and publish_time <= '#{Date.today}' and homework_type in #{type_ids} and (name like '%#{search}%' or user_id in #{user_ids})").order("#{@order} #{@b_sort}")
|
# else
|
||||||
end
|
# @homeworks = HomeworkCommon.where("course_id in #{visible_course_ids} and publish_time <= '#{Date.today}' and homework_type in #{type_ids} and (name like '%#{search}%' or user_id in #{user_ids})").order("#{@order} #{@b_sort}")
|
||||||
|
# end
|
||||||
elsif params[:type] == "3" #申请题库
|
elsif params[:type] == "3" #申请题库
|
||||||
apply_homeworks = ApplyHomework.where("user_id = ?",@user.id)
|
apply_homeworks = ApplyHomework.where("user_id = ?",@user.id)
|
||||||
homework_ids = apply_homeworks.empty? ? "(-1)" : "(" + apply_homeworks.map{|ah| ah.homework_common_id}.join(",") + ")"
|
homework_ids = apply_homeworks.empty? ? "(-1)" : "(" + apply_homeworks.map{|ah| ah.homework_common_id}.join(",") + ")"
|
||||||
none_visible_course = Course.where("is_delete = 1")
|
none_visible_course = Course.where("is_delete = 1")
|
||||||
none_visible_course_ids = none_visible_course.empty? ? "(-1)" : "(" + none_visible_course.map{|course| course.id}.join(",") + ")"
|
none_visible_course_ids = none_visible_course.empty? ? "(-1)" : "(" + none_visible_course.map{|course| course.id}.join(",") + ")"
|
||||||
if @order == "course_name"
|
if @order == "course_name"
|
||||||
sql = "SELECT homework_commons.* FROM homework_commons INNER JOIN courses ON homework_commons.course_id = courses.id where courses.is_delete = 0 and homework_commons.id in #{homework_ids} and homework_type in #{type_ids} and publish_time <= '#{Date.today}' and (homework_commons.name like '%#{search}%') order by CONVERT (courses.name USING gbk) COLLATE gbk_chinese_ci #{@b_sort}"
|
sql = "SELECT homework_commons.* FROM homework_commons INNER JOIN courses ON homework_commons.course_id = courses.id where courses.is_delete = 0 and homework_commons.id in #{homework_ids} and homework_type in #{type_ids} and publish_time <= '#{Time.now}' and (homework_commons.name like '%#{search}%') order by CONVERT (courses.name USING gbk) COLLATE gbk_chinese_ci #{@b_sort}"
|
||||||
@homeworks = HomeworkCommon.find_by_sql(sql)
|
@homeworks = HomeworkCommon.find_by_sql(sql)
|
||||||
elsif @order == "user_name"
|
elsif @order == "user_name"
|
||||||
@homeworks = HomeworkCommon.where("homework_commons.id in #{homework_ids} and course_id not in #{none_visible_course_ids} and (name like '%#{search}%') and homework_type in #{type_ids}").joins(:user).order("CONVERT (lastname USING gbk) COLLATE gbk_chinese_ci #{@b_sort}, CONVERT (firstname USING gbk) COLLATE gbk_chinese_ci #{@b_sort},login #{@b_sort}")
|
@homeworks = HomeworkCommon.where("homework_commons.id in #{homework_ids} and course_id not in #{none_visible_course_ids} and (name like '%#{search}%') and homework_type in #{type_ids}").joins(:user).order("CONVERT (lastname USING gbk) COLLATE gbk_chinese_ci #{@b_sort}, CONVERT (firstname USING gbk) COLLATE gbk_chinese_ci #{@b_sort},login #{@b_sort}")
|
||||||
|
@ -1211,11 +1228,16 @@ class UsersController < ApplicationController
|
||||||
|
|
||||||
#检查改作业是否可以选用
|
#检查改作业是否可以选用
|
||||||
def check_homework
|
def check_homework
|
||||||
homework = HomeworkCommon.find_by_id params[:homework]
|
|
||||||
student_ids = homework.course.student.empty? ? [] : homework.course.student.map{|student| student.student_id}.join(',')
|
|
||||||
resultObj = {status: 2}
|
resultObj = {status: 2}
|
||||||
if student_ids.include?(User.current.id.to_s)
|
homework_bank = HomeworkBank.find params[:homework]
|
||||||
resultObj[:status] = 1
|
if homework_bank.homework_common_id && HomeworkCommon.find(homework_bank.homework_common_id)
|
||||||
|
homework = HomeworkCommon.find(homework_bank.homework_common_id)
|
||||||
|
student_ids = homework.course.student.empty? ? [] : homework.course.student.map{|student| student.student_id}.join(',')
|
||||||
|
if student_ids.include?(User.current.id.to_s)
|
||||||
|
resultObj[:status] = 1
|
||||||
|
else
|
||||||
|
resultObj[:status] = 0
|
||||||
|
end
|
||||||
else
|
else
|
||||||
resultObj[:status] = 0
|
resultObj[:status] = 0
|
||||||
end
|
end
|
||||||
|
@ -1224,47 +1246,58 @@ class UsersController < ApplicationController
|
||||||
|
|
||||||
#导入作业,确定按钮
|
#导入作业,确定按钮
|
||||||
def user_select_homework
|
def user_select_homework
|
||||||
homework = HomeworkCommon.find_by_id params[:checkMenu]
|
homework = HomeworkBank.find_by_id params[:checkMenu]
|
||||||
homework_detail_programing = homework.homework_detail_programing
|
#homework_detail_programing = homework.homework_detail_programing
|
||||||
homework_detail_group = homework.homework_detail_group
|
#homework_detail_group = homework.homework_detail_group
|
||||||
@homework = HomeworkCommon.new
|
@homework = HomeworkCommon.new
|
||||||
@select_course = params[:select_course] || 0
|
@select_course = params[:select_course] || 0
|
||||||
if homework
|
if homework
|
||||||
@ref_homework = homework
|
@ref_homework = homework
|
||||||
@homework.name = homework.name
|
@homework.name = homework.name
|
||||||
@homework.description = homework.description
|
@homework.description = homework.description
|
||||||
@homework.end_time = homework.end_time
|
#@homework.end_time = homework.end_time
|
||||||
@homework.homework_type = homework.homework_type
|
@homework.homework_type = homework.homework_type
|
||||||
@homework.course_id = homework.course_id
|
#@homework.course_id = homework.course_id
|
||||||
homework.attachments.each do |attachment|
|
# homework.attachments.each do |attachment|
|
||||||
att = attachment.copy
|
# att = attachment.copy
|
||||||
att.container_id = nil
|
# att.container_id = nil
|
||||||
att.container_type = nil
|
# att.container_type = nil
|
||||||
att.copy_from = attachment.id
|
# att.copy_from = attachment.id
|
||||||
att.save
|
# att.save
|
||||||
@homework.attachments << att
|
# @homework.attachments << att
|
||||||
end
|
# end
|
||||||
|
|
||||||
if homework_detail_programing
|
#if homework_detail_programing
|
||||||
|
if homework.homework_type == 2
|
||||||
@homework.homework_detail_programing = HomeworkDetailPrograming.new
|
@homework.homework_detail_programing = HomeworkDetailPrograming.new
|
||||||
@homework_detail_programing = @homework.homework_detail_programing
|
@homework_detail_programing = @homework.homework_detail_programing
|
||||||
@homework_detail_programing.ta_proportion = homework_detail_programing.ta_proportion
|
#@homework_detail_programing.ta_proportion = homework_detail_programing.ta_proportion
|
||||||
@homework_detail_programing.language = homework_detail_programing.language
|
@homework_detail_programing.language = homework.language
|
||||||
homework.homework_tests.each_with_index do |homework_test|
|
homework.homework_bank_tests.each_with_index do |homework_test|
|
||||||
@homework.homework_tests << HomeworkTest.new(
|
if homework_test.test_type
|
||||||
input: homework_test.input,
|
@homework.homework_tests << HomeworkTest.new(
|
||||||
output: homework_test.output
|
input: homework_test.input,
|
||||||
)
|
output: homework_test.output
|
||||||
|
)
|
||||||
|
else
|
||||||
|
@homework.homework_samples << HomeworkSample.new(
|
||||||
|
input: homework_test.input,
|
||||||
|
output: homework_test.output
|
||||||
|
)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
#end
|
||||||
|
|
||||||
if homework_detail_group
|
#if homework_detail_group
|
||||||
|
if homework.homework_type == 3
|
||||||
@homework.homework_detail_group = HomeworkDetailGroup.new
|
@homework.homework_detail_group = HomeworkDetailGroup.new
|
||||||
@homework_detail_group = @homework.homework_detail_group
|
@homework_detail_group = @homework.homework_detail_group
|
||||||
@homework_detail_group.min_num = homework_detail_group.min_num
|
@homework_detail_group.min_num = homework.min_num
|
||||||
@homework_detail_group.max_num = homework_detail_group.max_num
|
@homework_detail_group.max_num = homework.max_num
|
||||||
@homework_detail_group.base_on_project = homework_detail_group.base_on_project
|
@homework_detail_group.base_on_project = homework.base_on_project
|
||||||
end
|
end
|
||||||
|
#end
|
||||||
end
|
end
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.js
|
format.js
|
||||||
|
@ -1310,7 +1343,7 @@ class UsersController < ApplicationController
|
||||||
if student_work
|
if student_work
|
||||||
|
|
||||||
# 提交作品时,计算是否迟交
|
# 提交作品时,计算是否迟交
|
||||||
if Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(Time.now.to_s).strftime("%Y-%m-%d")
|
if homework.end_time < Time.now
|
||||||
student_work.late_penalty = homework.late_penalty
|
student_work.late_penalty = homework.late_penalty
|
||||||
student_work.work_status = 2
|
student_work.work_status = 2
|
||||||
# 缺评扣分
|
# 缺评扣分
|
||||||
|
@ -1347,12 +1380,12 @@ class UsersController < ApplicationController
|
||||||
homework = HomeworkCommon.new
|
homework = HomeworkCommon.new
|
||||||
homework.name = params[:homework_common][:name]
|
homework.name = params[:homework_common][:name]
|
||||||
homework.description = params[:homework_common][:description]
|
homework.description = params[:homework_common][:description]
|
||||||
homework.end_time = params[:homework_common][:end_time] || Date.today
|
# homework.end_time = params[:homework_common][:end_time] || Time.now
|
||||||
if params[:homework_common][:publish_time] == ""
|
# if params[:homework_common][:publish_time] == ""
|
||||||
homework.publish_time = Date.today
|
# homework.publish_time = Time.now
|
||||||
else
|
# else
|
||||||
homework.publish_time = params[:homework_common][:publish_time]
|
# homework.publish_time = params[:homework_common][:publish_time]
|
||||||
end
|
# end
|
||||||
homework.anonymous_comment = params[:homework_common][:anonymous_comment] ? params[:homework_common][:anonymous_comment].to_i : 1
|
homework.anonymous_comment = params[:homework_common][:anonymous_comment] ? params[:homework_common][:anonymous_comment].to_i : 1
|
||||||
homework.homework_type = params[:homework_type].to_i || 1
|
homework.homework_type = params[:homework_type].to_i || 1
|
||||||
homework.late_penalty = 0
|
homework.late_penalty = 0
|
||||||
|
@ -1369,19 +1402,31 @@ class UsersController < ApplicationController
|
||||||
else
|
else
|
||||||
homework_detail_manual.ta_proportion = homework.homework_type == 2 ? 0.3 : 0.6
|
homework_detail_manual.ta_proportion = homework.homework_type == 2 ? 0.3 : 0.6
|
||||||
end
|
end
|
||||||
if homework.publish_time > Date.today
|
if params[:homework_common][:end_time] == ""
|
||||||
homework_detail_manual.comment_status = 0
|
homework_detail_manual.comment_status = 0
|
||||||
else
|
else
|
||||||
homework_detail_manual.comment_status = 1
|
homework.end_time = params[:homework_common][:end_time]
|
||||||
|
if params[:homework_common][:publish_time] == ""
|
||||||
|
homework.publish_time = Time.now
|
||||||
|
else
|
||||||
|
homework.publish_time = params[:homework_common][:publish_time]
|
||||||
|
end
|
||||||
|
|
||||||
#更新CourseHomeworkStatistics中每个学生的未交作品数
|
if homework.publish_time > Time.now
|
||||||
homework.course.student.each do |student|
|
homework_detail_manual.comment_status = 0
|
||||||
course_statistics = CourseHomeworkStatistics.find_by_course_id_and_user_id(homework.course_id, student.student_id)
|
else
|
||||||
course_statistics.update_attribute('un_commit_work_num', course_statistics.un_commit_work_num + 1) if course_statistics
|
homework_detail_manual.comment_status = 1
|
||||||
|
|
||||||
|
#更新CourseHomeworkStatistics中每个学生的未交作品数
|
||||||
|
homework.course.student.each do |student|
|
||||||
|
course_statistics = CourseHomeworkStatistics.find_by_course_id_and_user_id(homework.course_id, student.student_id)
|
||||||
|
course_statistics.update_attribute('un_commit_work_num', course_statistics.un_commit_work_num + 1) if course_statistics
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
homework_detail_manual.evaluation_start = params[:evaluation_start].blank? ? homework.end_time + 7 : params[:evaluation_start]
|
|
||||||
homework_detail_manual.evaluation_end = params[:evaluation_end].blank? ? homework_detail_manual.evaluation_start + 7 : params[:evaluation_end]
|
homework_detail_manual.evaluation_start = homework.end_time + 7 if homework.end_time
|
||||||
|
homework_detail_manual.evaluation_end = homework.end_time + 14 if homework.end_time
|
||||||
homework_detail_manual.evaluation_num = params[:evaluation_num] || 3
|
homework_detail_manual.evaluation_num = params[:evaluation_num] || 3
|
||||||
homework_detail_manual.absence_penalty = 0
|
homework_detail_manual.absence_penalty = 0
|
||||||
homework.homework_detail_manual = homework_detail_manual
|
homework.homework_detail_manual = homework_detail_manual
|
||||||
|
@ -1437,10 +1482,14 @@ class UsersController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
if params[:quotes] && !params[:quotes].blank?
|
if params[:quotes] && !params[:quotes].blank?
|
||||||
quotes_homework = HomeworkCommon.find params[:quotes].to_i
|
quotes_homework = HomeworkBank.find params[:quotes].to_i
|
||||||
quotes_homework.update_column(:quotes, quotes_homework.quotes+1)
|
quotes_homework.update_column(:quotes, quotes_homework.quotes+1)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if params[:add_to_bank]
|
||||||
|
homework_bank = add_to_homework_bank_f homework
|
||||||
|
homework_bank.save
|
||||||
|
end
|
||||||
redirect_to homework_common_index_path(:course => homework.course_id)
|
redirect_to homework_common_index_path(:course => homework.course_id)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -1854,7 +1903,7 @@ class UsersController < ApplicationController
|
||||||
@manage_homeworks = HomeworkCommon.where("course_id in #{tea_course_ids}").order("created_at desc").limit(5)
|
@manage_homeworks = HomeworkCommon.where("course_id in #{tea_course_ids}").order("created_at desc").limit(5)
|
||||||
stu_courses = @user.courses.visible.not_deleted.select{|course| @user.has_student_role(course)}
|
stu_courses = @user.courses.visible.not_deleted.select{|course| @user.has_student_role(course)}
|
||||||
stu_course_ids = stu_courses.empty? ? "(-1)" : "(" + stu_courses.map{|course| course.id}.join(',') + ")"
|
stu_course_ids = stu_courses.empty? ? "(-1)" : "(" + stu_courses.map{|course| course.id}.join(',') + ")"
|
||||||
@receive_homeworks = HomeworkCommon.where("course_id in #{stu_course_ids} and publish_time <= '#{Date.today}'").order("created_at desc").limit(5)
|
@receive_homeworks = HomeworkCommon.where("course_id in #{stu_course_ids} and publish_time <= '#{Time.now}'").order("created_at desc").limit(5)
|
||||||
if (@manage_homeworks.empty? && @receive_homeworks.empty?) || (@receive_homeworks.empty?) || (!@manage_homeworks.empty? && !@receive_homeworks.empty? && @manage_homeworks.first.created_at > @receive_homeworks.first.created_at)
|
if (@manage_homeworks.empty? && @receive_homeworks.empty?) || (@receive_homeworks.empty?) || (!@manage_homeworks.empty? && !@receive_homeworks.empty? && @manage_homeworks.first.created_at > @receive_homeworks.first.created_at)
|
||||||
@manage_pre = true
|
@manage_pre = true
|
||||||
else
|
else
|
||||||
|
@ -1907,7 +1956,7 @@ class UsersController < ApplicationController
|
||||||
@type = @type.to_i
|
@type = @type.to_i
|
||||||
stu_courses = @user.courses.visible.not_deleted.select{|course| @user.has_student_role(course)}
|
stu_courses = @user.courses.visible.not_deleted.select{|course| @user.has_student_role(course)}
|
||||||
stu_course_ids = stu_courses.empty? ? "(-1)" : "(" + stu_courses.map{|course| course.id}.join(',') + ")"
|
stu_course_ids = stu_courses.empty? ? "(-1)" : "(" + stu_courses.map{|course| course.id}.join(',') + ")"
|
||||||
@homeworks = HomeworkCommon.where("course_id in #{stu_course_ids} and publish_time <= '#{Date.today}'").order("#{@order} #{@b_sort}")
|
@homeworks = HomeworkCommon.where("course_id in #{stu_course_ids} and publish_time <= '#{Time.now}'").order("#{@order} #{@b_sort}")
|
||||||
if params[:property]
|
if params[:property]
|
||||||
all_homework_ids = @homeworks.empty? ? "(-1)" : "(" + @homeworks.map{|h| h.id}.join(",") + ")"
|
all_homework_ids = @homeworks.empty? ? "(-1)" : "(" + @homeworks.map{|h| h.id}.join(",") + ")"
|
||||||
if params[:property] == "1"
|
if params[:property] == "1"
|
||||||
|
@ -1944,7 +1993,7 @@ class UsersController < ApplicationController
|
||||||
else
|
else
|
||||||
stu_courses = @user.courses.visible.not_deleted.select{|course| @user.has_student_role(course)}
|
stu_courses = @user.courses.visible.not_deleted.select{|course| @user.has_student_role(course)}
|
||||||
stu_course_ids = stu_courses.empty? ? "(-1)" : "(" + stu_courses.map{|course| course.id}.join(',') + ")"
|
stu_course_ids = stu_courses.empty? ? "(-1)" : "(" + stu_courses.map{|course| course.id}.join(',') + ")"
|
||||||
@homeworks = HomeworkCommon.where("course_id in #{stu_course_ids} and publish_time <= '#{Date.today}'").order("#{@order} #{@b_sort}")
|
@homeworks = HomeworkCommon.where("course_id in #{stu_course_ids} and publish_time <= '#{Time.now}'").order("#{@order} #{@b_sort}")
|
||||||
end
|
end
|
||||||
if params[:property]
|
if params[:property]
|
||||||
all_homework_ids = @homeworks.empty? ? "(-1)" : "(" + @homeworks.map{|h| h.id}.join(",") + ")"
|
all_homework_ids = @homeworks.empty? ? "(-1)" : "(" + @homeworks.map{|h| h.id}.join(",") + ")"
|
||||||
|
@ -1985,7 +2034,7 @@ class UsersController < ApplicationController
|
||||||
stu_courses = @user.courses.visible.not_deleted.select{|course| @user.has_student_role(course)}
|
stu_courses = @user.courses.visible.not_deleted.select{|course| @user.has_student_role(course)}
|
||||||
stu_course_ids = stu_courses.empty? ? "(-1)" : "(" + stu_courses.map{|course| course.id}.join(',') + ")"
|
stu_course_ids = stu_courses.empty? ? "(-1)" : "(" + stu_courses.map{|course| course.id}.join(',') + ")"
|
||||||
#user_ids = hw_publisher_user_ids search, stu_course_ids
|
#user_ids = hw_publisher_user_ids search, stu_course_ids
|
||||||
@homeworks = HomeworkCommon.where("course_id in #{stu_course_ids} and homework_type in #{type_ids} and publish_time <= '#{Date.today}' and name like '%#{search}%'")
|
@homeworks = HomeworkCommon.where("course_id in #{stu_course_ids} and homework_type in #{type_ids} and publish_time <= '#{Time.now}' and name like '%#{search}%'")
|
||||||
if @order == "status"
|
if @order == "status"
|
||||||
@homeworks.each do |homework|
|
@homeworks.each do |homework|
|
||||||
work = cur_user_works_for_homework homework
|
work = cur_user_works_for_homework homework
|
||||||
|
@ -2043,7 +2092,7 @@ class UsersController < ApplicationController
|
||||||
my_course_ids = StudentsForCourse.includes(:course).where("student_id = #{@user.id} and courses.is_delete = 0").blank? ? "(-1)" : "(" + StudentsForCourse.includes(:course).
|
my_course_ids = StudentsForCourse.includes(:course).where("student_id = #{@user.id} and courses.is_delete = 0").blank? ? "(-1)" : "(" + StudentsForCourse.includes(:course).
|
||||||
where("student_id = #{@user.id} and courses.is_delete = 0").map{|sc| sc.course_id}.join(",") + ")"
|
where("student_id = #{@user.id} and courses.is_delete = 0").map{|sc| sc.course_id}.join(",") + ")"
|
||||||
# 用户待完成的作业
|
# 用户待完成的作业
|
||||||
homeworks = HomeworkCommon.where("course_id in #{my_course_ids} and publish_time <= '#{Date.today}'")
|
homeworks = HomeworkCommon.where("course_id in #{my_course_ids} and publish_time <= '#{Time.now}'")
|
||||||
homework_ids = homeworks.blank? ? "(-1)" : "(" + homeworks.map{|homework| homework.id}.join(",") + ")"
|
homework_ids = homeworks.blank? ? "(-1)" : "(" + homeworks.map{|homework| homework.id}.join(",") + ")"
|
||||||
student_works = StudentWork.where("user_id = #{@user.id} and homework_common_id in #{homework_ids} and work_status != 0")
|
student_works = StudentWork.where("user_id = #{@user.id} and homework_common_id in #{homework_ids} and work_status != 0")
|
||||||
@unfinished_homework_count = homeworks.count - student_works.count
|
@unfinished_homework_count = homeworks.count - student_works.count
|
||||||
|
@ -2185,11 +2234,11 @@ class UsersController < ApplicationController
|
||||||
# 待完成的作业
|
# 待完成的作业
|
||||||
def unfinished_homework_list
|
def unfinished_homework_list
|
||||||
my_course_ids = StudentsForCourse.includes(:course).where("student_id = #{@user.id} and courses.is_delete = 0").blank? ? "(-1)" : "(" + StudentsForCourse.includes(:course).where("student_id = #{@user.id} and courses.is_delete = 0").map{|sc| sc.course_id}.join(",") + ")"
|
my_course_ids = StudentsForCourse.includes(:course).where("student_id = #{@user.id} and courses.is_delete = 0").blank? ? "(-1)" : "(" + StudentsForCourse.includes(:course).where("student_id = #{@user.id} and courses.is_delete = 0").map{|sc| sc.course_id}.join(",") + ")"
|
||||||
homeworks = HomeworkCommon.where("course_id in #{my_course_ids} and publish_time <= '#{Date.today}'")
|
homeworks = HomeworkCommon.where("course_id in #{my_course_ids} and publish_time <= '#{Time.now}'")
|
||||||
homework_ids = homeworks.blank? ? "(-1)" : "(" + homeworks.map{|homework| homework.id}.join(",") + ")"
|
homework_ids = homeworks.blank? ? "(-1)" : "(" + homeworks.map{|homework| homework.id}.join(",") + ")"
|
||||||
student_works = StudentWork.where("user_id = #{@user.id} and homework_common_id in #{homework_ids} and work_status != 0")
|
student_works = StudentWork.where("user_id = #{@user.id} and homework_common_id in #{homework_ids} and work_status != 0")
|
||||||
finished_works_id = student_works.blank? ? "(-1)" : "(" + student_works.map{ |sw| sw.homework_common_id.to_i }.join(",") + ")"
|
finished_works_id = student_works.blank? ? "(-1)" : "(" + student_works.map{ |sw| sw.homework_common_id.to_i }.join(",") + ")"
|
||||||
@unfinished_homeworks = HomeworkCommon.where("course_id in #{my_course_ids} and publish_time <= '#{Date.today}' and id not in #{finished_works_id}").order("updated_at desc")
|
@unfinished_homeworks = HomeworkCommon.where("course_id in #{my_course_ids} and publish_time <= '#{Time.now}' and id not in #{finished_works_id}").order("updated_at desc")
|
||||||
@unfinished_homeworks_count = @unfinished_homeworks.count
|
@unfinished_homeworks_count = @unfinished_homeworks.count
|
||||||
@limit = 20
|
@limit = 20
|
||||||
@unfinished_homework_pages = Paginator.new @unfinished_homeworks_count, @limit, params['page'] || 1
|
@unfinished_homework_pages = Paginator.new @unfinished_homeworks_count, @limit, params['page'] || 1
|
||||||
|
@ -4140,7 +4189,7 @@ class UsersController < ApplicationController
|
||||||
count = 0
|
count = 0
|
||||||
courses = syllabus.courses.not_deleted
|
courses = syllabus.courses.not_deleted
|
||||||
courses.each do |c|
|
courses.each do |c|
|
||||||
count += (User.current.admin? || User.current.allowed_to?(:as_teacher,c)) ? (c.homework_commons.count + visable_attachemnts_incourse(c).count) : (c.homework_commons.where("publish_time <= '#{Date.today}'").count + visable_attachemnts_incourse(c).count)
|
count += (User.current.admin? || User.current.allowed_to?(:as_teacher,c)) ? (c.homework_commons.count + visable_attachemnts_incourse(c).count) : (c.homework_commons.where("publish_time <= '#{Time.now}'").count + visable_attachemnts_incourse(c).count)
|
||||||
end
|
end
|
||||||
syllabus[:infocount] = count
|
syllabus[:infocount] = count
|
||||||
end
|
end
|
||||||
|
|
|
@ -102,7 +102,7 @@ module ApiHelper
|
||||||
#获取作业的是否可以匿评的描述
|
#获取作业的是否可以匿评的描述
|
||||||
def homework_status_desc homework
|
def homework_status_desc homework
|
||||||
if homework.homework_type == 1 && homework.homework_detail_manual #匿评作业
|
if homework.homework_type == 1 && homework.homework_detail_manual #匿评作业
|
||||||
if Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d")
|
if homework.end_time >= Time.now
|
||||||
link = show_homework_deadline homework
|
link = show_homework_deadline homework
|
||||||
elsif homework.student_works.count >= 2 #作业份数大于2
|
elsif homework.student_works.count >= 2 #作业份数大于2
|
||||||
case homework.homework_detail_manual.comment_status
|
case homework.homework_detail_manual.comment_status
|
||||||
|
|
|
@ -2990,7 +2990,7 @@ module ApplicationHelper
|
||||||
def user_receive_homework_count
|
def user_receive_homework_count
|
||||||
stu_courses = @user.courses.visible.not_deleted.select{|course| @user.has_student_role(course)}
|
stu_courses = @user.courses.visible.not_deleted.select{|course| @user.has_student_role(course)}
|
||||||
stu_course_ids = stu_courses.empty? ? "(-1)" : "(" + stu_courses.map{|course| course.id}.join(',') + ")"
|
stu_course_ids = stu_courses.empty? ? "(-1)" : "(" + stu_courses.map{|course| course.id}.join(',') + ")"
|
||||||
@homeworks = HomeworkCommon.where("course_id in #{stu_course_ids} and publish_time <= '#{Date.today}'").count
|
@homeworks = HomeworkCommon.where("course_id in #{stu_course_ids} and publish_time <= '#{Time.now}'").count
|
||||||
end
|
end
|
||||||
|
|
||||||
# 用户发布的issue数
|
# 用户发布的issue数
|
||||||
|
@ -3070,7 +3070,7 @@ module ApplicationHelper
|
||||||
|
|
||||||
#获取匿评相关连接代码
|
#获取匿评相关连接代码
|
||||||
def homework_anonymous_comment (homework, hw_status, user_activity_id = -1)
|
def homework_anonymous_comment (homework, hw_status, user_activity_id = -1)
|
||||||
if homework.homework_detail_manual.comment_status == 0 ||Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d")
|
if homework.homework_detail_manual.comment_status == 0 || homework.end_time >= Time.now
|
||||||
link = link_to "启动匿评","javascript:void(0)", :class => "wpostOptionLink", :title => "作业截止日期之前不可以启动匿评"
|
link = link_to "启动匿评","javascript:void(0)", :class => "wpostOptionLink", :title => "作业截止日期之前不可以启动匿评"
|
||||||
elsif homework.student_works.has_committed.count >= 2 && homework.homework_detail_manual#作业份数大于2
|
elsif homework.student_works.has_committed.count >= 2 && homework.homework_detail_manual#作业份数大于2
|
||||||
case homework.homework_detail_manual.comment_status
|
case homework.homework_detail_manual.comment_status
|
||||||
|
@ -3129,13 +3129,13 @@ module ApplicationHelper
|
||||||
else #学生显示提交作品、修改作品等按钮
|
else #学生显示提交作品、修改作品等按钮
|
||||||
work = cur_user_works_for_homework homework
|
work = cur_user_works_for_homework homework
|
||||||
project = cur_user_projects_for_homework homework
|
project = cur_user_projects_for_homework homework
|
||||||
if work.nil? && Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d")
|
if work.nil? && homework.end_time >= Time.now
|
||||||
if homework.homework_type ==3 && project.nil? && homework.homework_detail_group.base_on_project == 1
|
if homework.homework_type ==3 && project.nil? && homework.homework_detail_group.base_on_project == 1
|
||||||
link_to "提交作品(#{count})","javascript:void(0)", :class => 'c_grey',:style=>"cursor:not-allowed",:title => '请先关联项目再提交作品'
|
link_to "提交作品(#{count})","javascript:void(0)", :class => 'c_grey',:style=>"cursor:not-allowed",:title => '请先关联项目再提交作品'
|
||||||
else
|
else
|
||||||
link_to "提交作品(#{count})", new_student_work_url_without_domain(homework.id),:class => 'c_blue'
|
link_to "提交作品(#{count})", new_student_work_url_without_domain(homework.id),:class => 'c_blue'
|
||||||
end
|
end
|
||||||
elsif work.nil? && Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") < Time.now.strftime("%Y-%m-%d")
|
elsif work.nil? && homework.end_time < Time.now
|
||||||
if homework.homework_type ==3 && project.nil? && homework.homework_detail_group.base_on_project == 1
|
if homework.homework_type ==3 && project.nil? && homework.homework_detail_group.base_on_project == 1
|
||||||
link_to "补交作品(#{count})","javascript:void(0)", :class => 'c_grey',:style=>"cursor:not-allowed",:title => '请先关联项目再补交作品'
|
link_to "补交作品(#{count})","javascript:void(0)", :class => 'c_grey',:style=>"cursor:not-allowed",:title => '请先关联项目再补交作品'
|
||||||
else
|
else
|
||||||
|
@ -3155,9 +3155,9 @@ module ApplicationHelper
|
||||||
end
|
end
|
||||||
elsif homework.homework_detail_manual && homework.homework_detail_manual.comment_status == 3
|
elsif homework.homework_detail_manual && homework.homework_detail_manual.comment_status == 3
|
||||||
link_to "查看作品(#{count})",student_work_index_url_in_org(homework.id, 2), :class => 'c_blue', :title => "匿评已结束"
|
link_to "查看作品(#{count})",student_work_index_url_in_org(homework.id, 2), :class => 'c_blue', :title => "匿评已结束"
|
||||||
elsif homework.homework_type == 2 && Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d")#编程作业不能修改作品
|
elsif homework.homework_type == 2 && homework.end_time >= Time.now#编程作业不能修改作品
|
||||||
link_to "修改作品(#{count})", new_student_work_url_without_domain(homework.id),:class => 'c_blue'
|
link_to "修改作品(#{count})", new_student_work_url_without_domain(homework.id),:class => 'c_blue'
|
||||||
elsif Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d") && work.user_id == User.current.id
|
elsif homework.end_time >= Time.now && work.user_id == User.current.id
|
||||||
link_to "修改作品(#{count})", edit_student_work_url_without_domain(work.id),:class => 'c_blue'
|
link_to "修改作品(#{count})", edit_student_work_url_without_domain(work.id),:class => 'c_blue'
|
||||||
else
|
else
|
||||||
link_to "查看作品(#{count})", student_work_index_url_in_org(homework.id, 2), :class => 'c_blue', :title => "作业截止后不可修改作品"
|
link_to "查看作品(#{count})", student_work_index_url_in_org(homework.id, 2), :class => 'c_blue', :title => "作业截止后不可修改作品"
|
||||||
|
@ -3204,13 +3204,13 @@ module ApplicationHelper
|
||||||
else User.current.member_of_course?(homework.course)
|
else User.current.member_of_course?(homework.course)
|
||||||
work = cur_user_works_for_homework homework
|
work = cur_user_works_for_homework homework
|
||||||
project = cur_user_projects_for_homework homework
|
project = cur_user_projects_for_homework homework
|
||||||
if work.nil? && Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d")
|
if work.nil? && homework.end_time >= Time.now
|
||||||
if homework.homework_type ==3 && project.nil? && homework.homework_detail_group.base_on_project == 1
|
if homework.homework_type ==3 && project.nil? && homework.homework_detail_group.base_on_project == 1
|
||||||
link_to "关联项目", student_work_index_url_in_org(homework.id, 1), :class => 'hw_btn_green fr mt5',:title => '查看分组作业详情', :target => '_blank'
|
link_to "关联项目", student_work_index_url_in_org(homework.id, 1), :class => 'hw_btn_green fr mt5',:title => '查看分组作业详情', :target => '_blank'
|
||||||
else
|
else
|
||||||
link_to "提交作品", new_student_work_url_without_domain(homework.id),:class => 'hw_btn_green fr mt5', :target => '_blank'
|
link_to "提交作品", new_student_work_url_without_domain(homework.id),:class => 'hw_btn_green fr mt5', :target => '_blank'
|
||||||
end
|
end
|
||||||
elsif work.nil? && Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") < Time.now.strftime("%Y-%m-%d")
|
elsif work.nil? && homework.end_time < Time.now
|
||||||
if homework.homework_type ==3 && project.nil? && homework.homework_detail_group.base_on_project == 1
|
if homework.homework_type ==3 && project.nil? && homework.homework_detail_group.base_on_project == 1
|
||||||
link_to "关联项目", student_work_index_url_in_org(homework.id, 1), :class => 'hw_btn_green fr mt5',:title => '查看分组作业详情', :target => '_blank'
|
link_to "关联项目", student_work_index_url_in_org(homework.id, 1), :class => 'hw_btn_green fr mt5',:title => '查看分组作业详情', :target => '_blank'
|
||||||
else
|
else
|
||||||
|
@ -3221,9 +3221,9 @@ module ApplicationHelper
|
||||||
link_to "作品匿评", student_work_index_url_in_org(homework.id, 2), :class => 'hw_btn_green fr mt5', :title => "开启匿评后不可修改作品", :target => '_blank'
|
link_to "作品匿评", student_work_index_url_in_org(homework.id, 2), :class => 'hw_btn_green fr mt5', :title => "开启匿评后不可修改作品", :target => '_blank'
|
||||||
elsif homework.homework_detail_manual && homework.homework_detail_manual.comment_status == 3
|
elsif homework.homework_detail_manual && homework.homework_detail_manual.comment_status == 3
|
||||||
link_to "查看作品",student_work_index_url_in_org(homework.id, 2), :class => 'hw_btn_green fr mt5', :title => "匿评已结束", :target => '_blank'
|
link_to "查看作品",student_work_index_url_in_org(homework.id, 2), :class => 'hw_btn_green fr mt5', :title => "匿评已结束", :target => '_blank'
|
||||||
elsif homework.homework_type == 2 && Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d")#编程作业不能修改作品
|
elsif homework.homework_type == 2 && homework.end_time >= Time.now#编程作业不能修改作品
|
||||||
link_to "修改作品", new_student_work_url_without_domain(homework.id),:class => 'hw_btn_green fr mt5', :target => '_blank'
|
link_to "修改作品", new_student_work_url_without_domain(homework.id),:class => 'hw_btn_green fr mt5', :target => '_blank'
|
||||||
elsif Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d") && work.user_id == User.current.id
|
elsif homework.end_time >= Time.now && work.user_id == User.current.id
|
||||||
link_to "修改作品", edit_student_work_url_without_domain(work.id),:class => 'hw_btn_green fr mt5', :target => '_blank'
|
link_to "修改作品", edit_student_work_url_without_domain(work.id),:class => 'hw_btn_green fr mt5', :target => '_blank'
|
||||||
else
|
else
|
||||||
link_to "查看作品", student_work_index_url_in_org(homework.id, 2), :class => 'hw_btn_green fr mt5', :title => "作业截止后不可修改作品", :target => '_blank'
|
link_to "查看作品", student_work_index_url_in_org(homework.id, 2), :class => 'hw_btn_green fr mt5', :title => "作业截止后不可修改作品", :target => '_blank'
|
||||||
|
@ -3302,7 +3302,7 @@ module ApplicationHelper
|
||||||
#获取当前作业的提交截止时间/互评截止时间
|
#获取当前作业的提交截止时间/互评截止时间
|
||||||
def cur_homework_end_time homework
|
def cur_homework_end_time homework
|
||||||
str = ""
|
str = ""
|
||||||
if homework.anonymous_comment == 0 && homework.end_time && homework.end_time < Date.today && homework.homework_detail_manual
|
if homework.anonymous_comment == 0 && homework.end_time && homework.end_time < Time.now && homework.homework_detail_manual
|
||||||
str = "互评截止:#{format_date homework.homework_detail_manual.evaluation_end}"
|
str = "互评截止:#{format_date homework.homework_detail_manual.evaluation_end}"
|
||||||
else
|
else
|
||||||
str = "提交截止:#{homework.end_time ? (format_date homework.end_time) : ' -- '}"
|
str = "提交截止:#{homework.end_time ? (format_date homework.end_time) : ' -- '}"
|
||||||
|
@ -3975,7 +3975,7 @@ def get_hw_index(hw,is_teacher)
|
||||||
if is_teacher
|
if is_teacher
|
||||||
homeworks = hw.course.homework_commons.order("created_at asc")
|
homeworks = hw.course.homework_commons.order("created_at asc")
|
||||||
else
|
else
|
||||||
homeworks = hw.course.homework_commons.where("publish_time <= '#{Date.today}'").order("created_at asc")
|
homeworks = hw.course.homework_commons.where("publish_time <= '#{Time.now}'").order("created_at asc")
|
||||||
end
|
end
|
||||||
hw_ids = homeworks.map{|hw| hw.id} if !homeworks.empty?
|
hw_ids = homeworks.map{|hw| hw.id} if !homeworks.empty?
|
||||||
index = hw_ids.index(hw.id)
|
index = hw_ids.index(hw.id)
|
||||||
|
@ -3995,9 +3995,9 @@ def get_hw_status homework_common
|
||||||
else
|
else
|
||||||
str += '<span class="grey_homework_btn_cir ml5">匿评已禁用</span>'
|
str += '<span class="grey_homework_btn_cir ml5">匿评已禁用</span>'
|
||||||
end
|
end
|
||||||
if Time.parse(homework_common.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d")
|
if homework_common.end_time >= Time.now
|
||||||
str += '<span class="green_homework_btn_cir ml5">作品提交中</span>'
|
str += '<span class="green_homework_btn_cir ml5">作品提交中</span>'
|
||||||
elsif Time.parse(homework_common.end_time.to_s).strftime("%Y-%m-%d") < Time.now.strftime("%Y-%m-%d") && homework_common.anonymous_comment == 1 && User.current.allowed_to?(:as_teacher, homework_common.course)
|
elsif homework_common.end_time < Time.now && homework_common.anonymous_comment == 1 && User.current.allowed_to?(:as_teacher, homework_common.course)
|
||||||
str += '<span class="green_homework_btn_cir ml5" title="目前教师和教辅正在评阅">教师评阅中</span>'
|
str += '<span class="green_homework_btn_cir ml5" title="目前教师和教辅正在评阅">教师评阅中</span>'
|
||||||
else
|
else
|
||||||
str += '<span class="red_homework_btn_cir ml5">作品补交中</span>'
|
str += '<span class="red_homework_btn_cir ml5">作品补交中</span>'
|
||||||
|
@ -4117,6 +4117,33 @@ def create_works_list homework
|
||||||
end
|
end
|
||||||
end
|
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,
|
||||||
|
:quotes => 0, :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
|
||||||
|
homework.homework_tests.each_with_index do |homework_test|
|
||||||
|
homework_bank.homework_bank_tests << HomeworkBankTest.new(
|
||||||
|
test_type: 1,
|
||||||
|
input: homework_test.input,
|
||||||
|
output: homework_test.output
|
||||||
|
)
|
||||||
|
end
|
||||||
|
homework.homework_samples.each_with_index do |homework_test|
|
||||||
|
homework_bank.homework_bank_tests << HomeworkBankTest.new(
|
||||||
|
test_type: 0,
|
||||||
|
input: homework_test.input,
|
||||||
|
output: homework_test.output
|
||||||
|
)
|
||||||
|
end
|
||||||
|
elsif homework.homework_type == 3 && homework.homework_detail_group
|
||||||
|
homework_bank.min_num = homework.homework_detail_group.min_num
|
||||||
|
homework_bank.max_num = homework.homework_detail_group.max_num
|
||||||
|
homework_bank.base_on_project = homework.homework_detail_group.base_on_project
|
||||||
|
end
|
||||||
|
homework_bank
|
||||||
|
end
|
||||||
|
|
||||||
# 获取项目动态更新时间
|
# 获取项目动态更新时间
|
||||||
def get_forge_act_message(act, type)
|
def get_forge_act_message(act, type)
|
||||||
forge_act = ForgeActivity.where(:forge_act_id => act.id, :forge_act_type => type).first
|
forge_act = ForgeActivity.where(:forge_act_id => act.id, :forge_act_type => type).first
|
||||||
|
|
|
@ -824,7 +824,7 @@ module CoursesHelper
|
||||||
if User.current.admin? || User.current.allowed_to?(:as_teacher,course)
|
if User.current.admin? || User.current.allowed_to?(:as_teacher,course)
|
||||||
homework_num = course.homework_commons.count
|
homework_num = course.homework_commons.count
|
||||||
else
|
else
|
||||||
homework_num = course.homework_commons.where("publish_time <= '#{Date.today}'").count
|
homework_num = course.homework_commons.where("publish_time <= '#{Time.now}'").count
|
||||||
end
|
end
|
||||||
homework_num
|
homework_num
|
||||||
end
|
end
|
||||||
|
|
|
@ -161,7 +161,7 @@ module StudentWorkHelper
|
||||||
def revise_attachment_status homework, attach
|
def revise_attachment_status homework, attach
|
||||||
date = Time.parse(format_time(attach.created_on.to_s)).strftime("%Y-%m-%d")
|
date = Time.parse(format_time(attach.created_on.to_s)).strftime("%Y-%m-%d")
|
||||||
status = ""
|
status = ""
|
||||||
if homework.homework_detail_manual && ((homework.anonymous_comment == 0 &&homework.homework_detail_manual.evaluation_start.to_s <= date) || (homework.anonymous_comment == 1 && homework.end_time.to_s < date))
|
if homework.homework_detail_manual && ((homework.anonymous_comment == 0 &&homework.homework_detail_manual.evaluation_start.to_s <= date) || (homework.anonymous_comment == 1 && homework.end_time < attach.created_on))
|
||||||
status = "此时其他同学作品已公开"
|
status = "此时其他同学作品已公开"
|
||||||
else
|
else
|
||||||
status = "此时其他同学作品尚未公开"
|
status = "此时其他同学作品尚未公开"
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
class HomeworkBank < ActiveRecord::Base
|
||||||
|
# attr_accessible :title, :body
|
||||||
|
belongs_to :user
|
||||||
|
has_many :homework_bank_tests
|
||||||
|
|
||||||
|
def language_name
|
||||||
|
%W(C C++ Python Java).at(self.language.to_i - 1)
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,4 @@
|
||||||
|
class HomeworkBankTest < ActiveRecord::Base
|
||||||
|
# attr_accessible :title, :body
|
||||||
|
belongs_to :homework_bank
|
||||||
|
end
|
|
@ -159,7 +159,7 @@ class Member < ActiveRecord::Base
|
||||||
|
|
||||||
#当前课程的作业列表
|
#当前课程的作业列表
|
||||||
def homework_common_list
|
def homework_common_list
|
||||||
HomeworkCommon.where("course_id = ? and publish_time is not null and publish_time <= '#{Date.today}'", self.course_id)
|
HomeworkCommon.where("course_id = ? and publish_time is not null and publish_time <= '#{Time.now}'", self.course_id)
|
||||||
end
|
end
|
||||||
|
|
||||||
#当前学生在指定作业内的得分
|
#当前学生在指定作业内的得分
|
||||||
|
|
|
@ -190,7 +190,7 @@ class StudentWork < ActiveRecord::Base
|
||||||
|
|
||||||
# status == 0 : delay
|
# status == 0 : delay
|
||||||
def act_as_message
|
def act_as_message
|
||||||
if self.work_status != 0 && self.created_at > self.homework_common.end_time + 1
|
if self.work_status != 0 && self.created_at > self.homework_common.end_time
|
||||||
self.course_messages << CourseMessage.new(:user_id => self.user_id, :course_id => self.homework_common.course_id, :viewed => false, :status => false)
|
self.course_messages << CourseMessage.new(:user_id => self.user_id, :course_id => self.homework_common.course_id, :viewed => false, :status => false)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -114,6 +114,8 @@ class User < Principal
|
||||||
has_many :apply_homeworks, :dependent => :destroy
|
has_many :apply_homeworks, :dependent => :destroy
|
||||||
has_many :apply_resources, :dependent => :destroy
|
has_many :apply_resources, :dependent => :destroy
|
||||||
#end
|
#end
|
||||||
|
#题库
|
||||||
|
has_many :homework_banks, :dependent => :destroy
|
||||||
#竞赛
|
#竞赛
|
||||||
has_many :contests, :dependent => :destroy
|
has_many :contests, :dependent => :destroy
|
||||||
has_many :works, :dependent => :destroy
|
has_many :works, :dependent => :destroy
|
||||||
|
|
|
@ -702,7 +702,7 @@ class CoursesService
|
||||||
def homework_list params,current_user
|
def homework_list params,current_user
|
||||||
course = Course.find(params[:id])
|
course = Course.find(params[:id])
|
||||||
if course.is_public != 0 || current_user.member_of_course?(course)
|
if course.is_public != 0 || current_user.member_of_course?(course)
|
||||||
bids = course.homework_commons.where("publish_time <= ?",Time.now.strftime("%Y-%m-%d")).page(params[:page] || 1).per(20).reorder('created_at DESC')
|
bids = course.homework_commons.where("publish_time <= ?",Time.now).page(params[:page] || 1).per(20).reorder('created_at DESC')
|
||||||
bids = bids.like(params[:name]) if params[:name].present?
|
bids = bids.like(params[:name]) if params[:name].present?
|
||||||
homeworks = []
|
homeworks = []
|
||||||
bids.each do |bid|
|
bids.each do |bid|
|
||||||
|
|
|
@ -105,7 +105,7 @@ class HomeworkService
|
||||||
def start_anonymous_comment params,current_user
|
def start_anonymous_comment params,current_user
|
||||||
homework = HomeworkCommon.find(params[:homework_id])
|
homework = HomeworkCommon.find(params[:homework_id])
|
||||||
return {:status=> 4} unless current_user.admin? || current_user.allowed_to?(:as_teacher,Course.find(params[:course_id]))
|
return {:status=> 4} unless current_user.admin? || current_user.allowed_to?(:as_teacher,Course.find(params[:course_id]))
|
||||||
return {:status=>5} if Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d")
|
return {:status=>5} if homework.end_time >= Time.now
|
||||||
homework_detail_manual = homework.homework_detail_manual
|
homework_detail_manual = homework.homework_detail_manual
|
||||||
if homework_detail_manual.comment_status == 1
|
if homework_detail_manual.comment_status == 1
|
||||||
student_works = homework.student_works
|
student_works = homework.student_works
|
||||||
|
|
|
@ -193,7 +193,7 @@ class ResourcesService
|
||||||
|
|
||||||
courses_ids = courses.empty? ? '(-1)' :"(" + courses.map(&:id).join(",") + ")"
|
courses_ids = courses.empty? ? '(-1)' :"(" + courses.map(&:id).join(",") + ")"
|
||||||
|
|
||||||
homeworks = HomeworkCommon.where("course_id in #{courses_ids} and publish_time <= ?",Time.now.strftime("%Y-%m-%d")).order("created_at desc")
|
homeworks = HomeworkCommon.where("course_id in #{courses_ids} and publish_time <= ?",Time.now).order("created_at desc")
|
||||||
|
|
||||||
# homeworks.each do |v|
|
# homeworks.each do |v|
|
||||||
# course = Course.where("id=?",v.course_id).first
|
# course = Course.where("id=?",v.course_id).first
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
<p class="sy_cgrey ml20">
|
<p class="sy_cgrey ml20">
|
||||||
<% homework_count = e_course.homework_commons.where("publish_time <= '#{Date.today}'").count %>
|
<% homework_count = e_course.homework_commons.where("publish_time <= '#{Time.now}'").count %>
|
||||||
<% if homework_count > 0 %>
|
<% if homework_count > 0 %>
|
||||||
作业<span class="sy_cir_grey ml5 mr5"><%=homework_count %></span>
|
作业<span class="sy_cir_grey ml5 mr5"><%=homework_count %></span>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
var str = "";
|
||||||
|
<% if params[:type].to_i == 1 %>
|
||||||
|
str = "加入题库已成功";
|
||||||
|
<% elsif params[:type].to_i == 2 %>
|
||||||
|
str = "已经同步更新到题库";
|
||||||
|
<% elsif params[:type].to_i == 3 %>
|
||||||
|
str = "已经另存到题库";
|
||||||
|
<% end %>
|
||||||
|
notice_box(str);
|
||||||
|
<% if @hw_status == 5 %>
|
||||||
|
$("#homework_post_brief").html("<%= escape_javascript(render :partial => 'student_work/homework_post_brief', :locals => {:homework => @homework, :is_teacher => @is_teacher}) %>");
|
||||||
|
<% else %>
|
||||||
|
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework,:user_activity_id =>@user_activity_id,:hw_status=>@hw_status}) %>");
|
||||||
|
<% end %>
|
||||||
|
<% if @user_activity_id != @homework.id %>
|
||||||
|
sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", "UserActivity");
|
||||||
|
<% else %>
|
||||||
|
sd_create_editor_from_data(<%= @homework.id%>,"","100%", "<%=@homework.class.to_s%>");
|
||||||
|
<% end %>
|
|
@ -0,0 +1,17 @@
|
||||||
|
<% if @status == 1 %>
|
||||||
|
notice_box("该作业已发布");
|
||||||
|
<% elsif @status == 2 %>
|
||||||
|
notice_box("您还没有设置截止时间<br/>请先编辑作业并设置截止时间和发布时间");
|
||||||
|
<% else %>
|
||||||
|
notice_box("发布成功");
|
||||||
|
<% if @hw_status == 5 %>
|
||||||
|
$("#homework_post_brief").html("<%= escape_javascript(render :partial => 'student_work/homework_post_brief', :locals => {:homework => @homework, :is_teacher => @is_teacher}) %>");
|
||||||
|
<% else %>
|
||||||
|
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework,:user_activity_id =>@user_activity_id,:hw_status=>@hw_status}) %>");
|
||||||
|
<% end %>
|
||||||
|
<% if @user_activity_id != @homework.id %>
|
||||||
|
sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", "UserActivity");
|
||||||
|
<% else %>
|
||||||
|
sd_create_editor_from_data(<%= @homework.id%>,"","100%", "<%=@homework.class.to_s%>");
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
|
@ -13,7 +13,7 @@
|
||||||
<%= link_to student_work_name, student_work_path(student_work.id),:remote => true,:title => student_work.name, :class => "c_blue02"%>
|
<%= link_to student_work_name, student_work_path(student_work.id),:remote => true,:title => student_work.name, :class => "c_blue02"%>
|
||||||
</li>
|
</li>
|
||||||
<li class=" hwork_time_c">
|
<li class=" hwork_time_c">
|
||||||
<% if Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(student_work.created_at.to_s).strftime("%Y-%m-%d") %>
|
<% if @homework.end_time < student_work.created_at %>
|
||||||
<span class="c_red">迟交</span>
|
<span class="c_red">迟交</span>
|
||||||
<% else%>
|
<% else%>
|
||||||
<%= student_work.created_at.strftime("%m-%d").to_s%>
|
<%= student_work.created_at.strftime("%m-%d").to_s%>
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
<td class="hworkList130 c_grey student_work_<%= student_work.id %>" onclick="show_student_work('<%= student_work_path(student_work)%>');" style="cursor: pointer;">
|
<td class="hworkList130 c_grey student_work_<%= student_work.id %>" onclick="show_student_work('<%= student_work_path(student_work)%>');" style="cursor: pointer;">
|
||||||
<% if student_work.created_at && @homework.end_time %>
|
<% if student_work.created_at && @homework.end_time %>
|
||||||
<%= Time.parse(format_time(student_work.created_at)).strftime("%m-%d %H:%M") %>
|
<%= Time.parse(format_time(student_work.created_at)).strftime("%m-%d %H:%M") %>
|
||||||
<% if Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(format_time(student_work.created_at)).strftime("%Y-%m-%d") %>
|
<% if @homework.end_time < student_work.created_at %>
|
||||||
<span class="c_red">[迟交]</span>
|
<span class="c_red">[迟交]</span>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
<td class="hworkList110 c_grey student_work_<%= student_work.id %>" onclick="show_student_work('<%= student_work_path(student_work)%>');" style="cursor: pointer;">
|
<td class="hworkList110 c_grey student_work_<%= student_work.id %>" onclick="show_student_work('<%= student_work_path(student_work)%>');" style="cursor: pointer;">
|
||||||
<% if student_work.created_at && @homework.end_time %>
|
<% if student_work.created_at && @homework.end_time %>
|
||||||
<%= Time.parse(format_time(student_work.created_at)).strftime("%m-%d %H:%M") %>
|
<%= Time.parse(format_time(student_work.created_at)).strftime("%m-%d %H:%M") %>
|
||||||
<% if Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(format_time(student_work.created_at)).strftime("%Y-%m-%d") %>
|
<% if @homework.end_time < student_work.created_at %>
|
||||||
<span class="c_red">[迟交]</span>
|
<span class="c_red">[迟交]</span>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
<li class="hworkList130 c_grey student_work_<%= student_work.id%>" onclick="show_student_work('<%= student_work_path(student_work)%>');" style="cursor: pointer;">
|
<li class="hworkList130 c_grey student_work_<%= student_work.id%>" onclick="show_student_work('<%= student_work_path(student_work)%>');" style="cursor: pointer;">
|
||||||
<% if student_work.created_at && @homework.end_time%>
|
<% if student_work.created_at && @homework.end_time%>
|
||||||
<%= Time.parse(format_time(student_work.created_at)).strftime("%m-%d %H:%M")%>
|
<%= Time.parse(format_time(student_work.created_at)).strftime("%m-%d %H:%M")%>
|
||||||
<% if Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(format_time(student_work.created_at)).strftime("%Y-%m-%d") %>
|
<% if @homework.end_time < student_work.created_at %>
|
||||||
<span class="c_red">[迟交]</span>
|
<span class="c_red">[迟交]</span>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
@ -63,7 +63,7 @@
|
||||||
|
|
||||||
<li class="hworkList130 pl10 c_grey student_work_<%= student_work.id%>" onclick="show_student_work('<%= student_work_path(student_work)%>');" style="cursor: pointer;">
|
<li class="hworkList130 pl10 c_grey student_work_<%= student_work.id%>" onclick="show_student_work('<%= student_work_path(student_work)%>');" style="cursor: pointer;">
|
||||||
<%= Time.parse(format_time(student_work.created_at)).strftime("%m-%d %H:%M")%>
|
<%= Time.parse(format_time(student_work.created_at)).strftime("%m-%d %H:%M")%>
|
||||||
<% if Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(format_time(student_work.created_at)).strftime("%Y-%m-%d") %>
|
<% if @homework.end_time < student_work.created_at %>
|
||||||
<span class="c_red">[迟交]</span>
|
<span class="c_red">[迟交]</span>
|
||||||
<% end %>
|
<% end %>
|
||||||
</li>
|
</li>
|
||||||
|
|
|
@ -25,11 +25,11 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
<% if !homework.publish_time.nil? %>
|
<% if !homework.publish_time.nil? %>
|
||||||
<div class="homepagePostDeadline <%= (is_pro || is_base_group) ? 'mt8' : '' %>">
|
<div class="homepagePostDeadline <%= (is_pro || is_base_group) ? 'mt8' : '' %>">
|
||||||
<%= l(:label_publish_time)%>:<%= homework.publish_time%> 00:00
|
<%= l(:label_publish_time)%>:<%= format_time homework.publish_time%>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% if !homework.end_time.nil? %>
|
<% if !homework.end_time.nil? %>
|
||||||
<div class="homepagePostDeadline ml15 <%= (is_pro || is_base_group) ? 'mt8' : '' %>">提交截止时间:<%= homework.end_time.to_s %> 23:59</div>
|
<div class="homepagePostDeadline ml15 <%= (is_pro || is_base_group) ? 'mt8' : '' %>">提交截止时间:<%= format_time homework.end_time %></div>
|
||||||
<% end %>
|
<% end %>
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -88,7 +88,7 @@
|
||||||
<div class="mt5">
|
<div class="mt5">
|
||||||
<% if homework.homework_detail_manual%>
|
<% if homework.homework_detail_manual%>
|
||||||
<% if homework.homework_detail_manual.comment_status == 1%>
|
<% if homework.homework_detail_manual.comment_status == 1%>
|
||||||
<% end_time = homework.end_time.to_time.to_i + 24*60*60 - 1 %>
|
<% end_time = homework.end_time.to_i %>
|
||||||
<% if end_time >= Time.now.to_i %>
|
<% if end_time >= Time.now.to_i %>
|
||||||
<div class="fontGrey2 db fr">提交剩余时间: <span class="c_red"><%= (end_time - Time.now.to_i) / (24*60*60) %></span> 天
|
<div class="fontGrey2 db fr">提交剩余时间: <span class="c_red"><%= (end_time - Time.now.to_i) / (24*60*60) %></span> 天
|
||||||
<span class="c_red"><%= ((end_time - Time.now.to_i) % (24*60*60)) / (60*60)%></span> 小时
|
<span class="c_red"><%= ((end_time - Time.now.to_i) % (24*60*60)) / (60*60)%></span> 小时
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<a href="javascript:void(0);" class="linkBlue mt5 mb5" style="margin-left:165px; width: 24px;" onclick="$('#about_hwork_<%= work.id%>').html('');">收起</a>
|
<a href="javascript:void(0);" class="linkBlue mt5 mb5" style="margin-left:165px; width: 24px;" onclick="$('#about_hwork_<%= work.id%>').html('');">收起</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<% if work.user == User.current && Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d") %>
|
<% if work.user == User.current && @homework.end_time >= Time.now %>
|
||||||
<!-- 我的作业 && 匿评作业 && 未开启匿评,显示编辑和删除按钮 -->
|
<!-- 我的作业 && 匿评作业 && 未开启匿评,显示编辑和删除按钮 -->
|
||||||
<li class="fr" >
|
<li class="fr" >
|
||||||
<%= link_to("", student_work_path(work),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "pic_del") %>
|
<%= link_to("", student_work_path(work),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "pic_del") %>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<% revise_attachment = work.attachments.where("attachtype = 7").first %>
|
<% revise_attachment = work.attachments.where("attachtype = 7").first %>
|
||||||
<% if @homework.end_time < Date.today %>
|
<% if @homework.end_time < Time.now %>
|
||||||
<% if revise_attachment && work.user != User.current %>
|
<% if revise_attachment && work.user != User.current %>
|
||||||
<div class="resubAtt mb15">
|
<div class="resubAtt mb15">
|
||||||
<span class="resubTitle">作业修订附件</span>
|
<span class="resubTitle">作业修订附件</span>
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
<%=format_time work.commit_time %>
|
<%=format_time work.commit_time %>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<% if work.user == User.current && Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d") %>
|
<% if work.user == User.current && @homework.end_time >= Time.now %>
|
||||||
<!-- 我的作业 && 匿评作业 && 未开启匿评,显示编辑和删除按钮 -->
|
<!-- 我的作业 && 匿评作业 && 未开启匿评,显示编辑和删除按钮 -->
|
||||||
<li class="fr" >
|
<li class="fr" >
|
||||||
<%= link_to("", student_work_path(work),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "pic_del",:title=>"删除") %>
|
<%= link_to("", student_work_path(work),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "pic_del",:title=>"删除") %>
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
<%= link_to student_work_name, student_work_path(student_work),:remote => true,:title => student_work.name, :class => "c_blue02"%>
|
<%= link_to student_work_name, student_work_path(student_work),:remote => true,:title => student_work.name, :class => "c_blue02"%>
|
||||||
</li>
|
</li>
|
||||||
<li class=" hwork_time_c">
|
<li class=" hwork_time_c">
|
||||||
<% if Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(student_work.created_at.to_s).strftime("%Y-%m-%d") %>
|
<% if @homework.end_time < student_work.created_at %>
|
||||||
<span class="c_red">迟交</span>
|
<span class="c_red">迟交</span>
|
||||||
<% else%>
|
<% else%>
|
||||||
<%= student_work.created_at.strftime("%m-%d").to_s%>
|
<%= student_work.created_at.strftime("%m-%d").to_s%>
|
||||||
|
|
|
@ -16,9 +16,9 @@
|
||||||
<% unless @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1 %>
|
<% unless @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1 %>
|
||||||
<%=link_to "提交作品", new_student_work_url_without_domain(@homework.id),:class => 'blueCir ml5 f12' %>
|
<%=link_to "提交作品", new_student_work_url_without_domain(@homework.id),:class => 'blueCir ml5 f12' %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% elsif !@is_teacher && my_work &&Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(Time.now.to_s).strftime("%Y-%m-%d") && !@stundet_works.empty?%>
|
<% elsif !@is_teacher && my_work &&@homework.end_time < Time.now && !@stundet_works.empty?%>
|
||||||
<span class="f12 c_red">截止日期已过,已提交且不可修改</span>
|
<span class="f12 c_red">截止日期已过,已提交且不可修改</span>
|
||||||
<% elsif !@is_teacher && my_work &&Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.parse(Time.now.to_s).strftime("%Y-%m-%d") && !@stundet_works.empty?%>
|
<% elsif !@is_teacher && my_work &&@homework.end_time >= Time.now && !@stundet_works.empty?%>
|
||||||
<% if @homework.homework_type == 3 %>
|
<% if @homework.homework_type == 3 %>
|
||||||
<span class="f12 c_red">组长已提交,组长还可修改</span>
|
<span class="f12 c_red">组长已提交,组长还可修改</span>
|
||||||
<% else %>
|
<% else %>
|
||||||
|
@ -36,7 +36,7 @@
|
||||||
<%= link_to "代码查重", work_canrepeat_student_work_index_path(homework:@homework.id, course_id:@course.id), class: 'BlueCirBtn fl',:remote => true %>
|
<%= link_to "代码查重", work_canrepeat_student_work_index_path(homework:@homework.id, course_id:@course.id), class: 'BlueCirBtn fl',:remote => true %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end%>
|
<% end%>
|
||||||
<% if !@is_teacher && @homework.homework_type == 3 && my_work && my_work.user == User.current && Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(Time.now.to_s).strftime("%Y-%m-%d") %>
|
<% if !@is_teacher && @homework.homework_type == 3 && my_work && my_work.user == User.current && @homework.end_time < Time.now %>
|
||||||
<div class="mt5 fr">
|
<div class="mt5 fr">
|
||||||
<a href="javascript:void(0);" class="memberBtn fl mt3" title="添加小组成员" onclick="add_or_delete_group_member();">合作成员</a>
|
<a href="javascript:void(0);" class="memberBtn fl mt3" title="添加小组成员" onclick="add_or_delete_group_member();">合作成员</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<%= link_to_short_attachment attachment,:length=> 58, :class => 'hidden link_file_a fl newsBlue mw360', :download => true -%>
|
<%= link_to_short_attachment attachment,:length=> 58, :class => 'hidden link_file_a fl newsBlue mw360', :download => true -%>
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
<% if attachment.id && User.current == attachment.author && (attachment.attachtype == 7 || @homework.end_time >= Date.today) %>
|
<% if attachment.id && User.current == attachment.author && (attachment.attachtype == 7 || @homework.end_time >= Time.now) %>
|
||||||
<%= link_to(' '.html_safe, attachment_path(attachment, :format => 'js'), :method => 'delete', :remote => true, :title => '删除', :class => 'remove-upload fl', :confirm => l(:text_are_you_sure)) %>
|
<%= link_to(' '.html_safe, attachment_path(attachment, :format => 'js'), :method => 'delete', :remote => true, :title => '删除', :class => 'remove-upload fl', :confirm => l(:text_are_you_sure)) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<span class="postAttSize">(<%= number_to_human_size attachment.filesize %>)</span>
|
<span class="postAttSize">(<%= number_to_human_size attachment.filesize %>)</span>
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
<% if User.current.admin? || User.current.allowed_to?(:as_teacher,course) %>
|
<% if User.current.admin? || User.current.allowed_to?(:as_teacher,course) %>
|
||||||
<% homework_num = course.homework_commons.count %>
|
<% homework_num = course.homework_commons.count %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<% homework_num = course.homework_commons.where("publish_time <= '#{Date.today}'").count %>
|
<% homework_num = course.homework_commons.where("publish_time <= '#{Time.now}'").count %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<span class=" mr15">作业:
|
<span class=" mr15">作业:
|
||||||
<% if (course.is_public == 0 && !User.current.member_of_course?(course)) || @list_type == 1 %>
|
<% if (course.is_public == 0 && !User.current.member_of_course?(course)) || @list_type == 1 %>
|
||||||
|
|
|
@ -34,11 +34,11 @@
|
||||||
<div class="homepagePostSubmitContainer">
|
<div class="homepagePostSubmitContainer">
|
||||||
<%= render :partial => 'users/homework_opr', :locals => {:activity => activity, :is_teacher => is_teacher, :hw_status => hw_status, :user_activity_id => user_activity_id} %>
|
<%= render :partial => 'users/homework_opr', :locals => {:activity => activity, :is_teacher => is_teacher, :hw_status => hw_status, :user_activity_id => user_activity_id} %>
|
||||||
<% if !activity.end_time.nil? %>
|
<% if !activity.end_time.nil? %>
|
||||||
<div class="homepagePostDeadline">提交截止时间:<%= activity.end_time.to_s %> 23:59</div>
|
<div class="homepagePostDeadline">提交截止时间:<%= format_time activity.end_time %></div>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% if activity.homework_detail_manual.comment_status == 0 && !activity.publish_time.nil? %>
|
<% if activity.homework_detail_manual.comment_status == 0 && !activity.publish_time.nil? %>
|
||||||
<div class="homepagePostDeadline ml15">
|
<div class="homepagePostDeadline ml15">
|
||||||
<%= l(:label_publish_time)%>:<%= activity.publish_time%> 00:00
|
<%= l(:label_publish_time)%>:<%= format_time activity.publish_time%>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -95,6 +95,11 @@
|
||||||
<li>
|
<li>
|
||||||
<%= link_to(l(:label_bid_respond_delete), homework_common_path(activity, :hw_status => hw_status),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "wpostOptionLink") %>
|
<%= link_to(l(:label_bid_respond_delete), homework_common_path(activity, :hw_status => hw_status),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "wpostOptionLink") %>
|
||||||
</li>
|
</li>
|
||||||
|
<% if comment_status == 0 %>
|
||||||
|
<li>
|
||||||
|
<%= link_to("立即发布", publish_homework_homework_common_path(activity, :user_activity_id => user_activity_id, :hw_status => hw_status),:remote => true, :class => "wpostOptionLink") %>
|
||||||
|
</li>
|
||||||
|
<% end %>
|
||||||
<li>
|
<li>
|
||||||
<%= link_to("评分设置", score_rule_set_homework_common_path(activity,:user_activity_id => user_activity_id, :hw_status => hw_status),:class => "wpostOptionLink", :remote => true) %>
|
<%= link_to("评分设置", score_rule_set_homework_common_path(activity,:user_activity_id => user_activity_id, :hw_status => hw_status),:class => "wpostOptionLink", :remote => true) %>
|
||||||
</li>
|
</li>
|
||||||
|
@ -117,6 +122,20 @@
|
||||||
:title => "匿评是同学之间的双盲互评过程:每个同学将评阅系统分配给他/她的若干个作品", :remote => true)%>
|
:title => "匿评是同学之间的双盲互评过程:每个同学将评阅系统分配给他/她的若干个作品", :remote => true)%>
|
||||||
</li>
|
</li>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<% if activity.user == User.current %>
|
||||||
|
<% if activity.homework_bank_id.nil? %>
|
||||||
|
<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>
|
||||||
|
<% elsif activity.is_update %>
|
||||||
|
<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>
|
||||||
|
<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>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
<% if (activity.anonymous_comment == 1 && activity.is_open == 0) || (activity.anonymous_comment == 0 && comment_status == 3 && activity.is_open == 0) %>
|
<% if (activity.anonymous_comment == 1 && activity.is_open == 0) || (activity.anonymous_comment == 0 && comment_status == 3 && activity.is_open == 0) %>
|
||||||
<li>
|
<li>
|
||||||
<%= link_to("公开作品", alert_open_student_works_homework_common_path(activity,:user_activity_id => user_activity_id, :hw_status => hw_status),:class => "wpostOptionLink", :remote => true)%>
|
<%= link_to("公开作品", alert_open_student_works_homework_common_path(activity,:user_activity_id => user_activity_id, :hw_status => hw_status),:class => "wpostOptionLink", :remote => true)%>
|
||||||
|
|
|
@ -14,8 +14,8 @@
|
||||||
对此许可证的支持或反对,请在网站中留言,我们不断完善,谢谢!</span>
|
对此许可证的支持或反对,请在网站中留言,我们不断完善,谢谢!</span>
|
||||||
<% else %>
|
<% else %>
|
||||||
<div class="subject-pop-intro mb15">标题:<%=homework.name %><br />
|
<div class="subject-pop-intro mb15">标题:<%=homework.name %><br />
|
||||||
来源:<%=homework.course.name %><br />
|
适用课程:<%=homework.applicable_syllabus %><br />
|
||||||
<% if homework.homework_type == 2 && homework.homework_detail_programing %>
|
<% if homework.homework_type == 2 %>
|
||||||
编程语言:<%=homework.language_name %><br/>
|
编程语言:<%=homework.language_name %><br/>
|
||||||
<% end %>
|
<% end %>
|
||||||
贡献者:<%=homework.user.show_name %>
|
贡献者:<%=homework.user.show_name %>
|
||||||
|
@ -30,11 +30,12 @@
|
||||||
</div>
|
</div>
|
||||||
<% if homework.homework_type == 2 %>
|
<% if homework.homework_type == 2 %>
|
||||||
<div class="subject-pop-content mt10">
|
<div class="subject-pop-content mt10">
|
||||||
测试集:<%=homework.homework_tests.count %>组
|
输入输出样例:<%=homework.homework_bank_tests.where(:test_type => 0).count %>组<br/>
|
||||||
|
测试集:<%=homework.homework_bank_tests.where(:test_type => 1).count %>组
|
||||||
</div>
|
</div>
|
||||||
<% elsif homework.homework_type ==3 && homework.homework_detail_group %>
|
<% elsif homework.homework_type == 3 %>
|
||||||
<div class="subject-pop-content mt10">
|
<div class="subject-pop-content mt10">
|
||||||
分组人数:<%=homework.homework_detail_group.min_num %> - <%=homework.homework_detail_group.max_num %>人
|
分组人数:<%=homework.min_num %> - <%=homework.max_num %>人
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
<div class="homepagePostSubmit">
|
<div class="homepagePostSubmit">
|
||||||
<%= user_for_homework_common activity,is_teacher,work %>
|
<%= user_for_homework_common activity,is_teacher,work %>
|
||||||
</div>
|
</div>
|
||||||
<% if !is_teacher && !work.nil? && work.user == User.current && activity.end_time < Date.today %>
|
<% if !is_teacher && !work.nil? && work.user == User.current && activity.end_time < Time.now %>
|
||||||
<div class="homepagePostSubmit">
|
<div class="homepagePostSubmit">
|
||||||
<%=link_to "追加附件", student_work_index_url_in_org(activity.id, 2, 1), :class => 'c_blue', :title => "可追加作品修订附件" %>
|
<%=link_to "追加附件", student_work_index_url_in_org(activity.id, 2, 1), :class => 'c_blue', :title => "可追加作品修订附件" %>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -11,10 +11,37 @@
|
||||||
<div class="hw_popup_txt">
|
<div class="hw_popup_txt">
|
||||||
<p><%=@homework.description.html_safe %></p>
|
<p><%=@homework.description.html_safe %></p>
|
||||||
<% if @homework.homework_type == 2 %>
|
<% if @homework.homework_type == 2 %>
|
||||||
|
<div style="color: #888888;">
|
||||||
|
<p class="subjectContent mt10">
|
||||||
|
输入输出样例:<%=@homework.homework_bank_tests.where(:test_type => 0).count %>组
|
||||||
|
</p>
|
||||||
|
<% if @homework.homework_bank_tests.where(:test_type => 0).count > 0 %>
|
||||||
|
<% @homework.homework_bank_tests.where(:test_type => 0 ).each_with_index do |sample, index| %>
|
||||||
|
<span class="fl mt10">#<%= index + 1 %></span>
|
||||||
|
<ul class="fl ml20 mt10 program_input_ul">
|
||||||
|
<li>
|
||||||
|
<span class="fl">样例输入:</span>
|
||||||
|
<div class="fl ml10">
|
||||||
|
<pre class="user_program_input_pre"><%=sample.input %></pre>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<div class="cl"></div>
|
||||||
|
<li class="mt5">
|
||||||
|
<span class="fl">样例输出:</span>
|
||||||
|
<div class="fl ml10">
|
||||||
|
<pre class="user_program_input_pre"><%=sample.output %></pre>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<div class="cl"></div>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
<p class="subjectContent mt10">
|
<p class="subjectContent mt10">
|
||||||
测试集:<%=@homework.homework_tests.count %>组
|
测试集:<%=@homework.homework_bank_tests.where(:test_type => 1).count %>组
|
||||||
</p>
|
</p>
|
||||||
<% if @homework.user == User.current && @homework.homework_tests.count > 0 %>
|
<% if @homework.user == User.current && @homework.homework_bank_tests.where(:test_type => 1).count > 0 %>
|
||||||
<table class="hw_popup_testtable" cellpadding="0" cellspacing="0">
|
<table class="hw_popup_testtable" cellpadding="0" cellspacing="0">
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -22,7 +49,7 @@
|
||||||
<td class="test_td_title">测试集输入</td>
|
<td class="test_td_title">测试集输入</td>
|
||||||
<td class="test_td_title">测试集输出</td>
|
<td class="test_td_title">测试集输出</td>
|
||||||
</tr>
|
</tr>
|
||||||
<% @homework.homework_tests.each_with_index do |test, i| %>
|
<% @homework.homework_bank_tests.where(:test_type => 1).each_with_index do |test, i| %>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="test_td_min"><%=i+1 %></td>
|
<td class="test_td_min"><%=i+1 %></td>
|
||||||
<td><pre style="word-wrap:break-word; white-space:pre-wrap;"><%=test.input %></pre></td>
|
<td><pre style="word-wrap:break-word; white-space:pre-wrap;"><%=test.input %></pre></td>
|
||||||
|
@ -32,9 +59,10 @@
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% elsif @homework.homework_type ==3 && @homework.homework_detail_group %>
|
</div>
|
||||||
|
<% elsif @homework.homework_type ==3 %>
|
||||||
<p class="subjectContent mt10">
|
<p class="subjectContent mt10">
|
||||||
分组人数:<%=@homework.homework_detail_group.min_num %> - <%=@homework.homework_detail_group.max_num %>人
|
分组人数:<%=@homework.min_num %> - <%=@homework.max_num %>人
|
||||||
</p>
|
</p>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -7,18 +7,19 @@
|
||||||
<span class="hw_icons_cir fl mt5 mr5"></span>
|
<span class="hw_icons_cir fl mt5 mr5"></span>
|
||||||
<div class="fl ">
|
<div class="fl ">
|
||||||
<h3 class="sy_classlist_title fl">
|
<h3 class="sy_classlist_title fl">
|
||||||
<% if type == "1" %>
|
<%# if type == "1" %>
|
||||||
<%=link_to homework.name, student_work_index_path(:homework => homework), :class => 'linkGrey5', :target => "_blank" %>
|
<%#=link_to homework.name, student_work_index_path(:homework => homework), :class => 'linkGrey5', :target => "_blank" %>
|
||||||
<% else %>
|
<%# else %>
|
||||||
<%=homework.name %>
|
<%=homework.name %>
|
||||||
<% end %>
|
<%# end %>
|
||||||
</h3>
|
</h3>
|
||||||
<span class="<%=homework.course.is_public? ? 'hw_icon_open' : 'hw_icon_private'%> fl mt3"></span>
|
<span class="<%=homework.is_public? ? 'hw_icon_open' : 'hw_icon_private'%> fl mt3"></span>
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
<div class="sy_cgrey">
|
<div class="sy_cgrey">
|
||||||
<span class="fl">来源:</span>
|
<span class="fl">适用课程:</span>
|
||||||
<p class="fl hw_list_classname mr15">
|
<p class="fl hw_list_classname mr15">
|
||||||
<%=link_to homework.course.name.to_s + "(#{current_time_and_term_short(homework.course)})", course_path(homework.course), :class => 'hw_cgrey', :target => '_blank' %>
|
<%= homework.applicable_syllabus %>
|
||||||
|
<%#=link_to homework.course.name.to_s + "(#{current_time_and_term_short(homework.course)})", course_path(homework.course), :class => 'hw_cgrey', :target => '_blank' %>
|
||||||
</p>
|
</p>
|
||||||
<% if type == "2" %>
|
<% if type == "2" %>
|
||||||
<span class="mr15 fl">
|
<span class="mr15 fl">
|
||||||
|
@ -37,17 +38,22 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
</span>
|
</span>
|
||||||
<span class="fl mr15">引用数:<span id="subject_count_homework_<%=homework.id %>"><%= homework.quotes %></span></span>
|
<span class="fl mr15">引用数:<span id="subject_count_homework_<%=homework.id %>"><%= homework.quotes %></span></span>
|
||||||
<% if homework.publish_time.nil? %>
|
<%# if homework.publish_time.nil? %>
|
||||||
<span class="fl mr15">发布时间: - -</span>
|
<!--<span class="fl mr15">发布时间: - -</span>-->
|
||||||
<% else %>
|
<%# else %>
|
||||||
<span class="fl mr15">发布时间:<%= format_date(homework.publish_time) %></span>
|
<span class="fl mr15">创建时间:<%= format_date(homework.created_at) %></span>
|
||||||
<% end %>
|
<%# end %>
|
||||||
</div>
|
</div>
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
</div>
|
</div>
|
||||||
<% student_ids = homework.course.student.empty? ? [] : homework.course.student.map{|student| student.student_id}.join(',') %>
|
<% homework_common = HomeworkCommon.where(:id => homework.homework_common_id).first %>
|
||||||
<% if student_ids.include?(User.current.id.to_s) %>
|
<% if homework_common %>
|
||||||
|
<% student_ids = homework_common.course.student.empty? ? [] : homework_common.course.student.map{|student| student.student_id}.join(',') %>
|
||||||
|
<% if student_ids.include?(User.current.id.to_s) %>
|
||||||
<a href="javascript:void(0);" class="hw_btn_grey fr mt5" title="您选中的题是“我收到的作业”,不能发送">发送</a>
|
<a href="javascript:void(0);" class="hw_btn_grey fr mt5" title="您选中的题是“我收到的作业”,不能发送">发送</a>
|
||||||
|
<% else %>
|
||||||
|
<a href="javascript:void(0);" class="hw_btn_green fr mt5" onclick="choose_course('<%=User.current.id%>', '<%=homework.id %>');" data-remote="true">发送</a>
|
||||||
|
<% end %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<a href="javascript:void(0);" class="hw_btn_green fr mt5" onclick="choose_course('<%=User.current.id%>', '<%=homework.id %>');" data-remote="true">发送</a>
|
<a href="javascript:void(0);" class="hw_btn_green fr mt5" onclick="choose_course('<%=User.current.id%>', '<%=homework.id %>');" data-remote="true">发送</a>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
<span class="sy_cgrey ">排序:</span>
|
<span class="sy_cgrey ">排序:</span>
|
||||||
<%= link_to "发布时间",user_search_homeworks_user_path(@user,:name=>search,:type => type,:is_import=>is_import,:property=>property,:order => "publish_time", :sort => @r_sort),:class => "sy_cgrey fl",:remote => true%>
|
<%= link_to "创建时间",user_search_homeworks_user_path(@user,:name=>search,:type => type,:is_import=>is_import,:property=>property,:order => "created_at", :sort => @r_sort),:class => "sy_cgrey fl",:remote => true%>
|
||||||
<% if order == "publish_time" %>
|
<% if order == "created_at" %>
|
||||||
<%= link_to "", user_search_homeworks_user_path(@user,:name=>search,:type => type,:is_import=>is_import,:property=>property,:order => "publish_time", :sort => @r_sort), :class => "#{@r_sort == 'asc' ? 'sortupbtn' : 'sortdownbtn'} mt15 fl", :remote => true %>
|
<%= link_to "", user_search_homeworks_user_path(@user,:name=>search,:type => type,:is_import=>is_import,:property=>property,:order => "created_at", :sort => @r_sort), :class => "#{@r_sort == 'desc' ? 'sortupbtn' : 'sortdownbtn'} mt15 fl", :remote => true %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<%= link_to "", user_search_homeworks_user_path(@user,:name=>search,:type => type,:is_import=>is_import,:property=>property,:order => "publish_time", :sort => @r_sort), :class => "sortdownbtn sort_no mt15 fl", :remote => true %>
|
<%= link_to "", user_search_homeworks_user_path(@user,:name=>search,:type => type,:is_import=>is_import,:property=>property,:order => "created_at", :sort => @r_sort), :class => "sortdownbtn sort_no mt15 fl", :remote => true %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<%= link_to "引用数",user_search_homeworks_user_path(@user,:name=>search,:type => type,:is_import=>is_import,:property=>property,:order => "quotes", :sort => @r_sort),:class => "sy_cgrey fl",:remote => true%>
|
<%= link_to "引用数",user_search_homeworks_user_path(@user,:name=>search,:type => type,:is_import=>is_import,:property=>property,:order => "quotes", :sort => @r_sort),:class => "sy_cgrey fl",:remote => true%>
|
||||||
<% if order == "quotes" %>
|
<% if order == "quotes" %>
|
||||||
<%= link_to "", user_search_homeworks_user_path(@user,:name=>search,:type => type,:is_import=>is_import,:property=>property,:order => "quotes", :sort => @r_sort), :class => "#{@r_sort == 'asc' ? 'sortupbtn' : 'sortdownbtn'} mt15 fl", :remote => true %>
|
<%= link_to "", user_search_homeworks_user_path(@user,:name=>search,:type => type,:is_import=>is_import,:property=>property,:order => "quotes", :sort => @r_sort), :class => "#{@r_sort == 'desc' ? 'sortupbtn' : 'sortdownbtn'} mt15 fl", :remote => true %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<%= link_to "", user_search_homeworks_user_path(@user,:name=>search,:type => type,:is_import=>is_import,:property=>property,:order => "quotes", :sort => @r_sort), :class => "sortdownbtn sort_no mt15 fl", :remote => true %>
|
<%= link_to "", user_search_homeworks_user_path(@user,:name=>search,:type => type,:is_import=>is_import,:property=>property,:order => "quotes", :sort => @r_sort), :class => "sortdownbtn sort_no mt15 fl", :remote => true %>
|
||||||
<% end %>
|
<% end %>
|
|
@ -15,6 +15,7 @@
|
||||||
<pre class="program_input_pre"><%=sample.input %></pre>
|
<pre class="program_input_pre"><%=sample.input %></pre>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
|
<div class="cl"></div>
|
||||||
<li class="mt5">
|
<li class="mt5">
|
||||||
<span class="fl">样例输出:</span>
|
<span class="fl">样例输出:</span>
|
||||||
<div class="fl ml10">
|
<div class="fl ml10">
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
<span title="<%= homework.name%>"><%= homework.name%></span>
|
<span title="<%= homework.name%>"><%= homework.name%></span>
|
||||||
</label>
|
</label>
|
||||||
</li>
|
</li>
|
||||||
<li class="subject-pop-from fl hidden"><span title="<%=homework.course.name %>(<%=current_time_and_term(homework.course) %>)"><%=homework.course.name %>(<%=current_time_and_term_short(homework.course) %>)</span></li>
|
<li class="subject-pop-from fl hidden"><span title="<%=homework.applicable_syllabus %>"><%=homework.applicable_syllabus %></span></li>
|
||||||
<li class="subject-pop-type fl">
|
<li class="subject-pop-type fl">
|
||||||
<% case homework.homework_type %>
|
<% case homework.homework_type %>
|
||||||
<% when 1 %>
|
<% when 1 %>
|
||||||
|
@ -19,7 +19,7 @@
|
||||||
</li>
|
</li>
|
||||||
<li class="subject-pop-publisher fl hidden"><%= homework.user.show_name %></li>
|
<li class="subject-pop-publisher fl hidden"><%= homework.user.show_name %></li>
|
||||||
<li class="subject-pop-count fl"><%= homework.quotes %></li>
|
<li class="subject-pop-count fl"><%= homework.quotes %></li>
|
||||||
<li class="subject-pop-date fl"><%=format_date homework.publish_time %></li>
|
<li class="subject-pop-date fl"><%=format_date homework.created_at %></li>
|
||||||
</ul>
|
</ul>
|
||||||
<% end %>
|
<% end %>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
|
@ -12,11 +12,11 @@
|
||||||
<div>
|
<div>
|
||||||
<ul class="subject-pop-banner mt10">
|
<ul class="subject-pop-banner mt10">
|
||||||
<li class="subject-pop-name fl hidden"><span style="padding-left:15px;">作业名称</span></li>
|
<li class="subject-pop-name fl hidden"><span style="padding-left:15px;">作业名称</span></li>
|
||||||
<li class="subject-pop-from fl">来源</li>
|
<li class="subject-pop-from fl">适用课程</li>
|
||||||
<li class="subject-pop-type fl">类别</li>
|
<li class="subject-pop-type fl">类别</li>
|
||||||
<li class="subject-pop-publisher fl">贡献者</li>
|
<li class="subject-pop-publisher fl">贡献者</li>
|
||||||
<li class="subject-pop-count fl">引用数</li>
|
<li class="subject-pop-count fl">引用数</li>
|
||||||
<li class="subject-pop-date fl">发布时间</li>
|
<li class="subject-pop-date fl">创建时间</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<%= form_tag(user_select_homework_users_path, :multipart => true,:remote => true,:name=>"select_homework_form",:id=>'select_homework_form') do %>
|
<%= form_tag(user_select_homework_users_path, :multipart => true,:remote => true,:name=>"select_homework_form",:id=>'select_homework_form') do %>
|
||||||
|
|
|
@ -33,8 +33,8 @@
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<li class="homepageTabTime ml5" >
|
<li class="homepageTabTime ml5" >
|
||||||
<% end_time = uh.end_time.to_time.to_i + 24*60*60 - 1 %>
|
<% end_time = uh.end_time.to_i %>
|
||||||
<% if end_time > Time.now.to_i %>
|
<% if end_time > Time.now.to_i %>
|
||||||
<span class="c_red"><%= (end_time - Time.now.to_i) / (24*60*60) %></span> 天
|
<span class="c_red"><%= (end_time - Time.now.to_i) / (24*60*60) %></span> 天
|
||||||
<span class="c_red"><%= ((end_time - Time.now.to_i) % (24*60*60)) / (60*60)%></span> 小时
|
<span class="c_red"><%= ((end_time - Time.now.to_i) % (24*60*60)) / (60*60)%></span> 小时
|
||||||
<span class="c_red"><%= (((end_time - Time.now.to_i) % (24*60*60)) % (60*60)) / 60%></span> 分
|
<span class="c_red"><%= (((end_time - Time.now.to_i) % (24*60*60)) % (60*60)) / 60%></span> 分
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
<% if User.current.admin? || User.current.allowed_to?(:as_teacher,@course) %>
|
<% if User.current.admin? || User.current.allowed_to?(:as_teacher,@course) %>
|
||||||
<% homework_num = course.homework_commons.count %>
|
<% homework_num = course.homework_commons.count %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<% homework_num = course.homework_commons.where("publish_time <= '#{Date.today}'").count %>
|
<% homework_num = course.homework_commons.where("publish_time <= '#{Time.now}'").count %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<p class="list-info fr grayTxt"><span><%= homework_num %></span><span>作业</span><span>|</span><span> <%= visable_attachemnts_incourse(course).count %></span><span>资源</span></p>
|
<p class="list-info fr grayTxt"><span><%= homework_num %></span><span>作业</span><span>|</span><span> <%= visable_attachemnts_incourse(course).count %></span><span>资源</span></p>
|
||||||
</li>
|
</li>
|
||||||
|
|
|
@ -46,7 +46,7 @@
|
||||||
<%= user_for_homework_common homework_common,is_teacher %>
|
<%= user_for_homework_common homework_common,is_teacher %>
|
||||||
</div>
|
</div>
|
||||||
<% work = cur_user_works_for_homework homework_common %>
|
<% work = cur_user_works_for_homework homework_common %>
|
||||||
<% if !is_teacher && !work.nil? && homework_common.end_time < Date.today && work.user == User.current %>
|
<% if !is_teacher && !work.nil? && homework_common.end_time < Time.now && work.user == User.current %>
|
||||||
<div class="homepagePostSubmit">
|
<div class="homepagePostSubmit">
|
||||||
<%=link_to "追加附件", student_work_index_url_in_org(homework_common.id, 2, 1), :class => 'c_blue', :title => "可追加作品修订附件" %>
|
<%=link_to "追加附件", student_work_index_url_in_org(homework_common.id, 2, 1), :class => 'c_blue', :title => "可追加作品修订附件" %>
|
||||||
</div>
|
</div>
|
||||||
|
@ -73,13 +73,13 @@
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% if homework_common.homework_detail_manual && homework_common.homework_detail_manual.comment_status < 2 && !homework_common.publish_time.nil? %>
|
<% if homework_common.homework_detail_manual && homework_common.homework_detail_manual.comment_status < 2 && !homework_common.publish_time.nil? %>
|
||||||
<div class="homepagePostDeadline">提交截止时间:<%= homework_common.end_time.to_s %> 23:59</div>
|
<div class="homepagePostDeadline">提交截止时间:<%= format_time homework_common.end_time %></div>
|
||||||
<% elsif homework_common.homework_detail_manual && homework_common.homework_detail_manual.comment_status >= 2 && !homework_common.publish_time.nil? && homework_common.anonymous_comment == 0 %>
|
<% elsif homework_common.homework_detail_manual && homework_common.homework_detail_manual.comment_status >= 2 && !homework_common.publish_time.nil? && homework_common.anonymous_comment == 0 %>
|
||||||
<div class="homepagePostDeadline">匿评截止时间:<%= homework_common.homework_detail_manual.evaluation_end.to_s %> 23:59</div>
|
<div class="homepagePostDeadline">匿评截止时间:<%= homework_common.homework_detail_manual.evaluation_end.to_s %> 23:59</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% if homework_common.homework_detail_manual.comment_status == 0 && !homework_common.publish_time.nil? %>
|
<% if homework_common.homework_detail_manual.comment_status == 0 && !homework_common.publish_time.nil? %>
|
||||||
<div class="homepagePostDeadline ml15">
|
<div class="homepagePostDeadline ml15">
|
||||||
<%= l(:label_publish_time)%>:<%= homework_common.publish_time%> 00:00
|
<%= l(:label_publish_time)%>:<%= format_time homework_common.publish_time%>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<% content_for :header_tags do %>
|
<% content_for :header_tags do %>
|
||||||
<%= import_ke(enable_at: true, prettify: false, init_activity: false) %>
|
<%= import_ke(enable_at: true, prettify: false, init_activity: false) %>
|
||||||
|
|
||||||
<%= javascript_include_tag 'homework','baiduTemplate' %>
|
<%= javascript_include_tag 'homework', 'baiduTemplate', 'jquery.datetimepicker.js' %>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
function homework_name_focus(){
|
function homework_name_focus(){
|
||||||
$('#homework_editor').show();
|
$('#homework_editor').show();
|
||||||
|
@ -11,6 +11,11 @@
|
||||||
$('#select_type_nitice').show();
|
$('#select_type_nitice').show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
function submit_form(){
|
||||||
|
hideModal();
|
||||||
|
homework_form[0].submit();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
var first_click = true;
|
var first_click = true;
|
||||||
$(function(){
|
$(function(){
|
||||||
$("#homework_type_option").on("change",function(){
|
$("#homework_type_option").on("change",function(){
|
||||||
|
@ -52,10 +57,50 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
<% if edit_mode %>
|
<% if edit_mode %>
|
||||||
$("#anonymous_comment").on('click',function(){
|
$("#anonymous_comment").on('click',function(){
|
||||||
$("#homework_end_time_span").html("更改后评分比例将恢复默认值");
|
$("#anonymous_comment_notice").html("更改后评分比例将恢复默认值");
|
||||||
});
|
});
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
<% if !edit_mode || (edit_mode && homework.homework_detail_manual.comment_status.to_i < 2) %>
|
||||||
|
$('#homework_end_time').datetimepicker({
|
||||||
|
allowBlank:true,
|
||||||
|
lang:'ch',
|
||||||
|
format:'Y-m-d H:i',
|
||||||
|
formatTime:'H:i',
|
||||||
|
formatDate:'Y-m-d',
|
||||||
|
validateOnBlur:false
|
||||||
|
});
|
||||||
|
<% end %>
|
||||||
|
<% allow_edit = homework.student_works.has_committed.count == 0 && homework.student_work_projects.count ==0 %>
|
||||||
|
|
||||||
|
<% if allow_edit %>
|
||||||
|
$('#homework_publish_time').datetimepicker({
|
||||||
|
allowBlank:true,
|
||||||
|
lang:'ch',
|
||||||
|
format:'Y-m-d H:i',
|
||||||
|
formatTime:'H:i',
|
||||||
|
formatDate:'Y-m-d',
|
||||||
|
validateOnBlur:false
|
||||||
|
});
|
||||||
|
<% end %>
|
||||||
});
|
});
|
||||||
|
function publish_time_show(){
|
||||||
|
if($("#homework_end_time").val() != ""){
|
||||||
|
$("#reset_time").show();
|
||||||
|
$("#homework_publish_time_div").show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function reset_end_time(){
|
||||||
|
$("#homework_end_time").val('');
|
||||||
|
$("#homework_publish_time").val('');
|
||||||
|
$("#homework_publish_time_div").hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
function reset_publish_time(){
|
||||||
|
$("#homework_publish_time").val('');
|
||||||
|
}
|
||||||
|
|
||||||
function checked_val() {
|
function checked_val() {
|
||||||
if ($("#anonymous_comment").length > 0){
|
if ($("#anonymous_comment").length > 0){
|
||||||
if ($("#anonymous_comment").is(":checked")) {
|
if ($("#anonymous_comment").is(":checked")) {
|
||||||
|
@ -92,11 +137,8 @@
|
||||||
else if(!regex_homework_name()){
|
else if(!regex_homework_name()){
|
||||||
$("#homework_name").focus();
|
$("#homework_name").focus();
|
||||||
}
|
}
|
||||||
else if(!regex_homework_end_time()){
|
|
||||||
$("#homework_end_time").focus();
|
|
||||||
}
|
|
||||||
else if(!regex_homework_end_publish_time()){
|
else if(!regex_homework_end_publish_time()){
|
||||||
$("#homework_end_time").focus();
|
//$("#homework_end_time").focus();
|
||||||
}
|
}
|
||||||
else if(!regex_course_id()){
|
else if(!regex_course_id()){
|
||||||
$("#course_id").focus();
|
$("#course_id").focus();
|
||||||
|
@ -122,8 +164,15 @@
|
||||||
return true;
|
return true;
|
||||||
}else{
|
}else{
|
||||||
first_click = false;
|
first_click = false;
|
||||||
$(this)[0].submit();
|
if($.trim($("#homework_end_time").val()) == ""){
|
||||||
return false;
|
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
|
||||||
|
'<div class="clear mt15"><p class="text_c f14 fontGrey7">您还没有设置作业截止时间,因此学生不可见<br/>您是否确定</p><div class="cl"></div><a href="javascript:void(0)" class="fr sy_btn_blue mt10" style="margin-right: 92px;" onclick="submit_form()">确定</a>'+
|
||||||
|
'<a href="javascript:void(0);" class="fr sy_btn_grey mt10 mr10" onclick="hideModal();">取消</a></div></div>';
|
||||||
|
pop_box_new(htmlvalue, 300, 140);
|
||||||
|
} else{
|
||||||
|
$(this)[0].submit();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -132,7 +181,7 @@
|
||||||
function init_homework_editor(params){
|
function init_homework_editor(params){
|
||||||
params.textarea.removeAttr('placeholder');
|
params.textarea.removeAttr('placeholder');
|
||||||
var editor = params.kindutil.create(params.textarea, {
|
var editor = params.kindutil.create(params.textarea, {
|
||||||
resizeType : 1,minWidth:"1px",width:"100%",minHeight:"30px",height:"30px",
|
resizeType : 1,minWidth:"1px",width:"99.8%",minHeight:"30px",height:"30px",
|
||||||
items : ['code','emoticons','fontname',
|
items : ['code','emoticons','fontname',
|
||||||
'forecolor', 'hilitecolor', 'bold', '|', 'justifyleft', 'justifycenter', 'insertorderedlist','insertunorderedlist', '|',
|
'forecolor', 'hilitecolor', 'bold', '|', 'justifyleft', 'justifycenter', 'insertorderedlist','insertunorderedlist', '|',
|
||||||
'formatblock', 'fontsize', '|','indent', 'outdent',
|
'formatblock', 'fontsize', '|','indent', 'outdent',
|
||||||
|
@ -178,6 +227,7 @@
|
||||||
if(params.textarea.data('init') == undefined) {
|
if(params.textarea.data('init') == undefined) {
|
||||||
params.editor = init_homework_editor(params);
|
params.editor = init_homework_editor(params);
|
||||||
homework_description_editor = params.editor;
|
homework_description_editor = params.editor;
|
||||||
|
homework_form = params.form;
|
||||||
init_homework_form(params);
|
init_homework_form(params);
|
||||||
params.submit_btn.click(function () {
|
params.submit_btn.click(function () {
|
||||||
params.form.submit();
|
params.form.submit();
|
||||||
|
@ -219,30 +269,29 @@
|
||||||
|
|
||||||
<div id="homework_editor" style="display: <%= edit_mode ? 'block':'none'%>">
|
<div id="homework_editor" style="display: <%= edit_mode ? 'block':'none'%>">
|
||||||
<div class="mt10">
|
<div class="mt10">
|
||||||
<label class="fl c_grey f14 mt5">截止日期:</label>
|
<label class="fl c_grey f14 mt5">截止时间(可选):</label>
|
||||||
<div class="calendar_div fl mr70">
|
|
||||||
<input type="text" name="homework_common[end_time]" id="homework_end_time" class="InputBox fl W120 calendar_input" readonly="readonly" value="<%= homework.end_time%>" >
|
|
||||||
<% if homework.homework_detail_manual.comment_status.to_i < 2 %>
|
|
||||||
<%= calendar_for('homework_end_time')%>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
||||||
<label class="fl c_grey f14 mt5" style="margin-top: 4px;">发布日期(可选):</label>
|
|
||||||
<div class="calendar_div fl">
|
<div class="calendar_div fl">
|
||||||
<% allow_edit = homework.student_works.has_committed.count == 0 && homework.student_work_projects.count ==0 %>
|
<input type="text" name="homework_common[end_time]" onblur="publish_time_show()" id="homework_end_time" class="InputBox fl W130 calendar_input" readonly="readonly" value="<%= homework.end_time ? homework.end_time.strftime('%Y-%m-%d %H:%M') : '' %>" >
|
||||||
<input title="<%=allow_edit ? '' : '已有学生提交作品或关联项目,发布日期不可再编辑' %>" type="text" name="homework_common[publish_time]" id="homework_publish_time" class="InputBox fl W120 calendar_input" readonly="readonly" value="<%= homework.publish_time%>" >
|
<%# if homework.homework_detail_manual.comment_status.to_i < 2 %>
|
||||||
<% if allow_edit %>
|
<%#= calendar_for('homework_end_time')%>
|
||||||
<%= calendar_for('homework_publish_time')%>
|
<%# end %>
|
||||||
|
</div>
|
||||||
|
<% if !edit_mode || (edit_mode && homework.homework_detail_manual.comment_status.to_i < 1) %>
|
||||||
|
<a href="javascript:void(0)" id="reset_time" class="fl sy_btn_grey ml10" onclick="reset_end_time();">清空</a>
|
||||||
|
<% end %>
|
||||||
|
<div class="fl <%= homework.publish_time.nil? ? 'none' : '' %> ml50" id="homework_publish_time_div">
|
||||||
|
<label class="fl c_grey f14 mt5" style="margin-top: 4px;">发布时间(可选):</label>
|
||||||
|
<div class="calendar_div fl">
|
||||||
|
<% allow_edit = homework.student_works.has_committed.count == 0 && homework.student_work_projects.count ==0 %>
|
||||||
|
<input title="<%=allow_edit ? '' : '已有学生提交作品或关联项目,发布日期不可再编辑' %>" type="text" name="homework_common[publish_time]" id="homework_publish_time" class="InputBox fl W130 calendar_input" readonly="readonly" value="<%= homework.publish_time ? homework.publish_time.strftime('%Y-%m-%d %H:%M') : '' %>">
|
||||||
|
<%# if allow_edit %>
|
||||||
|
<%#= calendar_for('homework_publish_time')%>
|
||||||
|
<%# end %>
|
||||||
|
</div>
|
||||||
|
<% if !edit_mode || (edit_mode && homework.homework_detail_manual.comment_status.to_i < 1) %>
|
||||||
|
<a href="javascript:void(0)" id="reset_time" class="fl sy_btn_grey ml10" onclick="reset_publish_time();">清空</a>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<% if !edit_mode || edit_mode && homework.homework_detail_manual.comment_status < 2 %>
|
|
||||||
<div class="fr f14 ml10" style="margin-top: 4px;">
|
|
||||||
<input type="checkbox" value="<%=edit_mode ? homework.anonymous_comment : 1 %>" id="anonymous_comment"/>
|
|
||||||
<span class="f14 c_grey">启用匿评</span>
|
|
||||||
<!--<span id="anonymous_hint" style="display: none; font-size: 12px;" class="c_red">更改后评分比例将恢复默认值</span>-->
|
|
||||||
</div>
|
|
||||||
<% end %>
|
|
||||||
<input type="hidden" name="homework_common[anonymous_comment]" value="<%=edit_mode ? homework.anonymous_comment : 1 %>" id="real_anonymous_comment"/>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
<p id="homework_end_time_span" class="c_red mt5"></p>
|
<p id="homework_end_time_span" class="c_red mt5"></p>
|
||||||
|
@ -268,6 +317,25 @@
|
||||||
<p id="e_tips" class="c_grey"></p>
|
<p id="e_tips" class="c_grey"></p>
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
|
|
||||||
|
<div class="homework_base_setting mt10">
|
||||||
|
<ul>
|
||||||
|
<li class="f14 ml10 mt5 mb5" style="">
|
||||||
|
<input type="checkbox" <%= (!edit_mode || edit_mode && homework.homework_detail_manual.comment_status < 2) ? '' : 'disabled' %> value="<%=edit_mode ? homework.anonymous_comment : 1 %>" id="anonymous_comment"/>
|
||||||
|
<label for="anonymous_comment" class="f14 c_grey">启用匿评(默认在截止日期后的第七日开启匿评,您可以通过匿评设置进行修改)
|
||||||
|
<span id="anonymous_comment_notice" class="c_red f12"></span>
|
||||||
|
</label>
|
||||||
|
</li>
|
||||||
|
<% if !edit_mode %>
|
||||||
|
<li class="f14 ml10 mb5" style="">
|
||||||
|
<input type="checkbox" value="1" name="add_to_bank" id="join_bank"/>
|
||||||
|
<label for="join_bank" class="f14 c_grey">加入题库(同时将该作业保存到您的题库,可以随时复用)</label>
|
||||||
|
</li>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
||||||
|
<input type="hidden" name="homework_common[anonymous_comment]" value="<%=edit_mode ? homework.anonymous_comment : 1 %>" id="real_anonymous_comment"/>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="mt10 b_grey undis" style="padding:10px;" id="homeworkSetting">
|
<div class="mt10 b_grey undis" style="padding:10px;" id="homeworkSetting">
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
@ -284,7 +352,7 @@
|
||||||
<%#= link_to "取消",user_homeworks_user_path(User.current.id),:class => "fr mr10 mt3"%>
|
<%#= link_to "取消",user_homeworks_user_path(User.current.id),:class => "fr mr10 mt3"%>
|
||||||
<a href="javascript:void(0);" id="new_message_cancel_btn" class="fr mr10 mt3">取消</a>
|
<a href="javascript:void(0);" id="new_message_cancel_btn" class="fr mr10 mt3">取消</a>
|
||||||
<% else %>
|
<% else %>
|
||||||
<a href="javascript:void(0);" id="new_message_submit_btn" class="BlueCirBtnMini fr">发送</a>
|
<a href="javascript:void(0);" id="new_message_submit_btn" class="BlueCirBtnMini fr">保存</a>
|
||||||
<span class="fr mr10 mt3">或</span>
|
<span class="fr mr10 mt3">或</span>
|
||||||
<a href="javascript:void(0);" id="new_message_cancel_btn" class="fr mr10 mt3">取消</a>
|
<a href="javascript:void(0);" id="new_message_cancel_btn" class="fr mr10 mt3">取消</a>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
@ -79,7 +79,7 @@
|
||||||
<%= @homework.name %>
|
<%= @homework.name %>
|
||||||
</div>
|
</div>
|
||||||
<span class="fr c_grey">
|
<span class="fr c_grey">
|
||||||
截止时间:<%= @homework.end_time %>
|
截止时间:<%= format_time @homework.end_time %>
|
||||||
</span>
|
</span>
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
<a href="javascript:void(0);" class="c_blue"><%= @homework.user.show_name %></a>
|
<a href="javascript:void(0);" class="c_blue"><%= @homework.user.show_name %></a>
|
||||||
|
|
|
@ -53,7 +53,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="HomeWorkBox">
|
<div class="HomeWorkBox">
|
||||||
<div class="">
|
<div class="">
|
||||||
<div class="homepagePostTitle fl"><%= @homework.name %></div><span class="fr c_grey">截止时间:<%= @homework.end_time %></span>
|
<div class="homepagePostTitle fl"><%= @homework.name %></div><span class="fr c_grey">截止时间:<%= format_time @homework.end_time %></span>
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
<a href="javascript:void(0);" class="c_blue"><%= @homework.user.show_name %></a>
|
<a href="javascript:void(0);" class="c_blue"><%= @homework.user.show_name %></a>
|
||||||
<p class="HomeWorkP"><%= @homework.description %> <br />
|
<p class="HomeWorkP"><%= @homework.description %> <br />
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
//$("#HomeWorkCon").replaceWith("<%#= escape_javascript(render :partial => 'users/user_homework_form', :locals => { :homework => @homework,:edit_mode => true })%>");
|
//$("#HomeWorkCon").replaceWith("<%#= escape_javascript(render :partial => 'users/user_homework_form', :locals => { :homework => @homework,:edit_mode => true })%>");
|
||||||
hideModal('#coursesChoosePopup');
|
hideModal('#coursesChoosePopup');
|
||||||
$("#homework_name").val("<%= @homework.name%>");
|
$("#homework_name").val("<%= @homework.name%>");
|
||||||
$("#homework_end_time").val("<%= @homework.end_time%>");
|
//$("#homework_end_time").val("<%#= @homework.end_time%>");
|
||||||
<% if @select_course == "0"%>
|
<% if @select_course == "0"%>
|
||||||
$("#course_id").val("<%= @homework.course_id%>");
|
$("#course_id").val("<%= @homework.course_id%>");
|
||||||
<% end%>
|
<% end%>
|
||||||
|
|
|
@ -316,6 +316,8 @@ RedmineApp::Application.routes.draw do
|
||||||
post 'set_evaluation_attr'
|
post 'set_evaluation_attr'
|
||||||
get 'alert_score_open_modal'
|
get 'alert_score_open_modal'
|
||||||
post 'set_score_open'
|
post 'set_score_open'
|
||||||
|
get 'add_to_homework_bank'
|
||||||
|
get 'publish_homework'
|
||||||
end
|
end
|
||||||
|
|
||||||
collection do
|
collection do
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
class CreateHomeworkBanks < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
create_table :homework_banks do |t|
|
||||||
|
t.references :user
|
||||||
|
t.string :name
|
||||||
|
t.text :description
|
||||||
|
t.integer :homework_type
|
||||||
|
t.integer :quotes, :default => 0
|
||||||
|
t.boolean :is_public
|
||||||
|
t.string :language
|
||||||
|
t.text :standard_code, :limit => 4294967295
|
||||||
|
t.integer :min_num
|
||||||
|
t.integer :max_num
|
||||||
|
t.boolean :base_on_project
|
||||||
|
t.string :applicable_syllabus
|
||||||
|
t.integer :homework_common_id
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,12 @@
|
||||||
|
class CreateHomeworkBankTests < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
create_table :homework_bank_tests do |t|
|
||||||
|
t.text :input
|
||||||
|
t.text :output
|
||||||
|
t.boolean :test_type
|
||||||
|
t.references :homework_bank
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,45 @@
|
||||||
|
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 => homework.quotes, :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
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,15 @@
|
||||||
|
class AlterHomeworkPublishEnd < ActiveRecord::Migration
|
||||||
|
def up
|
||||||
|
change_column :homework_commons, :publish_time, :datetime
|
||||||
|
change_column :homework_commons, :end_time, :datetime
|
||||||
|
|
||||||
|
HomeworkCommon.all.each do |homework|
|
||||||
|
homework.update_column('end_time', homework.end_time + 1.day - 1) unless homework.end_time.nil?
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
change_column :homework_commons, :publish_time, :date
|
||||||
|
change_column :homework_commons, :end_time, :date
|
||||||
|
end
|
||||||
|
end
|
|
@ -792,21 +792,25 @@ function regex_homework_name()
|
||||||
//验证发布时间不能大于截止时间
|
//验证发布时间不能大于截止时间
|
||||||
function regex_homework_end_publish_time()
|
function regex_homework_end_publish_time()
|
||||||
{
|
{
|
||||||
var myDate = new Date();
|
if($.trim($("#homework_end_time").val()) != ""){
|
||||||
if($.trim($("#homework_publish_time").val()) == "")
|
var myDate = new Date();
|
||||||
{
|
if($.trim($("#homework_publish_time").val()) == "")
|
||||||
$("#homework_publish_time").val(formate_date(myDate));
|
{
|
||||||
}
|
$("#homework_publish_time").val(formate_date(myDate));
|
||||||
var publish_time = Date.parse($("#homework_publish_time").val());
|
}
|
||||||
var end_time = Date.parse($("#homework_end_time").val());
|
var publish_time = Date.parse($("#homework_publish_time").val());
|
||||||
if(end_time < publish_time)
|
var end_time = Date.parse($("#homework_end_time").val());
|
||||||
{
|
if(end_time < publish_time)
|
||||||
$("#homework_end_time_span").text("截止日期不能小于发布日期");
|
{
|
||||||
return false;
|
$("#homework_end_time_span").text("截止时间应晚于发布时间");
|
||||||
}
|
return false;
|
||||||
else
|
}
|
||||||
{
|
else
|
||||||
$("#homework_end_time_span").text("");
|
{
|
||||||
|
$("#homework_end_time_span").text("");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
} else{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -832,13 +836,21 @@ function formate_date(date){
|
||||||
var year = date.getFullYear();
|
var year = date.getFullYear();
|
||||||
var month = date.getMonth() + 1;
|
var month = date.getMonth() + 1;
|
||||||
var day = date.getDate();
|
var day = date.getDate();
|
||||||
|
var hour = date.getHours();
|
||||||
|
var min = date.getMinutes();
|
||||||
if(month < 10) {
|
if(month < 10) {
|
||||||
month = '0' + month;
|
month = '0' + month;
|
||||||
}
|
}
|
||||||
if(day < 10) {
|
if(day < 10) {
|
||||||
day = '0' + day;
|
day = '0' + day;
|
||||||
}
|
}
|
||||||
str = year + '-' + month + '-' + day;
|
if(hour < 10) {
|
||||||
|
hour = '0' + hour;
|
||||||
|
}
|
||||||
|
if(min < 10) {
|
||||||
|
min = '0' + min;
|
||||||
|
}
|
||||||
|
str = year + '-' + month + '-' + day + " " + hour + ":" + min;
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -129,22 +129,24 @@ function regex_homework_name()
|
||||||
//验证发布时间不能大于截止时间
|
//验证发布时间不能大于截止时间
|
||||||
function regex_homework_end_publish_time()
|
function regex_homework_end_publish_time()
|
||||||
{
|
{
|
||||||
var myDate = new Date();
|
if($.trim($("#homework_end_time").val()) != ""){
|
||||||
if($.trim($("#homework_publish_time").val()) == "")
|
var myDate = new Date();
|
||||||
{
|
if($.trim($("#homework_publish_time").val()) == "")
|
||||||
$("#homework_publish_time").val(formate_date(myDate));
|
{
|
||||||
}
|
$("#homework_publish_time").val(formate_date(myDate));
|
||||||
var end_time = Date.parse($("#homework_end_time").val());
|
}
|
||||||
var publish_time = Date.parse($("#homework_publish_time").val());
|
var publish_time = Date.parse($("#homework_publish_time").val());
|
||||||
if(end_time < publish_time)
|
var end_time = Date.parse($("#homework_end_time").val());
|
||||||
{
|
if(end_time < publish_time)
|
||||||
$("#homework_end_time_span").text("截止日期不能小于发布日期");
|
{
|
||||||
return false;
|
$("#homework_end_time_span").text("截止时间应晚于发布时间");
|
||||||
}
|
return false;
|
||||||
else
|
}
|
||||||
{
|
else
|
||||||
$("#homework_end_time_span").text("");
|
{
|
||||||
return true;
|
$("#homework_end_time_span").text("");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -123,7 +123,7 @@ h4{ font-size:14px;}/*color:#3b3b3b;*/
|
||||||
.mw150 {max-width: 150px !important;}.mw220 {max-width: 220px !important;}.mw280 {max-width:280px !important;}.mw360 {max-width: 360px !important;}
|
.mw150 {max-width: 150px !important;}.mw220 {max-width: 220px !important;}.mw280 {max-width:280px !important;}.mw360 {max-width: 360px !important;}
|
||||||
.mw380 {max-width: 380px !important;}.mw400 {max-width: 400px !important;}.mh18 {max-height: 18px;}.max_h54 {max-height:54px; }.maxHeight100 {max-height:100px; overflow-x:hidden; overflow-y:auto;}
|
.mw380 {max-width: 380px !important;}.mw400 {max-width: 400px !important;}.mh18 {max-height: 18px;}.max_h54 {max-height:54px; }.maxHeight100 {max-height:100px; overflow-x:hidden; overflow-y:auto;}
|
||||||
.maxHeight200 {max-height:200px; overflow-x:hidden; overflow-y:auto;}
|
.maxHeight200 {max-height:200px; overflow-x:hidden; overflow-y:auto;}
|
||||||
.W50{ width:50px;}.W120{ width:110px;}.W200{ width:200px;}.W300 {width:300px !important;}.W320{ width:320px;}.W420 {width:420px;}.W440{ width:440px;}
|
.W50{ width:50px;}.W120{ width:110px;}.W130{ width:130px;}.W200{ width:200px;}.W300 {width:300px !important;}.W320{ width:320px;}.W420 {width:420px;}.W440{ width:440px;}
|
||||||
.W600{ width:600px !important;}.W700{ width:700px; max-width:700px; min-width:700px;}.W710{ width:708px;}.W800{ width:800px !important;}
|
.W600{ width:600px !important;}.W700{ width:700px; max-width:700px; min-width:700px;}.W710{ width:708px;}.W800{ width:800px !important;}
|
||||||
.maxwidth150{max-width: 150px;}.m_w460{max-width: 460px;}.m_w500{max-width: 500px;}.m_w505{max-width: 505px;}.m_w530{max-width: 530px;}
|
.maxwidth150{max-width: 150px;}.m_w460{max-width: 460px;}.m_w500{max-width: 500px;}.m_w505{max-width: 505px;}.m_w530{max-width: 530px;}
|
||||||
.m_w600{max-width: 600px;}.td_w70{ width:70px;}.td_w60{ width:60px;}.td_w110{ width:110px;}.width165{width: 165px;}.width180{width: 180px !important;}
|
.m_w600{max-width: 600px;}.td_w70{ width:70px;}.td_w60{ width:60px;}.td_w110{ width:110px;}.width165{width: 165px;}.width180{width: 180px !important;}
|
||||||
|
|
|
@ -538,4 +538,5 @@ a.banner-course-notice {position: absolute; font-size: 12px; line-height: 20px;
|
||||||
.course_class_users_st_name{ display: inline-block;width:120px; overflow:hidden;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
|
.course_class_users_st_name{ display: inline-block;width:120px; overflow:hidden;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
|
||||||
|
|
||||||
.program_input_pre{font-family: '微软雅黑','宋体'; max-width:450px; word-wrap:break-word; white-space:pre-wrap;}
|
.program_input_pre{font-family: '微软雅黑','宋体'; max-width:450px; word-wrap:break-word; white-space:pre-wrap;}
|
||||||
.homeworkInfo .program_input_ul li{list-style-type: none; margin-left: 0;}
|
.homeworkInfo .program_input_ul li{list-style-type: none; margin-left: 0;}
|
||||||
|
.homework_base_setting{border: 1px solid #d9d9d9; background: #F5F5F5; color: #d9d9d9;}
|
|
@ -652,3 +652,4 @@ a:hover.sy_class_ltitle{ color:#333;}
|
||||||
.sy_tips_box_inner span { display: block; border-width: 10px;position: absolute;top: 15px; left: -18px; border-style: dashed solid dashed dashed;border-color: transparent #fff transparent transparent;font-size: 0;line-height: 0;}
|
.sy_tips_box_inner span { display: block; border-width: 10px;position: absolute;top: 15px; left: -18px; border-style: dashed solid dashed dashed;border-color: transparent #fff transparent transparent;font-size: 0;line-height: 0;}
|
||||||
.sy_tips_box_inner em { display: block; border-width: 11px;position: absolute;top: 42px; left: -23px; border-style: dashed solid dashed dashed;border-color: transparent #eaeaea transparent transparent;font-size: 0;line-height: 0;}
|
.sy_tips_box_inner em { display: block; border-width: 11px;position: absolute;top: 42px; left: -23px; border-style: dashed solid dashed dashed;border-color: transparent #eaeaea transparent transparent;font-size: 0;line-height: 0;}
|
||||||
|
|
||||||
|
.user_program_input_pre{max-width:650px; word-wrap:break-word; white-space:pre-wrap;font-family: Helvetica, Tahoma, Arial, "Microsoft YaHei", "微软雅黑", SimSun, "宋体", STXihei, "华文细黑", Heiti, "黑体", sans-serif;}
|
|
@ -0,0 +1,6 @@
|
||||||
|
FactoryGirl.define do
|
||||||
|
factory :homework_bank_test do
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
|
@ -0,0 +1,6 @@
|
||||||
|
FactoryGirl.define do
|
||||||
|
factory :homework_bank do
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
|
@ -0,0 +1,5 @@
|
||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe HomeworkBank, :type => :model do
|
||||||
|
pending "add some examples to (or delete) #{__FILE__}"
|
||||||
|
end
|
|
@ -0,0 +1,5 @@
|
||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe HomeworkBankTest, :type => :model do
|
||||||
|
pending "add some examples to (or delete) #{__FILE__}"
|
||||||
|
end
|
Loading…
Reference in New Issue