Merge branch 'cxt_course' into develop
Conflicts: app/controllers/student_work_controller.rb app/views/praise_tread/_praise.html.erb db/schema.rb
This commit is contained in:
commit
3aa891acf6
|
@ -1154,7 +1154,7 @@ class CoursesController < ApplicationController
|
|||
sql_select = ""
|
||||
if groupid == 0
|
||||
sql_select = "SELECT members.*,(
|
||||
SELECT SUM(IF(student_works.final_score IS NULL,NULL,IF(student_works.final_score =0,0,IF((student_works.final_score - student_works.absence_penalty - student_works.late_penalty) < 0 , 0, student_works.final_score - student_works.absence_penalty - student_works.late_penalty))))
|
||||
SELECT SUM(student_works.work_score)
|
||||
FROM student_works,homework_commons
|
||||
WHERE student_works.homework_common_id = homework_commons.id
|
||||
AND homework_commons.course_id = #{@course.id}
|
||||
|
@ -1166,7 +1166,7 @@ class CoursesController < ApplicationController
|
|||
WHERE members.course_id = #{@course.id} ORDER BY score #{score_sort_by}"
|
||||
else
|
||||
sql_select = "SELECT members.*,(
|
||||
SELECT SUM(IF(student_works.final_score IS NULL,NULL,IF(student_works.final_score =0,0,IF((student_works.final_score - student_works.absence_penalty - student_works.late_penalty) < 0 , 0, student_works.final_score - student_works.absence_penalty - student_works.late_penalty))))
|
||||
SELECT SUM(student_works.work_score)
|
||||
FROM student_works,homework_commons
|
||||
WHERE student_works.homework_common_id = homework_commons.id
|
||||
AND homework_commons.course_id = #{@course.id}
|
||||
|
|
|
@ -372,11 +372,11 @@ class StudentWorkController < ApplicationController
|
|||
#开放作品 || 老师 || 超级管理员 || 禁用匿评&&作业截止&&已提交作品 显示所有列表
|
||||
if @homework.is_open == 1 || @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.where(:user_id => User.current.id).empty?)
|
||||
if @order == 'lastname'
|
||||
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,IF(final_score = 0, 0, final_score - absence_penalty - late_penalty)) 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.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'
|
||||
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,IF(final_score = 0, 0, final_score - absence_penalty - late_penalty)) 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.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
|
||||
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,IF(final_score = 0, 0, final_score - absence_penalty - late_penalty)) as score").joins(:user).where("users.id in #{student_in_group}").order("#{@order} #{@b_sort}"),@name
|
||||
@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
|
||||
end
|
||||
@show_all = true
|
||||
elsif User.current.member_of_course?(@course)
|
||||
|
@ -386,10 +386,10 @@ class StudentWorkController < ApplicationController
|
|||
if pro.nil?
|
||||
@stundet_works = []
|
||||
else
|
||||
@stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,IF(final_score = 0, 0, final_score - absence_penalty - late_penalty)) as score").where(:id => pro.student_work_id)
|
||||
@stundet_works = @homework.student_works.select("student_works.*,student_works.work_score as score").where(:id => pro.student_work_id)
|
||||
end
|
||||
else
|
||||
@stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,IF(final_score = 0, 0, final_score - absence_penalty - late_penalty)) as score").where(:user_id => User.current.id)
|
||||
@stundet_works = @homework.student_works.select("student_works.*,student_works.work_score as score").where(:user_id => User.current.id)
|
||||
end
|
||||
elsif @homework.homework_detail_manual.comment_status == 2 #学生 && 开启匿评 看到匿评列表
|
||||
if @homework.homework_type == 3
|
||||
|
@ -409,20 +409,20 @@ class StudentWorkController < ApplicationController
|
|||
if pro.nil?
|
||||
my_work = []
|
||||
else
|
||||
my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,IF(final_score = 0, 0, final_score - absence_penalty - late_penalty)) as score").where(:id => pro.student_work_id)
|
||||
my_work = @homework.student_works.select("student_works.*,student_works.work_score as score").where(:id => pro.student_work_id)
|
||||
end
|
||||
else
|
||||
my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,IF(final_score = 0, 0, final_score - absence_penalty - late_penalty)) as score").where(:user_id => User.current.id)
|
||||
my_work = @homework.student_works.select("student_works.*,student_works.work_score as score").where(:user_id => User.current.id)
|
||||
end
|
||||
if my_work.empty?
|
||||
@stundet_works = []
|
||||
else
|
||||
if @order == 'lastname'
|
||||
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,IF(final_score = 0, 0, final_score - absence_penalty - late_penalty)) 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.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'
|
||||
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,IF(final_score = 0, 0, final_score - absence_penalty - late_penalty)) 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.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
|
||||
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,IF(final_score = 0, 0, final_score - absence_penalty - late_penalty)) as score").joins(:user).where("users.id in #{student_in_group}").order("#{@order} #{@b_sort}"),@name
|
||||
@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
|
||||
end
|
||||
@show_all = true
|
||||
end
|
||||
|
@ -434,15 +434,15 @@ class StudentWorkController < ApplicationController
|
|||
return
|
||||
end
|
||||
|
||||
@student_work_count = (search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,IF(final_score = 0, 0, final_score - absence_penalty - late_penalty)) 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.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
|
||||
if @homework.is_open == 1 || @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.where(:user_id => User.current.id).empty?)
|
||||
if @order == 'lastname'
|
||||
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,IF(final_score = 0, 0, final_score - absence_penalty - late_penalty)) 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.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'
|
||||
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,IF(final_score = 0, 0, final_score - absence_penalty - late_penalty)) 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.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
|
||||
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,IF(final_score = 0, 0, final_score - absence_penalty - late_penalty)) as score").order("#{@order} #{@b_sort}"),@name
|
||||
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,student_works.work_score as score").order("#{@order} #{@b_sort}"),@name
|
||||
end
|
||||
@show_all = true
|
||||
elsif User.current.member_of_course?(@course)
|
||||
|
@ -452,10 +452,10 @@ class StudentWorkController < ApplicationController
|
|||
if pro.nil?
|
||||
@stundet_works = []
|
||||
else
|
||||
@stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,IF(final_score = 0, 0, final_score - absence_penalty - late_penalty)) as score").where(:id => pro.student_work_id)
|
||||
@stundet_works = @homework.student_works.select("student_works.*,student_works.work_score as score").where(:id => pro.student_work_id)
|
||||
end
|
||||
else
|
||||
@stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,IF(final_score = 0, 0, final_score - absence_penalty - late_penalty)) as score").where(:user_id => User.current.id)
|
||||
@stundet_works = @homework.student_works.select("student_works.*,student_works.work_score as score").where(:user_id => User.current.id)
|
||||
end
|
||||
elsif @homework.homework_detail_manual.comment_status == 2 #学生 && 开启匿评 看到匿评列表
|
||||
if @homework.homework_type == 3
|
||||
|
@ -475,20 +475,20 @@ class StudentWorkController < ApplicationController
|
|||
if pro.nil?
|
||||
my_work = []
|
||||
else
|
||||
my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,IF(final_score = 0, 0, final_score - absence_penalty - late_penalty)) as score").where(:id => pro.student_work_id)
|
||||
my_work = @homework.student_works.select("student_works.*,student_works.work_score as score").where(:id => pro.student_work_id)
|
||||
end
|
||||
else
|
||||
my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,IF(final_score = 0, 0, final_score - absence_penalty - late_penalty)) as score").where(:user_id => User.current.id)
|
||||
my_work = @homework.student_works.select("student_works.*,student_works.work_score as score").where(:user_id => User.current.id)
|
||||
end
|
||||
if my_work.empty?
|
||||
@stundet_works = []
|
||||
else
|
||||
if @order == 'lastname'
|
||||
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,IF(final_score = 0, 0, final_score - absence_penalty - late_penalty)) 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.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'
|
||||
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,IF(final_score = 0, 0, final_score - absence_penalty - late_penalty)) 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.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
|
||||
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,IF(final_score = 0, 0, final_score - absence_penalty - late_penalty)) as score").order("#{@order} #{@b_sort}"),@name
|
||||
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,student_works.work_score as score").order("#{@order} #{@b_sort}"),@name
|
||||
end
|
||||
@show_all = true
|
||||
end
|
||||
|
@ -499,9 +499,7 @@ class StudentWorkController < ApplicationController
|
|||
render_403
|
||||
return
|
||||
end
|
||||
|
||||
@student_work_count = (search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,IF(final_score = 0, 0, final_score - absence_penalty - late_penalty)) as score").order("#{@order} #{@b_sort}"),@name).count
|
||||
end
|
||||
@student_work_count = (search_homework_member @homework.student_works.select("student_works.*,student_works.work_score as score").order("#{@order} #{@b_sort}"),@name).count end
|
||||
|
||||
@score = @b_sort == "desc" ? "asc" : "desc"
|
||||
@is_focus = params[:is_focus] ? params[:is_focus].to_i : 0
|
||||
|
@ -1311,6 +1309,7 @@ class StudentWorkController < ApplicationController
|
|||
if homework.teacher_priority == 1 #教师优先
|
||||
if student_work.teacher_score
|
||||
student_work.final_score = student_work.teacher_score
|
||||
student_work.work_score = student_work.teacher_score
|
||||
else
|
||||
if student_work.teaching_asistant_score.nil?
|
||||
student_work.final_score = student_work.student_score
|
||||
|
@ -1323,6 +1322,8 @@ class StudentWorkController < ApplicationController
|
|||
final_score = final_ta_score + final_s_score
|
||||
student_work.final_score = format("%.2f",final_score.to_f)
|
||||
end
|
||||
score = student_work.final_score - student_work.absence_penalty - student_work.late_penalty if student_work.final_score
|
||||
student_work.work_score = format("%.2f",(score < 0 ? 0 : score).to_f) if score
|
||||
end
|
||||
else #不考虑教师评分
|
||||
if student_work.teaching_asistant_score.nil?
|
||||
|
@ -1336,11 +1337,14 @@ class StudentWorkController < ApplicationController
|
|||
final_score = final_ta_score + final_s_score
|
||||
student_work.final_score = format("%.2f",final_score.to_f)
|
||||
end
|
||||
score = student_work.final_score - student_work.absence_penalty - student_work.late_penalty if student_work.final_score
|
||||
student_work.work_score = format("%.2f",(score < 0 ? 0 : score).to_f) if score
|
||||
end
|
||||
elsif homework.homework_type == 2 && homework.homework_detail_programing #编程作业-----设定:系统评分必定不为空
|
||||
if homework.teacher_priority == 1 #教师优先
|
||||
if student_work.teacher_score
|
||||
student_work.final_score = student_work.teacher_score
|
||||
student_work.work_score = student_work.teacher_score
|
||||
else
|
||||
if student_work.teaching_asistant_score.nil? #教辅未评分
|
||||
if student_work.student_score.nil?
|
||||
|
@ -1369,6 +1373,8 @@ class StudentWorkController < ApplicationController
|
|||
final_score = final_sy_score + final_ts_score + final_st_score
|
||||
student_work.final_score = format("%.2f",final_score.to_f)
|
||||
end
|
||||
score = student_work.final_score - student_work.absence_penalty - student_work.late_penalty if student_work.final_score
|
||||
student_work.work_score = format("%.2f",(score < 0 ? 0 : score).to_f) if score
|
||||
end
|
||||
else #不考虑教师评分
|
||||
if student_work.teaching_asistant_score.nil? #教辅未评分
|
||||
|
@ -1398,6 +1404,8 @@ class StudentWorkController < ApplicationController
|
|||
final_score = final_sy_score + final_ts_score + final_st_score
|
||||
student_work.final_score = format("%.2f",final_score.to_f)
|
||||
end
|
||||
score = student_work.final_score - student_work.absence_penalty - student_work.late_penalty if student_work.final_score
|
||||
student_work.work_score = format("%.2f",(score < 0 ? 0 : score).to_f) if score
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -850,7 +850,7 @@ module CoursesHelper
|
|||
# 学生按作业总分排序,取前8个
|
||||
def hero_homework_score(course, score_sort_by)
|
||||
sql_select = "SELECT members.*,(
|
||||
SELECT SUM(IF(student_works.final_score IS NULL,NULL,IF(student_works.final_score =0,0,IF((student_works.final_score - student_works.absence_penalty - student_works.late_penalty) < 0 , 0, student_works.final_score - student_works.absence_penalty - student_works.late_penalty))))
|
||||
SELECT SUM(work_score)
|
||||
FROM student_works,homework_commons
|
||||
WHERE student_works.homework_common_id = homework_commons.id
|
||||
AND homework_commons.course_id = #{course.id}
|
||||
|
|
|
@ -150,7 +150,7 @@ class Member < ActiveRecord::Base
|
|||
|
||||
#当前学生在指定作业内的得分
|
||||
def homework_common_score homework_common
|
||||
StudentWork.select("IF(final_score is null,null,IF(final_score = 0, 0, final_score - absence_penalty - late_penalty)) as final_score").where(:homework_common_id => homework_common.id,:user_id => self.user_id)
|
||||
StudentWork.select("work_score").where(:homework_common_id => homework_common.id,:user_id => self.user_id)
|
||||
end
|
||||
|
||||
def student_work_score_avg
|
||||
|
@ -158,7 +158,7 @@ class Member < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def student_work_score_sum
|
||||
sql_select = "SELECT (SUM(IF(student_works.final_score IS NULL,NULL,IF(student_works.final_score =0,0,IF((student_works.final_score - student_works.absence_penalty - student_works.late_penalty) < 0 , 0, student_works.final_score - student_works.absence_penalty - student_works.late_penalty))))) AS score
|
||||
sql_select = "SELECT (SUM(student_works.work_score)) AS score
|
||||
FROM student_works,homework_commons
|
||||
WHERE student_works.homework_common_id = homework_commons.id
|
||||
AND homework_commons.course_id = #{self.course_id}
|
||||
|
|
|
@ -50,6 +50,7 @@ class StudentWork < ActiveRecord::Base
|
|||
if homework.teacher_priority == 1 #教师优先
|
||||
if student_work.teacher_score
|
||||
student_work.final_score = student_work.teacher_score
|
||||
student_work.work_score = student_work.teacher_score
|
||||
else
|
||||
if student_work.teaching_asistant_score.nil?
|
||||
student_work.final_score = student_work.student_score
|
||||
|
@ -62,6 +63,8 @@ class StudentWork < ActiveRecord::Base
|
|||
final_score = final_ta_score + final_s_score
|
||||
student_work.final_score = format("%.2f",final_score.to_f)
|
||||
end
|
||||
score = student_work.final_score - student_work.absence_penalty - student_work.late_penalty if student_work.final_score
|
||||
student_work.work_score = format("%.2f",(score < 0 ? 0 : score).to_f) if score
|
||||
end
|
||||
else #不考虑教师评分
|
||||
if student_work.teaching_asistant_score.nil?
|
||||
|
@ -75,11 +78,14 @@ class StudentWork < ActiveRecord::Base
|
|||
final_score = final_ta_score + final_s_score
|
||||
student_work.final_score = format("%.2f",final_score.to_f)
|
||||
end
|
||||
score = student_work.final_score - student_work.absence_penalty - student_work.late_penalty if student_work.final_score
|
||||
student_work.work_score = format("%.2f",(score < 0 ? 0 : score).to_f) if score
|
||||
end
|
||||
elsif homework.homework_type == 2 && homework.homework_detail_programing #编程作业-----设定:系统评分必定不为空
|
||||
if homework.teacher_priority == 1 #教师优先
|
||||
if student_work.teacher_score
|
||||
student_work.final_score = student_work.teacher_score
|
||||
student_work.work_score = student_work.teacher_score
|
||||
else
|
||||
if student_work.teaching_asistant_score.nil? #教辅未评分
|
||||
if student_work.student_score.nil?
|
||||
|
@ -108,6 +114,8 @@ class StudentWork < ActiveRecord::Base
|
|||
final_score = final_sy_score + final_ts_score + final_st_score
|
||||
student_work.final_score = format("%.2f",final_score.to_f)
|
||||
end
|
||||
score = student_work.final_score - student_work.absence_penalty - student_work.late_penalty if student_work.final_score
|
||||
student_work.work_score = format("%.2f",(score < 0 ? 0 : score).to_f) if score
|
||||
end
|
||||
else #不考虑教师评分
|
||||
if student_work.teaching_asistant_score.nil? #教辅未评分
|
||||
|
@ -137,6 +145,8 @@ class StudentWork < ActiveRecord::Base
|
|||
final_score = final_sy_score + final_ts_score + final_st_score
|
||||
student_work.final_score = format("%.2f",final_score.to_f)
|
||||
end
|
||||
score = student_work.final_score - student_work.absence_penalty - student_work.late_penalty if student_work.final_score
|
||||
student_work.work_score = format("%.2f",(score < 0 ? 0 : score).to_f) if score
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
</span>
|
||||
<span class="c_red w70">
|
||||
<% final_score = @member_score.homework_common_score(homework_common).first%>
|
||||
<%= final_score.nil? || final_score.final_score.nil? ? "--" : format("%0.2f", final_score.final_score < 0 ? 0 : final_score.final_score) %>
|
||||
<%= final_score.nil? || final_score.work_score.nil? ? "--" : format("%0.2f", final_score.work_score < 0 ? 0 : final_score.work_score) %>
|
||||
</span>
|
||||
</li>
|
||||
<% end %>
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
<% if PraiseTread.praised(activity) %>
|
||||
<a href='<%= Setting.protocol+"://"+Setting.host_name+"/praise_tread/praise_plus?obj_id="+activity.id.to_s+"&obj_type="+activity.class.name+"&user_activity_id="+user_activity_id.to_s+"&type="+type.to_s %>' data-remote="true" class="<%=type == 'reply'? 'fr' : 'ml15' %> likeButton" title="点赞" >
|
||||
<a href='<%= praise_tread_praise_plus_path({:obj_id=>activity.id,:obj_type=>activity.class,:user_activity_id=>user_activity_id,:type=>type }) %>' data-remote="true" class="<%=type == 'reply'? 'fr' : 'ml15' %> likeButton" title="点赞" >
|
||||
<span class="likeText">赞</span>
|
||||
<% num = get_praise_num(activity) %>
|
||||
<span class="likeNum"><%= num > 0 ? "(#{num})" : "" %></span>
|
||||
</a>
|
||||
<% else %>
|
||||
<a href='<%= Setting.protocol+"://"+Setting.host_name+"/praise_tread/praise_minus?obj_id="+activity.id.to_s+"&obj_type="+activity.class.name+"&user_activity_id="+user_activity_id.to_s+"&type="+type.to_s %>' data-remote="true" class="<%=type == 'reply'? 'fr' : 'ml15' %> likeButton" title="取消点赞" >
|
||||
<a href='<%= praise_tread_praise_minus_path({:obj_id=>activity.id,:obj_type=>activity.class,:user_activity_id=>user_activity_id,:type=>type }) %>' data-remote="true" class="<%=type == 'reply'? 'fr' : 'ml15' %> likeButton" title="取消点赞" >
|
||||
<span class="likeText">已赞</span>
|
||||
<% num = get_praise_num(activity) %>
|
||||
<span class="likeNum"><%= num > 0 ? "(#{num})" : "" %></span>
|
||||
|
|
|
@ -82,7 +82,11 @@
|
|||
</li>
|
||||
<% end %>
|
||||
<!-- 成绩 -->
|
||||
<% score = student_work.respond_to?("score") ? student_work.score : (student_work.final_score || 0) - student_work.absence_penalty - student_work.late_penalty%>
|
||||
<% if student_work.homework_common && student_work.homework_common.teacher_priority == 1 && student_work.teacher_score %>
|
||||
<% score = student_work.respond_to?("score") ? student_work.score : student_work.teacher_score %>
|
||||
<% else %>
|
||||
<% score = student_work.respond_to?("score") ? student_work.score : (student_work.final_score || 0) - student_work.absence_penalty - student_work.late_penalty%>
|
||||
<% end %>
|
||||
<li class="hworkList50 <%= score_color score%> student_final_scor_info">
|
||||
<%= score.nil? ? "--" : format("%.1f",score<0 ? 0 : score)%>
|
||||
<% unless score.nil?%>
|
||||
|
|
|
@ -14,11 +14,12 @@
|
|||
<div class="h450">
|
||||
<% homeworks.each do |homework| %>
|
||||
<ul class="subject-list-row">
|
||||
<li class="subject-list-name fl hidden">
|
||||
<li class="subject-list-name fl">
|
||||
<label onclick="show_homework_detail('<%=show_homework_detail_user_path(@user,:homework=>homework.id,:is_import => 0) %>')">
|
||||
<input type="radio" name="checkMenu" class="mr5" style="vertical-align:middle;" value="<%= homework.id%>"/>
|
||||
<span title="<%= homework.name%>"><%= homework.name%></span>
|
||||
<input type="radio" name="checkMenu" class="mr5 subject-name-middle" value="<%= homework.id%>"/>
|
||||
<span title="<%= homework.name%>" class="subject-name-middle subject-name-hidden"><%= homework.name%></span>
|
||||
</label>
|
||||
<img src="/images/locked.png" width="16" height="16" alt="私有" title="私有" class="subject-name-middle" />
|
||||
</li>
|
||||
<li class="subject-list-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-list-type fl">
|
||||
|
@ -34,6 +35,7 @@
|
|||
<li class="subject-list-publisher fl hidden"><%= homework.user.show_name %></li>
|
||||
<li class="subject-list-count fl" id="subject_count_homework_<%=homework.id %>"><%= homework.quotes %></li>
|
||||
<li class="fl subject-list-date"><%=format_date homework.publish_time %></li>
|
||||
<li class="fl subject-list-option"><a href="javascript:void(0);">提交申请</a></li>
|
||||
</ul>
|
||||
<% end %>
|
||||
</div>
|
|
@ -30,6 +30,9 @@
|
|||
<%= 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 == 'desc' ? 'st_up' : 'st_down'} mt12 fl" ,:remote => true%>
|
||||
<% end%>
|
||||
</li>
|
||||
<li class="fl subject-list-option">
|
||||
操作
|
||||
</li>
|
||||
</ul>
|
||||
<div id="homework_repository">
|
||||
<%=render :partial => 'homework_repository', :locals => {:homeworks => homeworks} %>
|
||||
|
|
|
@ -41,7 +41,10 @@
|
|||
<li class="fl resource-switch">
|
||||
<a href="<%= user_homework_type_user_path(@user,:type=>'2',:is_import => 0) %>" id="user_homeworks_choose" class="resource-tab" data-remote="true">我的题库</a>
|
||||
</li>
|
||||
<li class="fl w770 border-bottom h34"> </li>
|
||||
<li class="fl resource-switch">
|
||||
<a href="javascript:void(0);" class="resource-tab" data-remote="true">申请题库</a>
|
||||
</li>
|
||||
<li class="fl w680 border-bottom h34"> </li>
|
||||
<li class="fr resource-banner-li border-bottom h34">
|
||||
<ul class="resourcesSelect">
|
||||
<li class="resourcesSelected"><a href="javascript:void(0);" class="resourcesIcon"></a>
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
class AddColumnToStudentWorks < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :student_works, :work_score, :float
|
||||
count = StudentWork.all.count / 30 + 2
|
||||
transaction do
|
||||
for i in 1 ... count do i
|
||||
StudentWork.page(i).per(30).each do |sw|
|
||||
if sw.homework_common && sw.homework_common.teacher_priority == 0
|
||||
unless sw.final_score.nil?
|
||||
score = sw.final_score - sw.absence_penalty - sw.late_penalty
|
||||
sw.update_column('work_score', score < 0 ? 0 : score)
|
||||
end
|
||||
elsif sw.homework_common && sw.homework_common.teacher_priority == 1
|
||||
unless sw.final_score.nil?
|
||||
if sw.teacher_score
|
||||
sw.update_column('work_score', sw.teacher_score)
|
||||
else
|
||||
score = sw.final_score - sw.absence_penalty - sw.late_penalty
|
||||
sw.update_column('work_score', score < 0 ? 0 : score)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20160421011543) do
|
||||
ActiveRecord::Schema.define(:version => 20160427075457) do
|
||||
|
||||
|
||||
|
||||
|
@ -1734,6 +1734,7 @@ ActiveRecord::Schema.define(:version => 20160419074016) do
|
|||
t.boolean "is_test", :default => false
|
||||
t.integer "simi_id"
|
||||
t.integer "simi_value"
|
||||
t.float "work_score"
|
||||
end
|
||||
|
||||
add_index "student_works", ["homework_common_id", "user_id"], :name => "index_student_works_on_homework_common_id_and_user_id"
|
||||
|
|
|
@ -704,7 +704,7 @@ a.postOptionLink:hover {color:#ffffff; background-color:#269ac9;}
|
|||
.imageFuzzy {filter:alpha(opacity=50); -moz-opacity:0.5; -khtml-opacity:0.5;opacity: 0.5;}
|
||||
.homepagePostReplyDes {float:left; width:642px; margin-left:15px;}
|
||||
.homepagePostReplyPublisher {font-size:12px; color:#888888; margin-bottom:5px;}
|
||||
.homepagePostReplyContent {font-size:12px; color:#484848; margin:3px 5px 12px 5px;font: 14px/1.5 "sans serif",tahoma,verdana,helvetica;font-family: 微软雅黑, 宋体;}
|
||||
.homepagePostReplyContent {font-size:12px; color:#484848; margin:3px 5px 12px 5px;font: 14px/1.5 "sans serif",tahoma,verdana,helvetica;font-family:"微软雅黑","宋体";}
|
||||
.table_maxWidth table {max-width: 642px;}
|
||||
.homepagePostProjectState {width:52px; height:20px; line-height:20px; border-radius:1px; background-color:#28be6c; color:#ffffff; text-align:center; vertical-align:middle; font-size:12px; display:inline-block; margin-left:5px;}
|
||||
.homepagePostAssignTo {float:left; font-size:14px; color:#269ac9;}
|
||||
|
@ -714,7 +714,7 @@ a.postOptionLink:hover {color:#ffffff; background-color:#269ac9;}
|
|||
a.postGrey {color:#484848;}
|
||||
a.postGrey:hover {color:#000000;}
|
||||
a.gz_btn{display:block; background:url(../images/pic_uersall.png) -318px -25px no-repeat; width:53px; height:18px; border:1px solid #cdcdcd; color:#333333; padding:0px 0 0 18px;margin-top: 2px;margin-right: 15px;}
|
||||
a:hover.gz_btn{ color:#ff5722;}
|
||||
a:hover .gz_btn{color:#ff5722;}
|
||||
.homepagePostReplyjournal{margin-left: 15px; float: left;}
|
||||
.lh18 {line-height: 18px;}
|
||||
/*该高度会写入配置文件*/
|
||||
|
@ -1469,9 +1469,10 @@ a.choose-active {background-color:#269ac9; color:#ffffff;}
|
|||
/*20160301新题库样式*/
|
||||
.subject-list-banner {width:685px; height:40px; background-color:#f1f1f1; border-top:1px solid #eaeaea; color:#7a7a7a; font-size:14px;}
|
||||
.subject-list-banner li {height:40px; line-height:40px; vertical-align:middle;}
|
||||
.subject-list-name {width:260px; padding-left:10px; padding-right:10px;}
|
||||
.subject-list-name {width:190px; padding-left:10px; padding-right:10px;}
|
||||
.subject-list-publisher {width:80px; text-align:center;}
|
||||
.subject-list-date {width:70px; text-align:center;}
|
||||
.subject-list-option {width:70px; text-align:center;}
|
||||
.subject-list-row {width:685px; height:40px; color:#7a7a7a; font-size:12px;}
|
||||
.subject-list-row li {height:40px; line-height:40px; vertical-align:middle;}
|
||||
.subject-list-search {border:1px solid #dddddd; height:32px; width:250px;}
|
||||
|
@ -1481,6 +1482,8 @@ a.choose-active {background-color:#269ac9; color:#ffffff;}
|
|||
.subject-list-type {width:50px; text-align:center;}
|
||||
.subject-list-count {width:60px; text-align:center;}
|
||||
.subject-list-from {width:145px; text-align:center;}
|
||||
.subject-name-middle {display:inline-block; line-height:40px; vertical-align:middle;}
|
||||
.subject-name-hidden {max-width:150px; overflow:hidden; white-space:nowrap; text-overflow:ellipsis;}
|
||||
|
||||
/*视频播放默认图标*/
|
||||
.mediaIco{margin: 30px 0 30px 20px;width: 200px;}
|
||||
|
|
|
@ -172,6 +172,7 @@ h4{ font-size:14px; color:#3b3b3b;}
|
|||
.w600{ width:600px !important;}
|
||||
.w606{ width:606px }
|
||||
.w705{ width:705px;}
|
||||
.w680{ width: 680px;}
|
||||
.w770{ width:770px;}
|
||||
.h20{height: 20px;}
|
||||
.h22{ height:22px;}
|
||||
|
|
Loading…
Reference in New Issue