分组作业
This commit is contained in:
parent
ba5d72b315
commit
f880ccd749
|
@ -126,14 +126,33 @@ class HomeworkCommonController < ApplicationController
|
|||
if @homework_detail_manual.comment_status == 1
|
||||
student_works = @homework.student_works
|
||||
if student_works && student_works.size >= 2
|
||||
student_works.each_with_index do |work, index|
|
||||
user = work.user
|
||||
n = @homework_detail_manual.evaluation_num
|
||||
n = n < student_works.size ? n : student_works.size - 1
|
||||
assigned_homeworks = get_assigned_homeworks(student_works, n, index)
|
||||
assigned_homeworks.each do |h|
|
||||
student_works_evaluation_distributions = StudentWorksEvaluationDistribution.new(user_id: user.id, student_work_id: h.id)
|
||||
student_works_evaluation_distributions.save
|
||||
if @homework.homework_type == 3
|
||||
student_work_projects = @homework.student_work_projects.where("student_work_id is not null")
|
||||
student_work_projects.each_with_index do |pro_work, pro_index|
|
||||
n = @homework_detail_manual.evaluation_num
|
||||
n = n < student_works.size ? n : student_works.size - 1
|
||||
work_index = -1
|
||||
student_works.each_with_index do |stu_work, stu_index|
|
||||
if stu_work.id.to_i == pro_work.student_work_id.to_i
|
||||
work_index = stu_index
|
||||
end
|
||||
end
|
||||
assigned_homeworks = get_assigned_homeworks(student_works, n, work_index)
|
||||
assigned_homeworks.each do |h|
|
||||
student_works_evaluation_distributions = StudentWorksEvaluationDistribution.new(user_id: pro_work.user_id, student_work_id: h.id)
|
||||
student_works_evaluation_distributions.save
|
||||
end
|
||||
end
|
||||
else
|
||||
student_works.each_with_index do |work, index|
|
||||
user = work.user
|
||||
n = @homework_detail_manual.evaluation_num
|
||||
n = n < student_works.size ? n : student_works.size - 1
|
||||
assigned_homeworks = get_assigned_homeworks(student_works, n, index)
|
||||
assigned_homeworks.each do |h|
|
||||
student_works_evaluation_distributions = StudentWorksEvaluationDistribution.new(user_id: user.id, student_work_id: h.id)
|
||||
student_works_evaluation_distributions.save
|
||||
end
|
||||
end
|
||||
end
|
||||
@homework_detail_manual.update_column('comment_status', 2)
|
||||
|
@ -143,7 +162,8 @@ class HomeworkCommonController < ApplicationController
|
|||
Mailer.send_mail_anonymous_comment_open(@homework).deliver
|
||||
else
|
||||
@statue = 2
|
||||
end
|
||||
|
||||
end
|
||||
else
|
||||
@statue = 3
|
||||
end
|
||||
|
@ -277,6 +297,7 @@ class HomeworkCommonController < ApplicationController
|
|||
@homework = HomeworkCommon.find params[:id]
|
||||
@homework_detail_manual = @homework.homework_detail_manual
|
||||
@homework_detail_programing = @homework.homework_detail_programing
|
||||
@homework_detail_group = @homework.homework_detail_group
|
||||
@course = @homework.course
|
||||
rescue
|
||||
render_404
|
||||
|
|
|
@ -3,7 +3,7 @@ class StudentWorkController < ApplicationController
|
|||
include StudentWorkHelper
|
||||
require 'bigdecimal'
|
||||
require "base64"
|
||||
before_filter :find_homework, :only => [:new, :index, :create, :student_work_absence_penalty, :absence_penalty_list, :evaluation_list, :program_test,:set_score_rule,:forbidden_anonymous_comment,:delete_work,:new_student_work_project,:student_work_project,:cancel_relate_project]
|
||||
before_filter :find_homework, :only => [:new, :index, :create, :student_work_absence_penalty, :absence_penalty_list, :evaluation_list, :program_test,:set_score_rule,:forbidden_anonymous_comment,:delete_work,:new_student_work_project,:student_work_project,:cancel_relate_project,:search_course_students]
|
||||
before_filter :find_work, :only => [:edit, :update, :show, :destroy, :add_score, :praise_student_work,:retry_work,:revise_attachment]
|
||||
before_filter :member_of_course, :only => [:index, :new, :create, :show, :add_score, :praise_student_work]
|
||||
before_filter :author_of_work, :only => [:edit, :update, :destroy]
|
||||
|
@ -95,12 +95,27 @@ class StudentWorkController < ApplicationController
|
|||
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").joins(:user).where("users.id in #{student_in_group}").order("#{@order} #{@b_sort}"),@name
|
||||
@show_all = true
|
||||
elsif @homework.homework_detail_manual.comment_status == 1 #学生 && 未开启匿评 只看到自己的
|
||||
@stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id)
|
||||
if @homework.homework_type == 3
|
||||
pro = @homework.student_work_projects.where(:user_id => User.current.id).first
|
||||
@stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:id => pro.student_work_id)
|
||||
else
|
||||
@stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id)
|
||||
end
|
||||
elsif @homework.homework_detail_manual.comment_status == 2 #学生 && 开启匿评 看到匿评列表
|
||||
my_work = @homework.student_works.where(:user_id => User.current.id)
|
||||
if @homework.homework_type == 3
|
||||
pro = @homework.student_work_projects.where(:user_id => User.current.id).first
|
||||
my_work = @homework.student_works.where(:id => pro.student_work_id)
|
||||
else
|
||||
my_work = @homework.student_works.where(:user_id => User.current.id)
|
||||
end
|
||||
@stundet_works = my_work + User.current.student_works_evaluation_distributions.map(&:student_work).select { |work| work.homework_common_id == @homework.id}
|
||||
elsif @homework.homework_detail_manual.comment_status == 3 #学生 && 关闭匿评 未提交作品之前列表为空,提交了作品看到所有的
|
||||
my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id)
|
||||
if @homework.homework_type == 3
|
||||
pro = @homework.student_work_projects.where(:user_id => User.current.id).first
|
||||
my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:id => pro.student_work_id)
|
||||
else
|
||||
my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id)
|
||||
end
|
||||
if my_work.empty?
|
||||
@stundet_works = []
|
||||
else
|
||||
|
@ -116,12 +131,27 @@ class StudentWorkController < ApplicationController
|
|||
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").order("#{@order} #{@b_sort}"),@name
|
||||
@show_all = true
|
||||
elsif @homework.homework_detail_manual.comment_status == 1 #学生 && 未开启匿评 只看到自己的
|
||||
@stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id)
|
||||
if @homework.homework_type == 3
|
||||
pro = @homework.student_work_projects.where(:user_id => User.current.id).first
|
||||
@stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:id => pro.student_work_id)
|
||||
else
|
||||
@stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id)
|
||||
end
|
||||
elsif @homework.homework_detail_manual.comment_status == 2 #学生 && 开启匿评 看到匿评列表
|
||||
my_work = @homework.student_works.where(:user_id => User.current.id)
|
||||
if @homework.homework_type == 3
|
||||
pro = @homework.student_work_projects.where(:user_id => User.current.id).first
|
||||
my_work = @homework.student_works.where(:id => pro.student_work_id)
|
||||
else
|
||||
my_work = @homework.student_works.where(:user_id => User.current.id)
|
||||
end
|
||||
@stundet_works = my_work + User.current.student_works_evaluation_distributions.map(&:student_work).select { |work| work.homework_common_id == @homework.id}
|
||||
elsif @homework.homework_detail_manual.comment_status == 3 #学生 && 关闭匿评 未提交作品之前列表为空,提交了作品看到所有的
|
||||
my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id)
|
||||
if @homework.homework_type == 3
|
||||
pro = @homework.student_work_projects.where(:user_id => User.current.id).first
|
||||
my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:id => pro.student_work_id)
|
||||
else
|
||||
my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id)
|
||||
end
|
||||
if my_work.empty?
|
||||
@stundet_works = []
|
||||
else
|
||||
|
@ -190,6 +220,10 @@ class StudentWorkController < ApplicationController
|
|||
student_work.user_id = User.current.id
|
||||
student_work.save_attachments(params[:attachments])
|
||||
render_attachment_warning_if_needed(student_work)
|
||||
if @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1
|
||||
@student_work_project = @homework.student_work_projects.where("user_id = #{User.current.id}").first
|
||||
student_work.project_id = @student_work_project.project_id
|
||||
end
|
||||
#提交作品时,计算是否迟交
|
||||
if Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(Time.now.to_s).strftime("%Y-%m-%d")
|
||||
student_work.late_penalty = @homework.late_penalty
|
||||
|
@ -197,6 +231,35 @@ class StudentWorkController < ApplicationController
|
|||
student_work.late_penalty = 0
|
||||
end
|
||||
if student_work.save
|
||||
if @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1
|
||||
@student_work_project.student_work_id = student_work.id
|
||||
@student_work_project.save
|
||||
members = params[:group_member_ids].split(',')
|
||||
for i in 1 .. members.count-1
|
||||
stu_project = StudentWorkProject.new
|
||||
stu_project.homework_common_id = @homework.id
|
||||
stu_project.student_work_id = student_work.id
|
||||
stu_project.project_id = @student_work_project.project_id
|
||||
stu_project.user_id = members[i].to_i
|
||||
stu_project.is_leader = 0
|
||||
stu_project.save
|
||||
end
|
||||
elsif @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 0
|
||||
members = params[:group_member_ids].split(',')
|
||||
for i in 0 .. members.count-1
|
||||
stu_project = StudentWorkProject.new
|
||||
stu_project.homework_common_id = @homework.id
|
||||
stu_project.student_work_id = student_work.id
|
||||
stu_project.project_id = -1
|
||||
stu_project.user_id = members[i].to_i
|
||||
if i == 0
|
||||
stu_project.is_leader = 1
|
||||
else
|
||||
stu_project.is_leader = 0
|
||||
end
|
||||
stu_project.save
|
||||
end
|
||||
end
|
||||
course_activity = CourseActivity.where("course_act_type='HomeworkCommon' and course_act_id =#{@homework.id}").first
|
||||
if course_activity
|
||||
course_activity.updated_at = Time.now
|
||||
|
@ -276,6 +339,18 @@ class StudentWorkController < ApplicationController
|
|||
|
||||
def destroy
|
||||
if @work.destroy
|
||||
if @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1
|
||||
pros = @work.student_work_projects.where("is_leader = 0")
|
||||
pros.each do |pro|
|
||||
pro.destroy
|
||||
end
|
||||
project = @work.student_work_projects.where("is_leader = 1").first
|
||||
project.update_attributes(:student_work_id => nil)
|
||||
elsif @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 0
|
||||
@work.student_work_projects.each do |pro2|
|
||||
pro2.destroy
|
||||
end
|
||||
end
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
redirect_to student_work_index_url(:homework => @homework.id)
|
||||
|
@ -288,12 +363,36 @@ class StudentWorkController < ApplicationController
|
|||
@work = StudentWork.where("user_id =? and homework_common_id =?", User.current.id, @homework.id).first
|
||||
if @work
|
||||
@work.destroy
|
||||
if @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1
|
||||
pros = @work.student_work_projects.where("is_leader = 0")
|
||||
pros.each do |pro|
|
||||
pro.destroy
|
||||
end
|
||||
project = @work.student_work_projects.where("is_leader = 1").first
|
||||
project.update_attributes(:student_work_id => nil)
|
||||
elsif @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 0
|
||||
@work.student_work_projects.each do |pro2|
|
||||
pro2.destroy
|
||||
end
|
||||
end
|
||||
end
|
||||
redirect_to user_homeworks_user_path(User.current.id)
|
||||
end
|
||||
|
||||
def retry_work
|
||||
if @work.destroy
|
||||
if @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1
|
||||
pros = @work.student_work_projects.where("is_leader = 0")
|
||||
pros.each do |pro|
|
||||
pro.destroy
|
||||
end
|
||||
project = @work.student_work_projects.where("is_leader = 1").first
|
||||
project.update_attributes(:student_work_id => nil)
|
||||
elsif @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 0
|
||||
@work.student_work_projects.each do |pro2|
|
||||
pro2.destroy
|
||||
end
|
||||
end
|
||||
@student_work = StudentWork.new
|
||||
respond_to do |format|
|
||||
format.js
|
||||
|
@ -555,6 +654,7 @@ class StudentWorkController < ApplicationController
|
|||
@project.homework_common_id = @homework.id
|
||||
@project.project_id = (Project.find params[:projectName].to_i).id
|
||||
@project.user_id = User.current.id
|
||||
@project.is_leader = 1
|
||||
if @project.save
|
||||
@user_activity_id = params[:user_activity_id].to_i
|
||||
@is_in_course = params[:is_in_course].to_i
|
||||
|
@ -579,6 +679,20 @@ class StudentWorkController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
#查找课程的学生
|
||||
def search_course_students
|
||||
name = ""
|
||||
unless params[:name].nil?
|
||||
name = params[:name]
|
||||
end
|
||||
all_student_ids = "(" + @homework.course.student.map{|student| student.student_id}.join(",") + ")"
|
||||
all_students = User.where("id in #{all_student_ids}")
|
||||
@users = searchstudent_by_name all_students,name
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def cancel_relate_project
|
||||
relate_pro = StudentWorkProject.where("user_id = #{User.current.id} and homework_common_id = #{@homework.id}").first
|
||||
if relate_pro.destroy
|
||||
|
@ -592,6 +706,22 @@ class StudentWorkController < ApplicationController
|
|||
end
|
||||
|
||||
private
|
||||
def searchstudent_by_name users, name
|
||||
mems = []
|
||||
if name != ""
|
||||
name = name.to_s.downcase
|
||||
users.each do |m|
|
||||
username = m.lastname.to_s.downcase + m.firstname.to_s.downcase
|
||||
if(m.login.to_s.downcase.include?(name) || m.user_extensions[:student_id].to_s.downcase.include?(name) || username.include?(name))
|
||||
mems << m
|
||||
end
|
||||
end
|
||||
else
|
||||
mems = users
|
||||
end
|
||||
mems
|
||||
end
|
||||
|
||||
def hsd_committed_work?(user, homework)
|
||||
sw = StudentWork.where("user_id =? and homework_common_id =?", user, homework).first
|
||||
sw.nil? ? result = false : result = true
|
||||
|
|
|
@ -2435,10 +2435,19 @@ module ApplicationHelper
|
|||
link_to "作品(#{homework.student_works.count})",student_work_index_path(:homework => homework.id),:class => "c_blue"
|
||||
else #学生显示提交作品、修改作品等按钮
|
||||
work = cur_user_works_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")
|
||||
link_to "提交作品(#{homework.student_works.count})", new_student_work_path(:homework => homework.id),:class => 'c_blue'
|
||||
if homework.homework_type ==3 && project.nil? && homework.homework_detail_group.base_on_project == 1
|
||||
link_to "提交作品(#{homework.student_works.count})","javascript:void(0)", :class => 'c_grey',:style=>"cursor:not-allowed",:title => '请先关联项目再提交作品'
|
||||
else
|
||||
link_to "提交作品(#{homework.student_works.count})", new_student_work_path(:homework => homework.id),:class => 'c_blue'
|
||||
end
|
||||
elsif work.nil? && Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") < Time.now.strftime("%Y-%m-%d")
|
||||
link_to "补交作品(#{homework.student_works.count})", new_student_work_path(:homework => homework.id),:class => 'c_red'
|
||||
if homework.homework_type ==3 && project.nil? && homework.homework_detail_group.base_on_project == 1
|
||||
link_to "补交作品(#{homework.student_works.count})","javascript:void(0)", :class => 'c_grey',:style=>"cursor:not-allowed",:title => '请先关联项目再补交作品'
|
||||
else
|
||||
link_to "补交作品(#{homework.student_works.count})", new_student_work_path(:homework => homework.id),:class => 'c_red'
|
||||
end
|
||||
else
|
||||
if homework.homework_detail_manual && homework.homework_detail_manual.comment_status == 2 #匿评作业,且作业状态不是在开启匿评之前
|
||||
link_to "作品匿评", student_work_index_path(:homework => homework.id), :class => 'c_blue', :title => "开启匿评后不可修改作品"
|
||||
|
@ -2462,7 +2471,7 @@ module ApplicationHelper
|
|||
def relate_project homework,is_teacher,is_in_course,user_activity_id,course_activity
|
||||
if User.current.member_of_course?(homework.course)
|
||||
if is_teacher
|
||||
link_to "已关联(#{homework.student_work_projects.count})",student_work_index_path(:homework => homework.id),:class => "c_blue"
|
||||
#link_to "已关联(#{homework.student_work_projects.count})",student_work_index_path(:homework => homework.id),:class => "c_blue"
|
||||
else
|
||||
projects = cur_user_projects_for_homework homework
|
||||
works = cur_user_works_for_homework homework
|
||||
|
@ -2471,7 +2480,7 @@ module ApplicationHelper
|
|||
elsif works.nil?
|
||||
link_to "取消关联",cancel_relate_project_student_work_index_path(:homework => homework.id,:is_in_course=>is_in_course,:user_activity_id=>user_activity_id,:course_activity=>course_activity), :confirm => "您确定要取消关联吗?", remote: true,:class => "c_blue", :title=> '取消关联项目'
|
||||
else
|
||||
link_to "已关联(#{homework.student_work_projects.count})",student_work_index_path(:homework => homework.id),:class => "c_blue"
|
||||
#link_to "已关联(#{homework.student_work_projects.count})",student_work_index_path(:homework => homework.id),:class => "c_blue"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -2492,7 +2501,16 @@ module ApplicationHelper
|
|||
|
||||
#获取当前用户在指定作业下提交的作业的集合
|
||||
def cur_user_works_for_homework homework
|
||||
homework.student_works.where("user_id = ?",User.current).first
|
||||
work = homework.student_works.where("user_id = ?",User.current).first
|
||||
if homework.homework_type == 3
|
||||
pro = homework.student_work_projects.where("user_id = #{User.current.id}").first
|
||||
if pro.nil? || pro.student_work_id == "" || pro.student_work_id.nil?
|
||||
work = nil
|
||||
else
|
||||
work = StudentWork.find pro.student_work_id
|
||||
end
|
||||
end
|
||||
work
|
||||
end
|
||||
#获取当前用户在指定作业下关联的项目的集合
|
||||
def cur_user_projects_for_homework homework
|
||||
|
|
|
@ -10,7 +10,7 @@ class HomeworkCommon < ActiveRecord::Base
|
|||
has_one :homework_detail_manual, :dependent => :destroy
|
||||
has_one :homework_detail_programing, :dependent => :destroy
|
||||
has_one :homework_detail_group, :dependent => :destroy
|
||||
has_many :student_work_projects
|
||||
has_many :student_work_projects, :dependent => :destroy
|
||||
has_many :homework_tests, :dependent => :destroy
|
||||
has_many :student_works, :dependent => :destroy, :conditions => "is_test=0"
|
||||
has_many :student_works_evaluation_distributions, :through => :student_works #一个作业的分配的匿评列表
|
||||
|
|
|
@ -43,7 +43,7 @@ class Project < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
|
||||
has_many :student_work_projects
|
||||
has_many :student_work_projects,:dependent => :destroy
|
||||
has_many :student_works
|
||||
has_many :time_entry_activities
|
||||
has_many :members, :include => [:principal, :roles], :conditions => "#{Principal.table_name}.type='User' AND #{Principal.table_name}.status=#{Principal::STATUS_ACTIVE}"
|
||||
|
|
|
@ -4,7 +4,7 @@ class StudentWork < ActiveRecord::Base
|
|||
|
||||
belongs_to :homework_common
|
||||
belongs_to :user
|
||||
has_one :student_work_project
|
||||
has_many :student_work_projects
|
||||
has_many :student_works_evaluation_distributions, :dependent => :destroy
|
||||
has_many :student_works_scores, :dependent => :destroy
|
||||
belongs_to :project
|
||||
|
|
|
@ -107,7 +107,7 @@ class User < Principal
|
|||
has_many :student_works, :dependent => :destroy
|
||||
has_many :student_works_evaluation_distributions, :dependent => :destroy
|
||||
has_many :student_works_scores, :dependent => :destroy
|
||||
has_many :student_work_projects
|
||||
has_many :student_work_projects, :dependent => :destroy
|
||||
#end
|
||||
|
||||
has_and_belongs_to_many :groups, :after_add => Proc.new {|user, group| group.user_added(user)},
|
||||
|
|
|
@ -9,36 +9,88 @@
|
|||
<input type="text" name="serach" placeholder="输入关键字搜索" class="searchResourcePopup" />
|
||||
</form>
|
||||
</div>
|
||||
<ul class="addMemberC fl">
|
||||
<li>
|
||||
同学一(061530301)
|
||||
</li>
|
||||
<li>
|
||||
同学二同学二(061530302)
|
||||
</li>
|
||||
<li>
|
||||
同学三(061530303)
|
||||
</li>
|
||||
<li>
|
||||
同学四同学四(061530304)
|
||||
</li>
|
||||
<li>
|
||||
同学五同学五(061530305)
|
||||
</li>
|
||||
<li>
|
||||
同学六同学六(061530306)
|
||||
</li>
|
||||
<li>
|
||||
同学七同学七(061530307)
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="addMemberC fl" id="all_students_list"></ul>
|
||||
<div class="rightArrow"><img src="/images/course/right-arrow.png" width="16" height="30" /></div>
|
||||
<ul class="addMemberC fr">
|
||||
<li>TimTang(040930319)<span class="fr mr10">×</span></li>
|
||||
<li>suntao(060930106)<span class="fr mr10">×</span></li>
|
||||
<ul class="addMemberC fr" id="choose_students_list">
|
||||
<li id="choose_student_<%=User.current.id %>"><%=User.current.show_name %>
|
||||
<% unless User.current.user_extensions.student_id == "" %>
|
||||
(<%=User.current.user_extensions.student_id %>)
|
||||
<% end %>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="cl"></div>
|
||||
<div class="courseSendCancel mr15" style="float:right;"><a href="javascript:void(0);" class="sendSourceText" onclick="clickCanel();">取消</a></div>
|
||||
<div class="courseSendSubmit" style="float:right;"><a href="javascript:void(0);" class="sendSourceText">确定</a></div>
|
||||
<div class="courseSendSubmit" style="float:right;"><a href="javascript:void(0);" class="sendSourceText" onclick="clickOK()">确定</a></div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
var lastSearchCondition = '';
|
||||
var count = 0;
|
||||
function search_stus(e){
|
||||
if($(e.target).val().trim() == lastSearchCondition && lastSearchCondition != '')
|
||||
{
|
||||
return;
|
||||
}
|
||||
lastSearchCondition = $(e.target).val().trim();
|
||||
$.ajax({
|
||||
url: '<%= url_for(:controller => 'student_work', :action => 'search_course_students') %>'+'?name='+ e.target.value+'&homework='+<%=@homework.id %>,
|
||||
type:'get'
|
||||
});
|
||||
}
|
||||
|
||||
function throttle(method,context,e){
|
||||
clearTimeout(method.tId);
|
||||
method.tId=setTimeout(function(){
|
||||
method.call(context,e);
|
||||
},500);
|
||||
}
|
||||
|
||||
//查询
|
||||
$("input[name='serach']").on('input', function (e) {
|
||||
throttle(search_stus,window,e);
|
||||
});
|
||||
|
||||
function clickOK() {
|
||||
var str="";
|
||||
var show = "合作成员:";
|
||||
var lists = $("#choose_students_list li");
|
||||
if(lists.length > 0) {
|
||||
for(var i=0; i<lists.length; i++) {
|
||||
var id = $(lists[i]).attr("id").replace(/[^0-9]/ig,"");
|
||||
str += id;
|
||||
var show_name = $(lists[i]).html();
|
||||
var index = show_name.indexOf("(");
|
||||
if (index != -1) {
|
||||
var name = show_name.substring(0,show_name.indexOf("("));
|
||||
} else {
|
||||
var name = show_name;
|
||||
}
|
||||
show += name;
|
||||
if (i == 0) {
|
||||
show += "(组长)";
|
||||
}
|
||||
if (i != lists.length -1) {
|
||||
str += ",";
|
||||
show += "、";
|
||||
}
|
||||
}
|
||||
$("#group_member_ids").val(str);
|
||||
}
|
||||
hideModal("#popbox02");
|
||||
$("#group_members_show").show().html(show);
|
||||
}
|
||||
|
||||
function delete_student(id) {
|
||||
$("#choose_student_"+id).remove();
|
||||
$("#student_"+id).one("click",function choose_student() {
|
||||
$("#choose_students_list").append("<li id='choose_student_"+id+"' onclick='delete_student("+id+");'>"+$("#student_"+id).html()+"</li>");
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function(){
|
||||
$.ajax({
|
||||
url: '<%= url_for(:controller => 'student_work', :action => 'search_course_students') %>'+'?homework='+<%=@homework.id %>,
|
||||
type:'get'
|
||||
});
|
||||
});
|
||||
</script>
|
|
@ -1,8 +1,12 @@
|
|||
<ul class="hworkUl">
|
||||
<li class="hworkList340 hworkH30 width505">
|
||||
<span class="HomeworkNameTitle f14 fb fl">作品名称</span>
|
||||
<span class="HomeworkStuTitle f14 fb fl">姓名</span>
|
||||
<span class="HomeworkStuTitle f14 fb fl">学号</span>
|
||||
<% if @homework.homework_type != 3 %>
|
||||
<span class="HomeworkStuTitle f14 fb fl">姓名</span>
|
||||
<span class="HomeworkStuTitle f14 fb fl">学号</span>
|
||||
<% elsif @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1 %>
|
||||
<span class="HomeworkStuTitle f14 fb fl">关联项目</span>
|
||||
<% end %>
|
||||
</li>
|
||||
|
||||
<li class="hworkList130 hworkH30 fb ml10">
|
||||
|
|
|
@ -1,8 +1,12 @@
|
|||
<ul class="hworkUl">
|
||||
<li class="hworkList340 hworkH30 <%= @homework.homework_type == 2 ? '' : 'width385'%>">
|
||||
<span class="c_dark f14 fb fl <%= @homework.homework_type == 2 ? 'mr90 ml50' : 'mr140 ml50'%>">作品名称</span>
|
||||
<span class="c_dark f14 fb fl mr50">姓名</span>
|
||||
<span class="c_dark f14 fb fl">学号</span>
|
||||
<% if @homework.homework_type != 3 %>
|
||||
<span class="c_dark f14 fb fl mr50">姓名</span>
|
||||
<span class="c_dark f14 fb fl">学号</span>
|
||||
<% elsif @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1 %>
|
||||
<span class="c_dark f14 fb fl">关联项目</span>
|
||||
<% end %>
|
||||
</li>
|
||||
|
||||
<li class="hworkList130 hworkH30">
|
||||
|
|
|
@ -13,14 +13,22 @@
|
|||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<ul class="mt10 fl">
|
||||
<li class="hworkStName mr10 mt16" title="姓名">
|
||||
<%= student_work.user.show_name%>
|
||||
</li>
|
||||
<li class="hworkStID mt16" title="学号">
|
||||
<%= student_work.user.user_extensions.nil? ? "--" : student_work.user.user_extensions.student_id%>
|
||||
</li>
|
||||
</ul>
|
||||
<% if @homework.homework_type != 3 %>
|
||||
<ul class="mt10 fl">
|
||||
<li class="hworkStName mr10 mt16" title="姓名">
|
||||
<%= student_work.user.show_name%>
|
||||
</li>
|
||||
<li class="hworkStID mt16" title="学号">
|
||||
<%= student_work.user.user_extensions.nil? ? "--" : student_work.user.user_extensions.student_id%>
|
||||
</li>
|
||||
</ul>
|
||||
<% elsif @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1 %>
|
||||
<ul class="mt10 fl">
|
||||
<li class="hworkPrName mr10 mt12" title="项目名称">
|
||||
<%= student_work.project.name %>
|
||||
</li>
|
||||
</ul>
|
||||
<% end %>
|
||||
</li>
|
||||
</div>
|
||||
</ul>
|
||||
|
|
|
@ -1,6 +1,11 @@
|
|||
<!-- 匿评作品列表,显示某一个作品的信息 -->
|
||||
<ul class="hworkListRow" id="student_work_<%= student_work.id%>">
|
||||
<% is_my_work = student_work.user == User.current%>
|
||||
<% if @homework.homework_type != 3 %>
|
||||
<% is_my_work = student_work.user == User.current%>
|
||||
<% else %>
|
||||
<% pro = @homework.student_work_projects.where(:user_id => User.current.id).first %>
|
||||
<% is_my_work = pro && pro.student_work_id == student_work.id%>
|
||||
<% end %>
|
||||
<li class="hworkList340 width525">
|
||||
<ul>
|
||||
<% if is_my_work%>
|
||||
|
@ -14,14 +19,22 @@
|
|||
</div>
|
||||
</li>
|
||||
<li onclick="show_student_work('<%= student_work_path(student_work)%>');" style="cursor: pointer;" class="student_work_<%= student_work.id%>">
|
||||
<ul class="mt10 fl">
|
||||
<li class="hworkStName mr10 mt16" title="姓名">
|
||||
<%= student_work.user.show_name%>
|
||||
</li>
|
||||
<li class="hworkStID mt16" title="学号">
|
||||
<%= student_work.user.user_extensions.nil? ? "--" : student_work.user.user_extensions.student_id%>
|
||||
</li>
|
||||
</ul>
|
||||
<% if @homework.homework_type != 3 %>
|
||||
<ul class="mt10 fl">
|
||||
<li class="hworkStName mr10 mt16" title="姓名">
|
||||
<%= student_work.user.show_name%>
|
||||
</li>
|
||||
<li class="hworkStID mt16" title="学号">
|
||||
<%= student_work.user.user_extensions.nil? ? "--" : student_work.user.user_extensions.student_id%>
|
||||
</li>
|
||||
</ul>
|
||||
<% elsif @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1 %>
|
||||
<ul class="mt10 fl">
|
||||
<li class="hworkPrName mr10 mt12" title="项目名称">
|
||||
<%= student_work.project.name %>
|
||||
</li>
|
||||
</ul>
|
||||
<% end %>
|
||||
</li>
|
||||
<% else%>
|
||||
<li class="hworkPortrait mt15 mr10">
|
||||
|
@ -33,14 +46,22 @@
|
|||
</div>
|
||||
</li>
|
||||
<li onclick="show_student_work('<%= student_work_path(student_work)%>');" style="cursor: pointer;" class="student_work_<%= student_work.id%>">
|
||||
<ul class="mt10 fl">
|
||||
<li class="hworkStName mr10 mt16" title="姓名">
|
||||
匿名
|
||||
</li>
|
||||
<li class="hworkStID mt16" title="学号">
|
||||
--
|
||||
</li>
|
||||
</ul>
|
||||
<% if @homework.homework_type != 3 %>
|
||||
<ul class="mt10 fl">
|
||||
<li class="hworkStName mr10 mt16" title="姓名">
|
||||
匿名
|
||||
</li>
|
||||
<li class="hworkStID mt16" title="学号">
|
||||
--
|
||||
</li>
|
||||
</ul>
|
||||
<% elsif @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1 %>
|
||||
<ul class="mt10 fl">
|
||||
<li class="hworkPrName mr10 mt12" title="项目名称">
|
||||
匿名
|
||||
</li>
|
||||
</ul>
|
||||
<% end %>
|
||||
</li>
|
||||
<% end%>
|
||||
|
||||
|
|
|
@ -7,28 +7,6 @@
|
|||
<p id="no_search_result" class="c_red" style="width:220px;display: none">您当前尚未参与任何项目,请先加入项目再关联。</p>
|
||||
<ul id="search_project_list" class="maxHeight100"></ul>
|
||||
<p id="notes" class="c_red"></p>
|
||||
<!--<ul class="mb10 maxHeight100">
|
||||
<li>
|
||||
<label>
|
||||
<input name="checkMenu" type="radio" class="courseSendCheckbox"/>
|
||||
<span class="sendCourseName">项目一</span></label>
|
||||
</li>
|
||||
<li>
|
||||
<label>
|
||||
<input name="checkMenu" type="radio" class="courseSendCheckbox"/>
|
||||
<span class="sendCourseName">项目二项目二项目二</span></label>
|
||||
</li>
|
||||
<li>
|
||||
<label>
|
||||
<input name="checkMenu" type="radio" class="courseSendCheckbox"/>
|
||||
<span class="sendCourseName">项目三项目三</span></label>
|
||||
</li>
|
||||
<li>
|
||||
<label>
|
||||
<input name="checkMenu" type="radio" class="courseSendCheckbox"/>
|
||||
<span class="sendCourseName">项目四</span></label>
|
||||
</li>
|
||||
</ul>-->
|
||||
<div class="courseSendSubmit mt10"><a href="javascript:void(0);" class="sendSourceText" onclick="clickOK();">确定</a></div>
|
||||
<div class="courseSendCancel mt10"><a href="javascript:void(0);" class="sendSourceText" onclick="clickCanel();">取消</a></div>
|
||||
<div class="cl"></div>
|
||||
|
@ -56,7 +34,7 @@
|
|||
},500);
|
||||
}
|
||||
|
||||
//查询组织
|
||||
//查询项目
|
||||
$("input[name='project']").on('input', function (e) {
|
||||
throttle(search_pros,window,e);
|
||||
});
|
||||
|
|
|
@ -1,5 +1,12 @@
|
|||
<div class="show_hwork_arrow"></div>
|
||||
<div class="showHwork">
|
||||
<% is_teacher = User.current.allowed_to?(:as_teacher, @homework.course) || User.current.admin? %>
|
||||
<% if @homework.homework_type != 3 %>
|
||||
<% is_my_work = work.user == User.current%>
|
||||
<% else %>
|
||||
<% pro = @homework.student_work_projects.where(:user_id => User.current.id).first %>
|
||||
<% is_my_work = pro && pro.student_work_id == work.id%>
|
||||
<% end %>
|
||||
<ul>
|
||||
<li class="fl" >
|
||||
<span class="tit_fb">上交时间:</span>
|
||||
|
@ -15,7 +22,7 @@
|
|||
<%= link_to "",edit_student_work_path(work),:class => "pic_edit",:title => "修改"%>
|
||||
</li>
|
||||
<% end%>
|
||||
<% if @homework.homework_detail_manual.comment_status == 3 && work.user != User.current%>
|
||||
<% if @homework.homework_detail_manual.comment_status == 3 && !is_my_work %>
|
||||
<!-- 匿评结束阶段,显示点赞按钮 -->
|
||||
<li class="fr" id="student_work_praise_<%= work.id%>">
|
||||
<%= render :partial => 'student_work_praise' %>
|
||||
|
@ -25,11 +32,24 @@
|
|||
|
||||
<!--<li ><span class="tit_fb"> 参与人员:</span>程梦雯 王强</li>-->
|
||||
|
||||
<% if work.project%>
|
||||
<li >
|
||||
<span class="tit_fb"> 关联项目:</span>
|
||||
<%= link_to( work.project.name, project_path(work.project.id), :class => "linkBlue" )%>
|
||||
<% if @homework.homework_type == 3 && work.student_work_projects && (@homework.homework_detail_manual.comment_status != 2 || is_my_work || is_teacher ) %>
|
||||
<div class="cl"></div>
|
||||
<li>
|
||||
<span class="tit_fb"> 参与人员:</span>
|
||||
<%= link_to(work.user.show_name+"(组长)", user_path(work.user.id), :class => "linkBlue" )%>
|
||||
<% members = work.student_work_projects.where("is_leader = 0") %>
|
||||
<% members.each do |member| if !members.empty? %>
|
||||
、<%=link_to((User.find member.user_id).show_name, user_path(member.user.id), :class => "linkBlue" ) %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</li>
|
||||
<% if @homework.homework_detail_group.base_on_project == 1 %>
|
||||
<li>
|
||||
<span class="tit_fb"> 关联项目:</span>
|
||||
<%= link_to( work.project.name, project_path(work.project.id), :class => "linkBlue" )%>
|
||||
<span class="ml5">(综合评分:<font class="c_red"><%=work.project.project_score.score.to_i %></font>)</span>
|
||||
</li>
|
||||
<% end %>
|
||||
<% end%>
|
||||
|
||||
<li >
|
||||
|
@ -52,7 +72,7 @@
|
|||
<div class="cl"></div>
|
||||
</li>
|
||||
<li >
|
||||
<% if @is_teacher || (@homework.homework_detail_manual.comment_status == 2 && work.user != User.current)%>
|
||||
<% if @is_teacher || (@homework.homework_detail_manual.comment_status == 2 && !is_my_work)%>
|
||||
<!-- 老师 || 开启匿评状态 && 不是当前用户自己的作品 -->
|
||||
<div id="add_student_score_<%= work.id%>" class="mt10 evaluation">
|
||||
<%= render :partial => 'add_score',:locals => {:work => work,:score => score}%>
|
||||
|
|
|
@ -40,12 +40,17 @@
|
|||
<% end%>
|
||||
<div class="cl"></div>
|
||||
<div id="about_hwork_<%= student_work.id%>">
|
||||
<% if student_work.user == User.current && !@is_evaluation %>
|
||||
<% if @homework.homework_type != 3 && student_work.user == User.current && !@is_evaluation %>
|
||||
<% if @homework.homework_type == 2%>
|
||||
<%=render :partial => 'programing_work_show', :locals=> {:work => student_work, :score =>student_work_score(student_work,User.current),:student_work_scores => student_work.student_works_scores.order("updated_at desc")} %>
|
||||
<% else %>
|
||||
<%=render :partial => 'show' , :locals=> {:work => student_work, :score =>student_work_score(student_work,User.current),:student_work_scores => student_work.student_works_scores.order("updated_at desc")} %>
|
||||
<% end %>
|
||||
<% elsif @homework.homework_type == 3 %>
|
||||
<% pro = @homework.student_work_projects.where(:user_id => User.current.id).first %>
|
||||
<% if pro && pro.student_work_id == student_work.id && !@is_evaluation %>
|
||||
<%=render :partial => 'show' , :locals=> {:work => student_work, :score =>student_work_score(student_work,User.current),:student_work_scores => student_work.student_works_scores.order("updated_at desc")} %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
|
|
@ -54,11 +54,21 @@
|
|||
function popupRegex(){
|
||||
if(regexStudentWorkName()&®exStudentWorkDescription())
|
||||
{
|
||||
$('#ajax-modal').html("<div><p align='center' style='margin-top: 35px'>作品信息完整性校验中,请稍等...</p></div>");
|
||||
showModal('ajax-modal', '500px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').parent().css("top","").css("left","");
|
||||
$('#ajax-modal').parent().addClass("anonymos");
|
||||
if($("#group_member_ids").length > 0) {
|
||||
if(regexStudentWorkMember(parseInt($.trim($("#min_num_member").html())),parseInt($.trim($("#max_num_member").html())))) {
|
||||
$('#ajax-modal').html("<div><p align='center' style='margin-top: 35px'>作品信息完整性校验中,请稍等...</p></div>");
|
||||
showModal('ajax-modal', '500px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').parent().css("top","").css("left","");
|
||||
$('#ajax-modal').parent().addClass("anonymos");
|
||||
}
|
||||
} else {
|
||||
$('#ajax-modal').html("<div><p align='center' style='margin-top: 35px'>作品信息完整性校验中,请稍等...</p></div>");
|
||||
showModal('ajax-modal', '500px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').parent().css("top","").css("left","");
|
||||
$('#ajax-modal').parent().addClass("anonymos");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -106,7 +116,11 @@
|
|||
提示:作品名称和描述中不要出现真实的姓名信息
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
||||
<% if @homework.homework_type == 3 %>
|
||||
<span id="min_num_member" style="display: none"><%=@homework.homework_detail_group.min_num %></span>
|
||||
<span id="max_num_member" style="display: none"><%=@homework.homework_detail_group.max_num %></span>
|
||||
<%=hidden_field_tag 'group_member_ids', params[:group_member_ids], :value=>User.current.id %>
|
||||
<% end %>
|
||||
<div>
|
||||
<%= f.text_field "name", :required => true, :size => 60, :class => "InputBox W700", :maxlength => 200, :placeholder => "请简洁的概括作品的功能或特性", :onkeyup => "regexStudentWorkName();" %>
|
||||
<div class="cl"></div>
|
||||
|
@ -125,12 +139,16 @@
|
|||
<div id="homework_attachments">
|
||||
<%= render :partial => 'users/user_homework_attachment', :locals => {:container => @student_work, :has_program=>false,:has_group=>false} %>
|
||||
</div>
|
||||
<div id="group_member">
|
||||
</div>
|
||||
<div id="relate_project">
|
||||
</div>
|
||||
|
||||
<%# if @homework.homework_type == 3 %>
|
||||
<!--<div class="mt5 fl">
|
||||
<% if @homework.homework_type == 3 %>
|
||||
<div class="mt5 fl">
|
||||
<a href="javascript:void(0);" class="memberBtn fl mt3 mr15" title="请添加小组的其他成员" onclick="show_group_member();">合作成员</a>
|
||||
</div>-->
|
||||
<%# end %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<!--<div class="mt5 fl">
|
||||
<a href="javascript:void(0);" class="RalationIcon fl mt3" title="请选择作业的关联项目" onclick="show_project();">关联项目</a>
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
$("#all_students_list").empty();
|
||||
<% @users.each do |user|%>
|
||||
var link = "<li id='student_<%=user.id %>'><%=user.show_name %>";
|
||||
<% unless user.user_extensions.student_id == "" %>
|
||||
link += "(<%=user.user_extensions.student_id %>)";
|
||||
<% end %>
|
||||
link += "</li>";
|
||||
$("#all_students_list").append(link);
|
||||
|
||||
var str = "";
|
||||
var lists = $("#choose_students_list li");
|
||||
if(lists.length > 0) {
|
||||
for(var i=0; i<lists.length; i++) {
|
||||
var id = $(lists[i]).attr("id").replace(/[^0-9]/ig,"");
|
||||
str += id;
|
||||
if (i != lists.length -1) {
|
||||
str += ",";
|
||||
}
|
||||
}
|
||||
}
|
||||
<% if user.id.to_i != User.current.id.to_i %>
|
||||
if (str.indexOf(<%=user.id.to_s %>) < 0) {
|
||||
$("#student_<%=user.id %>").one("click",function choose_student() {
|
||||
var li = "<li id='choose_student_<%=user.id %>'";
|
||||
<% if user.id.to_i != User.current.id.to_i %>
|
||||
li += " onclick='delete_student(<%=user.id %>);'";
|
||||
<% end %>
|
||||
li += ">" + $("#student_<%=user.id %>").html()+"</li>";
|
||||
$("#choose_students_list").append(li);
|
||||
});
|
||||
}
|
||||
<% end %>
|
||||
<% end %>
|
|
@ -45,14 +45,25 @@
|
|||
<% end%>
|
||||
<% end%>
|
||||
<div class="cl"></div>
|
||||
<% if activity.homework_type == 3%>
|
||||
<% if activity.homework_type == 3 && activity.homework_detail_group.base_on_project == 1%>
|
||||
<span class="c_red">系统提示:该作业要求各组长<%=link_to "创建项目", new_project_path(:host=>Setting.host_name),:class=>"c_red",:title=>"新建项目",:style=>"text-decoration:underline;"%>,组成员加入项目,然后由组长关联项目。谢谢配合!</span>
|
||||
<% elsif activity.homework_type == 3 && activity.homework_detail_group.base_on_project == 0%>
|
||||
<span class="c_red">系统提示:该作业要求各组长提交作品,提交作品时请添加组成员。谢谢配合!</span>
|
||||
<% end %>
|
||||
<div class="homepagePostSubmitContainer">
|
||||
<% if activity.homework_type == 3%>
|
||||
<div class="homepagePostSubmit">
|
||||
<%= relate_project(activity,is_teacher,-1,user_activity_id,course_activity) %>
|
||||
</div>
|
||||
<% if activity.homework_type == 3 && !is_teacher && activity.homework_detail_group.base_on_project == 1 %>
|
||||
<% projects = cur_user_projects_for_homework activity %>
|
||||
<% works = cur_user_works_for_homework activity %>
|
||||
<% if works.nil? && projects.nil? %>
|
||||
<div class="homepagePostSubmit">
|
||||
<%=link_to "关联项目",new_student_work_project_student_work_index_path(:homework => activity.id,:is_in_course=>-1,:user_activity_id=>user_activity_id,:course_activity=>course_activity),remote: true,:class=> 'c_blue', :title=> '请选择分组作业关联的项目' %>
|
||||
<%#= relate_project(activity,is_teacher,-1,user_activity_id,course_activity) %>
|
||||
</div>
|
||||
<% elsif works.nil? %>
|
||||
<div class="homepagePostSubmit">
|
||||
<%=link_to "取消关联",cancel_relate_project_student_work_index_path(:homework => activity.id,:is_in_course=>-1,:user_activity_id=>user_activity_id,:course_activity=>course_activity), :confirm => "您确定要取消关联吗?", remote: true,:class => "c_blue", :title=> '取消关联项目' %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<div class="homepagePostSubmit">
|
||||
<% is_teacher = User.current.allowed_to?(:as_teacher,activity.course) %>
|
||||
|
@ -86,14 +97,15 @@
|
|||
<%= render :partial => 'student_work/work_attachments', :locals => {:attachments => activity.attachments} %>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% if activity.homework_type == 3 && !activity.student_work_projects.empty? %>
|
||||
<% if activity.homework_type == 3 && !activity.student_work_projects.empty? && activity.homework_detail_group.base_on_project == 1 %>
|
||||
<div class="mt10">
|
||||
<div class="fl proRelateWrap mr10">
|
||||
<img src="/images/course/proRelated.png" width="25" height="25" class="borderRadius mt7 ml7" title="已关联项目" />
|
||||
<div class="fl mr5 fontGrey3">
|
||||
<!--<img src="/images/course/proRelated.png" width="25" height="25" class="borderRadius mt7 ml7" title="已关联项目" />-->
|
||||
已关联项目:
|
||||
</div>
|
||||
<% activity.student_work_projects.each do |pro| %>
|
||||
<% activity.student_work_projects.where("is_leader = 1").each do |pro| %>
|
||||
<div class="mr10 mb10 fl">
|
||||
<% project = Project.find pro.project_id %>
|
||||
<% project = Project.find pro.project_id || User.current.member_of?(project) || User.current.admin? %>
|
||||
<% if project.is_public || project.user_id == User.current.id %>
|
||||
<%= link_to image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius"),project_path(project.id,:host=>Setting.host_name),:alt =>"项目头像" %>
|
||||
<% else %>
|
||||
|
|
|
@ -43,7 +43,25 @@
|
|||
:lebel_file_uploding => l(:lebel_file_uploding),
|
||||
:delete_all_files => l(:text_are_you_sure_all)
|
||||
} %>
|
||||
<span class="fl fontGrey2 mt3 group_detail_info"></span>
|
||||
<span class="fl fontGrey2 group_detail_info"></span>
|
||||
<div class="cl"></div>
|
||||
<span class="fl fontGrey2" id="group_members"></span>
|
||||
<div class="cl"></div>
|
||||
<% if @homework && @homework.homework_type == 3 %>
|
||||
<sapn class="fl fontGrey2" id="group_members_show">
|
||||
合作成员:<%=User.current.show_name %>(组长)
|
||||
</sapn>
|
||||
<span id="student_work_group_textarea" class="ml10 c_red fl"></span>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
<span class="fl fontGrey2" id="relate_project_show">
|
||||
<% if @homework %>
|
||||
<% unless @homework.student_work_projects.where("user_id = #{User.current.id}").empty? %>
|
||||
<% project = Project.find @homework.student_work_projects.where("user_id = #{User.current.id}").first.project_id %>
|
||||
关联项目:<%=project.name %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</span>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
||||
|
|
|
@ -49,10 +49,19 @@
|
|||
<span class="c_red">系统提示:该作业要求各组长<%=link_to "创建项目", new_project_path(:host=>Setting.host_name),:class=>"c_red",:title=>"新建项目",:style=>"text-decoration:underline;"%>,组成员加入项目,然后由组长关联项目。谢谢配合!</span>
|
||||
<% end %>
|
||||
<div class="homepagePostSubmitContainer">
|
||||
<% if homework_common.homework_type == 3%>
|
||||
<div class="homepagePostSubmit">
|
||||
<%= relate_project(homework_common,is_teacher,is_in_course,-1,-1) %>
|
||||
</div>
|
||||
<% if homework_common.homework_type == 3 && !is_teacher && homework_common.homework_detail_group.base_on_project == 1%>
|
||||
<% projects = cur_user_projects_for_homework homework_common %>
|
||||
<% works = cur_user_works_for_homework homework_common %>
|
||||
<% if works.nil? && projects.nil? %>
|
||||
<div class="homepagePostSubmit">
|
||||
<%=link_to "关联项目",new_student_work_project_student_work_index_path(:homework => homework_common.id,:is_in_course=>is_in_course,:user_activity_id=>-1,:course_activity=>-1),remote: true,:class=> 'c_blue', :title=> '请选择分组作业关联的项目' %>
|
||||
<%#= relate_project(activity,is_teacher,-1,user_activity_id,course_activity) %>
|
||||
</div>
|
||||
<% elsif works.nil? %>
|
||||
<div class="homepagePostSubmit">
|
||||
<%=link_to "取消关联",cancel_relate_project_student_work_index_path(:homework => homework_common.id,:is_in_course=>is_in_course,:user_activity_id=>-1,:course_activity=>-1), :confirm => "您确定要取消关联吗?", remote: true,:class => "c_blue", :title=> '取消关联项目' %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<div class="homepagePostSubmit">
|
||||
<%= user_for_homework_common homework_common,is_teacher %>
|
||||
|
@ -90,15 +99,16 @@
|
|||
<%= render :partial => 'student_work/work_attachments', :locals => {:attachments => homework_common.attachments} %>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% if homework_common.homework_type == 3 && !homework_common.student_work_projects.empty? %>
|
||||
<% if homework_common.homework_type == 3 && !homework_common.student_work_projects.empty? && homework_common.homework_detail_group.base_on_project == 1 %>
|
||||
<div class="mt10">
|
||||
<div class="fl proRelateWrap mr10">
|
||||
<img src="/images/course/proRelated.png" width="25" height="25" class="borderRadius mt7 ml7" title="已关联项目" />
|
||||
<div class="fl mr5 fontGrey3">
|
||||
<!--<img src="/images/course/proRelated.png" width="25" height="25" class="borderRadius mt7 ml7" title="已关联项目" />-->
|
||||
已关联项目:
|
||||
</div>
|
||||
<% homework_common.student_work_projects.each do |pro| %>
|
||||
<% homework_common.student_work_projects.where("is_leader = 1").each do |pro| %>
|
||||
<div class="mr10 mb10 fl">
|
||||
<% project = Project.find pro.project_id %>
|
||||
<% if project.is_public == 1 %>
|
||||
<% if project.is_public == 1 || User.current.member_of?(project) || User.current.admin? %>
|
||||
<%=link_to image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius"),project_path(project.id,:host=>Setting.host_name) %>
|
||||
<% else %>
|
||||
<%= image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius") %>
|
||||
|
|
|
@ -221,6 +221,7 @@ RedmineApp::Application.routes.draw do
|
|||
post 'student_work_project'
|
||||
get 'new_student_work_project'
|
||||
get 'search_user_projects'
|
||||
get 'search_course_students'
|
||||
get 'cancel_relate_project'
|
||||
get 'delete_work'
|
||||
get 'destroy_score_reply'
|
||||
|
|
|
@ -14,14 +14,33 @@ namespace :homework_evaluation do
|
|||
if homework_common.anonymous_comment == 0 && homework_detail_manual.comment_status == 1 #新建状态才可开启匿评
|
||||
student_works = homework_common.student_works
|
||||
if student_works && student_works.size >= 2
|
||||
student_works.each_with_index do |work, index|
|
||||
user = work.user
|
||||
n = homework_detail_manual.evaluation_num
|
||||
n = n < student_works.size ? n : student_works.size - 1
|
||||
assigned_homeworks = get_assigned_homeworks(student_works, n, index)
|
||||
assigned_homeworks.each do |h|
|
||||
student_works_evaluation_distributions = StudentWorksEvaluationDistribution.new(user_id: user.id, student_work_id: h.id)
|
||||
student_works_evaluation_distributions.save
|
||||
if homework_common.homework_type == 3
|
||||
student_work_projects = homework_common.student_work_projects.where("student_work_id is not null")
|
||||
student_work_projects.each_with_index do |pro_work, pro_index|
|
||||
n = homework_detail_manual.evaluation_num
|
||||
n = n < student_works.size ? n : student_works.size - 1
|
||||
work_index = -1
|
||||
student_works.each_with_index do |stu_work, stu_index|
|
||||
if stu_work.id.to_i == pro_work.student_work_id.to_i
|
||||
work_index = stu_index
|
||||
end
|
||||
end
|
||||
assigned_homeworks = get_assigned_homeworks(student_works, n, work_index)
|
||||
assigned_homeworks.each do |h|
|
||||
student_works_evaluation_distributions = StudentWorksEvaluationDistribution.new(user_id: pro_work.user_id, student_work_id: h.id)
|
||||
student_works_evaluation_distributions.save
|
||||
end
|
||||
end
|
||||
else
|
||||
student_works.each_with_index do |work, index|
|
||||
user = work.user
|
||||
n = homework_detail_manual.evaluation_num
|
||||
n = n < student_works.size ? n : student_works.size - 1
|
||||
assigned_homeworks = get_assigned_homeworks(student_works, n, index)
|
||||
assigned_homeworks.each do |h|
|
||||
student_works_evaluation_distributions = StudentWorksEvaluationDistribution.new(user_id: user.id, student_work_id: h.id)
|
||||
student_works_evaluation_distributions.save
|
||||
end
|
||||
end
|
||||
end
|
||||
homework_detail_manual.update_column('comment_status', 2)
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
|
@ -960,13 +960,31 @@ function regexStudentWorkDescription()
|
|||
}
|
||||
}
|
||||
|
||||
function regexStudentWorkMember(min, max) {
|
||||
var members = $.trim($("#group_member_ids").val()).split(',');
|
||||
if ( min <= members.length && members.length <= max ){
|
||||
$("#student_work_group_textarea").text("");
|
||||
return true;
|
||||
} else {
|
||||
$("#student_work_group_textarea").text("合作成员人数应为:"+min+"-"+max+"人");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//提交新建作品
|
||||
function new_student_work()
|
||||
{
|
||||
if(regexStudentWorkName()&®exStudentWorkDescription())
|
||||
{
|
||||
$("#new_student_work").submit();
|
||||
$("#ajax-indicator").hide();
|
||||
if($("#group_member_ids").length > 0) {
|
||||
if(regexStudentWorkMember(parseInt($.trim($("#min_num_member").html())),parseInt($.trim($("#max_num_member").html())))) {
|
||||
$("#new_student_work").submit();
|
||||
$("#ajax-indicator").hide();
|
||||
}
|
||||
} else {
|
||||
$("#new_student_work").submit();
|
||||
$("#ajax-indicator").hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -251,8 +251,15 @@ function new_student_work()
|
|||
{
|
||||
if(regexStudentWorkName()&®exStudentWorkDescription())
|
||||
{
|
||||
$("#new_student_work").submit();
|
||||
$("#ajax-indicator").hide();
|
||||
if($("#group_member_ids").length > 0) {
|
||||
if(regexStudentWorkMember(parseInt($.trim($("#min_num_member").html())),parseInt($.trim($("#max_num_member").html())))) {
|
||||
$("#new_student_work").submit();
|
||||
$("#ajax-indicator").hide();
|
||||
}
|
||||
} else {
|
||||
$("#new_student_work").submit();
|
||||
$("#ajax-indicator").hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -298,6 +305,17 @@ function regexStudentWorkDescription()
|
|||
}
|
||||
}
|
||||
|
||||
function regexStudentWorkMember(min, max) {
|
||||
var members = $.trim($("#group_member_ids").val()).split(',');
|
||||
if ( min <= members.length && members.length <= max ){
|
||||
$("#student_work_group_textarea").text("");
|
||||
return true;
|
||||
} else {
|
||||
$("#student_work_group_textarea").text("合作成员人数应为:"+min+"-"+max+"人");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//学生作品
|
||||
function show_project()
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue