分组作业:组内每个成员都复制一份组长的作业,得分相同
This commit is contained in:
parent
252851b4ad
commit
1e7f3db946
|
@ -410,11 +410,11 @@ class StudentWorkController < ApplicationController
|
||||||
#开放作品 || 老师 || 超级管理员 || 禁用匿评&&作业截止&&已提交作品 显示所有列表
|
#开放作品 || 老师 || 超级管理员 || 禁用匿评&&作业截止&&已提交作品 显示所有列表
|
||||||
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 && 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 @order == 'lastname'
|
if @order == 'lastname'
|
||||||
@stundet_works = search_homework_member @homework.student_works.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'
|
||||||
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,student_works.work_score as score").joins(:user).where("users.id in #{student_in_group}").joins("join user_extensions on student_works.user_id = user_extensions.user_id").order("#{@order} #{@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}").joins("join user_extensions on student_works.user_id = user_extensions.user_id").order("#{@order} #{@b_sort}"),@name
|
||||||
else
|
else
|
||||||
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,student_works.work_score as score").joins(:user).where("users.id in #{student_in_group}").order("#{@order} #{@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("#{@order} #{@b_sort}"),@name
|
||||||
end
|
end
|
||||||
@show_all = true
|
@show_all = true
|
||||||
elsif User.current.member_of_course?(@course)
|
elsif User.current.member_of_course?(@course)
|
||||||
|
@ -476,11 +476,11 @@ class StudentWorkController < ApplicationController
|
||||||
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 && 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 @order == 'lastname'
|
if @order == 'lastname'
|
||||||
@stundet_works = search_homework_member @homework.student_works.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'
|
||||||
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,student_works.work_score as score").joins("join user_extensions on student_works.user_id = user_extensions.user_id").order("#{@order} #{@b_sort}"),@name
|
@stundet_works = search_homework_member @homework.student_works.no_copy.select("student_works.*,student_works.work_score as score").joins("join user_extensions on student_works.user_id = user_extensions.user_id").order("#{@order} #{@b_sort}"),@name
|
||||||
else
|
else
|
||||||
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,student_works.work_score as score").order("#{@order} #{@b_sort}"),@name
|
@stundet_works = search_homework_member @homework.student_works.no_copy.select("student_works.*,student_works.work_score as score").order("#{@order} #{@b_sort}"),@name
|
||||||
end
|
end
|
||||||
@show_all = true
|
@show_all = true
|
||||||
elsif User.current.member_of_course?(@course)
|
elsif User.current.member_of_course?(@course)
|
||||||
|
@ -613,33 +613,23 @@ class StudentWorkController < ApplicationController
|
||||||
student_work.work_status = 1
|
student_work.work_status = 1
|
||||||
end
|
end
|
||||||
if student_work.save
|
if student_work.save
|
||||||
if @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1
|
if @homework.homework_type == 3
|
||||||
|
if @homework.homework_detail_group.base_on_project == 1
|
||||||
@student_work_project.student_work_id = student_work.id
|
@student_work_project.student_work_id = student_work.id
|
||||||
@student_work_project.save
|
@student_work_project.save
|
||||||
|
elsif @homework.homework_detail_group.base_on_project == 0
|
||||||
|
stu_project = StudentWorkProject.new(:homework_common_id => @homework.id, :student_work_id => student_work.id, :project_id => student_work.project_id, :user_id => student_work.user_id, :is_leader => 1)
|
||||||
|
stu_project.save
|
||||||
|
end
|
||||||
members = params[:group_member_ids].split(',')
|
members = params[:group_member_ids].split(',')
|
||||||
for i in 1 .. members.count-1
|
for i in 1 .. members.count-1
|
||||||
stu_project = StudentWorkProject.new
|
stu_work = @homework.student_works.where("user_id = #{members[i].to_i} and work_status = 0").first
|
||||||
stu_project.homework_common_id = @homework.id
|
stu_work ||= StudentWork.new
|
||||||
stu_project.student_work_id = student_work.id
|
stu_work.update_attributes(:name => student_work.name, :description => student_work.description, :project_id => student_work.project_id, :late_penalty => student_work.late_penalty,:work_status => 3, :commit_time => student_work.commit_time)
|
||||||
stu_project.project_id = @student_work_project.project_id
|
if stu_work.save
|
||||||
stu_project.user_id = members[i].to_i
|
stu_project = StudentWorkProject.new(:homework_common_id => @homework.id, :student_work_id => student_work.id, :project_id => stu_work.project_id == 0 ? -1 : stu_work.project_id, :user_id => members[i].to_i, :is_leader => 0)
|
||||||
stu_project.is_leader = 0
|
|
||||||
stu_project.save
|
stu_project.save
|
||||||
end
|
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
|
||||||
end
|
end
|
||||||
@homework.update_column(:updated_at, Time.now)
|
@homework.update_column(:updated_at, Time.now)
|
||||||
|
@ -687,22 +677,21 @@ class StudentWorkController < ApplicationController
|
||||||
if @homework.homework_type == 3
|
if @homework.homework_type == 3
|
||||||
@student_work_project = @homework.student_work_projects.where("user_id=?",User.current.id).first
|
@student_work_project = @homework.student_work_projects.where("user_id=?",User.current.id).first
|
||||||
student_work_projects = @homework.student_work_projects.where("student_work_id=? and is_leader =?",@work.id,0)
|
student_work_projects = @homework.student_work_projects.where("student_work_id=? and is_leader =?",@work.id,0)
|
||||||
|
user_ids = student_work_projects.empty? ? "(-1)" : "(" + student_work_projects.map{|stu|stu.user_id}.join(",") + ")"
|
||||||
|
student_works = @homework.student_works.where("user_id in #{user_ids}")
|
||||||
|
student_works.update_all(:work_status => 0, :name => "#{@homework.name}的作品提交", :description => nil, :late_penalty => 0, :commit_time => nil,:final_score => nil,:teacher_score => nil,:student_score => nil,:teaching_asistant_score => nil,:system_score => 0,:work_score => nil, :project_id => 0)
|
||||||
student_work_projects.delete_all
|
student_work_projects.delete_all
|
||||||
members = params[:group_member_ids].split(',')
|
members = params[:group_member_ids].split(',')
|
||||||
for i in 1 .. members.count-1
|
for i in 1 .. members.count-1
|
||||||
stu_project = StudentWorkProject.new
|
stu_work = @homework.student_works.where("user_id = #{members[i].to_i} and work_status = 0").first
|
||||||
stu_project.homework_common_id = @homework.id
|
stu_work ||= StudentWork.new
|
||||||
stu_project.student_work_id = @work.id
|
stu_work.update_attributes(:name => @work.name, :description => @work.description, :project_id => @work.project_id, :late_penalty => @work.late_penalty,:work_status => 3, :commit_time => @work.commit_time)
|
||||||
if @homework.homework_detail_group.base_on_project == 1
|
if stu_work.save
|
||||||
stu_project.project_id = @student_work_project.project_id
|
stu_project = StudentWorkProject.new(:homework_common_id => @homework.id, :student_work_id => @work.id, :project_id => stu_work.project_id == 0 ? -1 : stu_work.project_id, :user_id => members[i].to_i, :is_leader => 0)
|
||||||
else @homework.homework_detail_group.base_on_project == 0
|
|
||||||
stu_project.project_id = -1
|
|
||||||
end
|
|
||||||
stu_project.user_id = members[i].to_i
|
|
||||||
stu_project.is_leader = 0
|
|
||||||
stu_project.save
|
stu_project.save
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
course_message = CourseMessage.new(:user_id =>User.current.id,:content=>"edit",:course_message_id=>@work.id,:course_id => @course.id,:course_message_type=>"StudentWork", :status => 9) #作品提交记录
|
course_message = CourseMessage.new(:user_id =>User.current.id,:content=>"edit",:course_message_id=>@work.id,:course_id => @course.id,:course_message_type=>"StudentWork", :status => 9) #作品提交记录
|
||||||
course_message.save
|
course_message.save
|
||||||
|
@ -735,28 +724,25 @@ class StudentWorkController < ApplicationController
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
if @homework.homework_type == 3
|
if @homework.homework_type == 3
|
||||||
if @work.destroy
|
|
||||||
if @homework.homework_detail_group.base_on_project == 1
|
|
||||||
pros = @work.student_work_projects.where("is_leader = 0")
|
pros = @work.student_work_projects.where("is_leader = 0")
|
||||||
pros.each do |pro|
|
user_ids = pros.empty? ? "(-1)" : "(" + pros.map{|stu|stu.user_id}.join(",") + ")"
|
||||||
pro.destroy
|
student_works = @homework.student_works.where("user_id in #{user_ids}")
|
||||||
end
|
student_works.update_all(:work_status => 0, :name => "#{@homework.name}的作品提交", :description => nil, :late_penalty => 0, :commit_time => nil,:final_score => nil,:teacher_score => nil,:student_score => nil,:teaching_asistant_score => nil,:system_score => 0,:work_score => nil, :project_id => 0)
|
||||||
|
pros.delete_all
|
||||||
|
|
||||||
project = @work.student_work_projects.where("is_leader = 1").first
|
project = @work.student_work_projects.where("is_leader = 1").first
|
||||||
|
if @homework.homework_detail_group.base_on_project == 1
|
||||||
project.update_attributes(:student_work_id => nil)
|
project.update_attributes(:student_work_id => nil)
|
||||||
elsif @homework.homework_detail_group.base_on_project == 0
|
|
||||||
@work.student_work_projects.each do |pro2|
|
|
||||||
pro2.destroy
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
else
|
else
|
||||||
|
project.destroy
|
||||||
|
end
|
||||||
|
end
|
||||||
@work.attachments.destroy_all
|
@work.attachments.destroy_all
|
||||||
@work.student_works_scores.destroy_all
|
@work.student_works_scores.destroy_all
|
||||||
@work.course_messages.destroy_all
|
@work.course_messages.destroy_all
|
||||||
@work.student_work_tests.destroy_all
|
@work.student_work_tests.destroy_all
|
||||||
@work.update_attributes(:work_status => 0, :name => "#{@homework.name}的作品提交", :description => nil, :late_penalty => 0, :commit_time => nil,:final_score => nil,:teacher_score => nil,:student_score => nil,:teaching_asistant_score => nil,:system_score => 0,:work_score => nil)
|
@work.update_attributes(:work_status => 0, :name => "#{@homework.name}的作品提交", :description => nil, :late_penalty => 0, :commit_time => nil,:final_score => nil,:teacher_score => nil,:student_score => nil,:teaching_asistant_score => nil,:system_score => 0,:work_score => nil, :project_id => 0)
|
||||||
@work.update_column("work_score",nil)
|
@work.update_column("work_score",nil)
|
||||||
end
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html {
|
format.html {
|
||||||
redirect_to student_work_index_url(:homework => @homework.id)
|
redirect_to student_work_index_url(:homework => @homework.id)
|
||||||
|
@ -786,25 +772,23 @@ class StudentWorkController < ApplicationController
|
||||||
|
|
||||||
def retry_work
|
def retry_work
|
||||||
if @homework.homework_type == 3
|
if @homework.homework_type == 3
|
||||||
if @work.destroy
|
|
||||||
if @homework.homework_detail_group.base_on_project == 1
|
|
||||||
pros = @work.student_work_projects.where("is_leader = 0")
|
pros = @work.student_work_projects.where("is_leader = 0")
|
||||||
pros.each do |pro|
|
user_ids = pros.empty? ? "(-1)" : "(" + pros.map{|stu|stu.user_id}.join(",") + ")"
|
||||||
pro.destroy
|
student_works = @homework.student_works.where("user_id in #{user_ids}")
|
||||||
end
|
student_works.update_all(:work_status => 0, :name => "#{@homework.name}的作品提交", :description => nil, :late_penalty => 0, :commit_time => nil, :project_id => 0)
|
||||||
|
pros.delete_all
|
||||||
|
|
||||||
project = @work.student_work_projects.where("is_leader = 1").first
|
project = @work.student_work_projects.where("is_leader = 1").first
|
||||||
|
if @homework.homework_detail_group.base_on_project == 1
|
||||||
project.update_attributes(:student_work_id => nil)
|
project.update_attributes(:student_work_id => nil)
|
||||||
elsif @homework.homework_detail_group.base_on_project == 0
|
else
|
||||||
@work.student_work_projects.each do |pro2|
|
project.destroy
|
||||||
pro2.destroy
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
elsif @homework.homework_type == 1
|
@work.update_attributes(:work_status => 0, :name => "#{@homework.name}的作品提交", :description => nil, :late_penalty => 0, :commit_time => nil, :project_id => 0)
|
||||||
@work.update_attributes(:work_status => 0, :name => "#{@homework.name}的作品提交", :description => nil, :late_penalty => 0, :commit_time => nil)
|
|
||||||
@work.attachments.destroy_all
|
@work.attachments.destroy_all
|
||||||
@work.course_messages.destroy_all
|
@work.course_messages.destroy_all
|
||||||
end
|
|
||||||
@student_work = StudentWork.new
|
@student_work = StudentWork.new
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.js
|
format.js
|
||||||
|
@ -1096,9 +1080,13 @@ class StudentWorkController < ApplicationController
|
||||||
|
|
||||||
#创建作业的关联项目
|
#创建作业的关联项目
|
||||||
def student_work_project
|
def student_work_project
|
||||||
|
@work = @homework.student_works.where("user_id = #{User.current.id} and work_status = 0").first
|
||||||
|
if @work
|
||||||
|
@work.update_column('project_id', params[:projectName].to_i)
|
||||||
|
end
|
||||||
@project = StudentWorkProject.new
|
@project = StudentWorkProject.new
|
||||||
@project.homework_common_id = @homework.id
|
@project.homework_common_id = @homework.id
|
||||||
@project.project_id = (Project.find params[:projectName].to_i).id
|
@project.project_id = params[:projectName].to_i
|
||||||
@project.user_id = User.current.id
|
@project.user_id = User.current.id
|
||||||
@project.is_leader = 1
|
@project.is_leader = 1
|
||||||
if @project.save
|
if @project.save
|
||||||
|
@ -1147,6 +1135,10 @@ class StudentWorkController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def cancel_relate_project
|
def cancel_relate_project
|
||||||
|
@work = @homework.student_works.where("user_id = #{User.current.id} and work_status = 0").first
|
||||||
|
if @work
|
||||||
|
@work.update_column('project_id', 0)
|
||||||
|
end
|
||||||
relate_pro = StudentWorkProject.where("user_id = #{User.current.id} and homework_common_id = #{@homework.id}").first
|
relate_pro = StudentWorkProject.where("user_id = #{User.current.id} and homework_common_id = #{@homework.id}").first
|
||||||
if relate_pro.destroy
|
if relate_pro.destroy
|
||||||
@user_activity_id = params[:user_activity_id].to_i
|
@user_activity_id = params[:user_activity_id].to_i
|
||||||
|
@ -1586,6 +1578,10 @@ class StudentWorkController < ApplicationController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
if homework.homework_type == 3
|
||||||
|
student_works = group_student_works student_work, homework
|
||||||
|
student_works.update_all(:final_score => student_work.final_score,:teacher_score => student_work.teacher_score,:student_score => student_work.student_score,:teaching_asistant_score => student_work.teaching_asistant_score,:work_score => student_work.work_score)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1115,7 +1115,7 @@ class UsersController < 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
|
if homework_detail_manual.comment_status == 1
|
||||||
create_works_list homework
|
create_works_list homework
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -158,4 +158,11 @@ module StudentWorkHelper
|
||||||
end
|
end
|
||||||
return status
|
return status
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def group_student_works student_work, homework
|
||||||
|
pros = student_work.student_work_projects.where("is_leader = 0")
|
||||||
|
user_ids = pros.empty? ? "(-1)" : "(" + pros.map{|stu|stu.user_id}.join(",") + ")"
|
||||||
|
student_works = homework.student_works.where("user_id in #{user_ids}")
|
||||||
|
return student_works
|
||||||
|
end
|
||||||
end
|
end
|
|
@ -1,4 +1,4 @@
|
||||||
#学生提交作品表
|
#学生提交作品表 #work_status :0 未提交 1 已提交 2 迟交 3 分组作品复制的组员作品
|
||||||
class StudentWork < ActiveRecord::Base
|
class StudentWork < ActiveRecord::Base
|
||||||
attr_accessible :name, :description, :homework_common_id, :user_id, :final_score, :teacher_score, :student_score, :teaching_asistant_score, :system_score, :work_score, :project_id, :is_test, :simi_id, :simi_value, :work_status, :commit_time
|
attr_accessible :name, :description, :homework_common_id, :user_id, :final_score, :teacher_score, :student_score, :teaching_asistant_score, :system_score, :work_score, :project_id, :is_test, :simi_id, :simi_value, :work_status, :commit_time
|
||||||
|
|
||||||
|
@ -13,7 +13,8 @@ class StudentWork < ActiveRecord::Base
|
||||||
has_many :course_messages, :class_name =>'CourseMessage', :as => :course_message, :dependent => :destroy
|
has_many :course_messages, :class_name =>'CourseMessage', :as => :course_message, :dependent => :destroy
|
||||||
has_many :attachments, :dependent => :destroy
|
has_many :attachments, :dependent => :destroy
|
||||||
|
|
||||||
scope :has_committed, lambda{where("work_status != 0")}
|
scope :has_committed, lambda{where("work_status != 0 and work_status != 3")}
|
||||||
|
scope :no_copy, lambda{where("work_status != 3")}
|
||||||
|
|
||||||
before_destroy :delete_praise
|
before_destroy :delete_praise
|
||||||
before_save :set_program_score, :set_src
|
before_save :set_program_score, :set_src
|
||||||
|
@ -169,6 +170,12 @@ class StudentWork < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
if homework.homework_type == 3
|
||||||
|
pros = student_work.student_work_projects.where("is_leader = 0")
|
||||||
|
user_ids = pros.empty? ? "(-1)" : "(" + pros.map{|stu|stu.user_id}.join(",") + ")"
|
||||||
|
student_works = homework.student_works.where("user_id in #{user_ids}")
|
||||||
|
student_works.update_all(:final_score => student_work.final_score,:teacher_score => student_work.teacher_score,:student_score => student_work.student_score,:teaching_asistant_score => student_work.teaching_asistant_score,:work_score => student_work.work_score)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,11 @@
|
||||||
<%= link_to student_work.user.show_name,"javascript:void(0)" ,:title => student_work.user.show_name, :class => "StudentName break_word"%>
|
<%= link_to student_work.user.show_name,"javascript:void(0)" ,:title => student_work.user.show_name, :class => "StudentName break_word"%>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<% if student_work.project.is_public || User.current.member_of?(student_work.project) || User.current.admin? %>
|
<% if student_work.project_id == 0 || student_work.project_id.nil?%>
|
||||||
|
<td class="<%=@homework.anonymous_comment == 1 ? 'hworkPrName2' : 'hworkPrName'%> student_work_<%= student_work.id%>" title="该项目是私有的">
|
||||||
|
--
|
||||||
|
</td>
|
||||||
|
<% elsif student_work.project.is_public || User.current.member_of?(student_work.project) || User.current.admin? %>
|
||||||
<td class="<%=@homework.anonymous_comment == 1 ? 'hworkPrName2' : 'hworkPrName'%> student_work_<%= student_work.id%>" title="项目名称">
|
<td class="<%=@homework.anonymous_comment == 1 ? 'hworkPrName2' : 'hworkPrName'%> student_work_<%= student_work.id%>" title="项目名称">
|
||||||
<%= link_to( student_work.project.name, project_path(student_work.project.id))%>
|
<%= link_to( student_work.project.name, project_path(student_work.project.id))%>
|
||||||
</td>
|
</td>
|
||||||
|
|
|
@ -26,7 +26,11 @@
|
||||||
<%= link_to student_work.user.show_name,"javascript:void(0)" ,:title => student_work.user.show_name, :class => "linkGrey f14 StudentName break_word"%>
|
<%= link_to student_work.user.show_name,"javascript:void(0)" ,:title => student_work.user.show_name, :class => "linkGrey f14 StudentName break_word"%>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<% if student_work.project.is_public || User.current.member_of?(student_work.project) || User.current.admin? %>
|
<% if student_work.project_id == 0 || student_work.project_id.nil?%>
|
||||||
|
<td class="hworkPrName float-none mr10 student_work_<%= student_work.id%>" title="项目名称">
|
||||||
|
--
|
||||||
|
</td>
|
||||||
|
<% elsif student_work.project.is_public || User.current.member_of?(student_work.project) || User.current.admin? %>
|
||||||
<td class="hworkPrName float-none mr10 student_work_<%= student_work.id%>" title="项目名称">
|
<td class="hworkPrName float-none mr10 student_work_<%= student_work.id%>" title="项目名称">
|
||||||
<%= link_to( student_work.project.name, project_path(student_work.project.id))%>
|
<%= link_to( student_work.project.name, project_path(student_work.project.id))%>
|
||||||
</td>
|
</td>
|
||||||
|
|
|
@ -46,13 +46,16 @@
|
||||||
<% if @homework.homework_detail_group.base_on_project == 1 %>
|
<% if @homework.homework_detail_group.base_on_project == 1 %>
|
||||||
<li>
|
<li>
|
||||||
<span class="tit_fb"> 关联项目:</span>
|
<span class="tit_fb"> 关联项目:</span>
|
||||||
<% if work.project.is_public || User.current.member_of?(work.project) || User.current.admin? %>
|
<% if work.project_id == 0 || work.project_id.nil? %>
|
||||||
|
<span>暂无</span>
|
||||||
|
<% elsif work.project.is_public || User.current.member_of?(work.project) || User.current.admin? %>
|
||||||
<%= link_to( work.project.name, project_path(work.project.id), :class => "linkBlue" )%>
|
<%= link_to( work.project.name, project_path(work.project.id), :class => "linkBlue" )%>
|
||||||
|
<span class="ml5">(综合评分:<font class="c_red"><%=static_project_score(work.project.project_score).to_i %></font>)</span>
|
||||||
<% else %>
|
<% else %>
|
||||||
<span title ="该项目是私有的"><%=work.project.name %></span>
|
<span title ="该项目是私有的"><%=work.project.name %></span>
|
||||||
|
<span class="ml5">(综合评分:<font class="c_red"><%=static_project_score(work.project.project_score).to_i %></font>)</span>
|
||||||
<% end %>
|
<% end %>
|
||||||
<%#= link_to( work.project.name, project_path(work.project.id), :class => "linkBlue" )%>
|
<%#= link_to( work.project.name, project_path(work.project.id), :class => "linkBlue" )%>
|
||||||
<span class="ml5">(综合评分:<font class="c_red"><%=static_project_score(work.project.project_score).to_i %></font>)</span>
|
|
||||||
</li>
|
</li>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end%>
|
<% end%>
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
class GroupHomeworkCopyWork < ActiveRecord::Migration
|
||||||
|
def up
|
||||||
|
homeworks = HomeworkCommon.where("homework_type = 3")
|
||||||
|
count = homeworks.count / 30 + 2
|
||||||
|
transaction do
|
||||||
|
for i in 1 ... count do i
|
||||||
|
homeworks.page(i).per(30).each do |homework|
|
||||||
|
homework.student_works.each do |stu|
|
||||||
|
stu.student_work_projects.each do |stu_pro|
|
||||||
|
if stu_pro.is_leader == 0
|
||||||
|
new_stu = StudentWork.new(:name => stu.name, :description => stu.description, :homework_common_id =>homework.id, :user_id => stu_pro.user_id, :final_score => stu.final_score, :teacher_score => stu.teacher_score, :student_score => stu.student_score, :teaching_asistant_score => stu.teaching_asistant_score,
|
||||||
|
:project_id => stu.project_id, :late_penalty => stu.late_penalty,:absence_penalty => stu.absence_penalty,:work_score => stu.work_score,:work_status => 3,:commit_time => stu.commit_time)
|
||||||
|
new_stu.save
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
end
|
||||||
|
end
|
|
@ -11,7 +11,7 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended to check this file into your version control system.
|
# It's strongly recommended to check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(:version => 20160830090214) do
|
ActiveRecord::Schema.define(:version => 20160905084821) do
|
||||||
|
|
||||||
create_table "activities", :force => true do |t|
|
create_table "activities", :force => true do |t|
|
||||||
t.integer "act_id", :null => false
|
t.integer "act_id", :null => false
|
||||||
|
|
Loading…
Reference in New Issue