作业积分出现负分
This commit is contained in:
parent
42f960922a
commit
062af3c57a
|
@ -1079,7 +1079,7 @@ class CoursesController < ApplicationController
|
||||||
sql_select = ""
|
sql_select = ""
|
||||||
if groupid == 0
|
if groupid == 0
|
||||||
sql_select = "SELECT members.*,(
|
sql_select = "SELECT members.*,(
|
||||||
SELECT SUM(IF(student_works.final_score IS NULL,NULL,IF(student_works.final_score =0,0,student_works.final_score - student_works.absence_penalty - student_works.late_penalty)))
|
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))))
|
||||||
FROM student_works,homework_commons
|
FROM student_works,homework_commons
|
||||||
WHERE student_works.homework_common_id = homework_commons.id
|
WHERE student_works.homework_common_id = homework_commons.id
|
||||||
AND homework_commons.course_id = #{@course.id}
|
AND homework_commons.course_id = #{@course.id}
|
||||||
|
@ -1091,7 +1091,7 @@ class CoursesController < ApplicationController
|
||||||
WHERE members.course_id = #{@course.id} ORDER BY score #{score_sort_by}"
|
WHERE members.course_id = #{@course.id} ORDER BY score #{score_sort_by}"
|
||||||
else
|
else
|
||||||
sql_select = "SELECT members.*,(
|
sql_select = "SELECT members.*,(
|
||||||
SELECT SUM(IF(student_works.final_score IS NULL,NULL,IF(student_works.final_score =0,0,student_works.final_score - student_works.absence_penalty - student_works.late_penalty)))
|
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))))
|
||||||
FROM student_works,homework_commons
|
FROM student_works,homework_commons
|
||||||
WHERE student_works.homework_common_id = homework_commons.id
|
WHERE student_works.homework_common_id = homework_commons.id
|
||||||
AND homework_commons.course_id = #{@course.id}
|
AND homework_commons.course_id = #{@course.id}
|
||||||
|
|
|
@ -865,7 +865,7 @@ module CoursesHelper
|
||||||
# 学生按作业总分排序,取前8个
|
# 学生按作业总分排序,取前8个
|
||||||
def hero_homework_score(course, score_sort_by)
|
def hero_homework_score(course, score_sort_by)
|
||||||
sql_select = "SELECT members.*,(
|
sql_select = "SELECT members.*,(
|
||||||
SELECT SUM(IF(student_works.final_score is null,null,IF(student_works.final_score = 0, 0, student_works.final_score - student_works.absence_penalty - student_works.late_penalty)))
|
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))))
|
||||||
FROM student_works,homework_commons
|
FROM student_works,homework_commons
|
||||||
WHERE student_works.homework_common_id = homework_commons.id
|
WHERE student_works.homework_common_id = homework_commons.id
|
||||||
AND homework_commons.course_id = #{course.id}
|
AND homework_commons.course_id = #{course.id}
|
||||||
|
|
|
@ -158,7 +158,7 @@ class Member < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def student_work_score_sum
|
def student_work_score_sum
|
||||||
sql_select = "SELECT (SUM(IF(student_works.final_score IS NULL,NULL,IF(student_works.final_score =0,0,student_works.final_score - student_works.absence_penalty - student_works.late_penalty)))) as score
|
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
|
||||||
FROM student_works,homework_commons
|
FROM student_works,homework_commons
|
||||||
WHERE student_works.homework_common_id = homework_commons.id
|
WHERE student_works.homework_common_id = homework_commons.id
|
||||||
AND homework_commons.course_id = #{self.course_id}
|
AND homework_commons.course_id = #{self.course_id}
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
</span>
|
</span>
|
||||||
<span class="c_red w70">
|
<span class="c_red w70">
|
||||||
<% final_score = @member_score.homework_common_score(homework_common).first%>
|
<% 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) %>
|
<%= final_score.nil? || final_score.final_score.nil? ? "--" : format("%0.2f", final_score.final_score < 0 ? 0 : final_score.final_score) %>
|
||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
Loading…
Reference in New Issue