# <%=time_from_now last_score.created_at %>
<%= link_to last_score.user.show_name, user_activities_path(last_score.user_id), :class => "newsBlue ml5 mr5"%>评阅了作品,优秀排行:
- <% ids = '('+student_work_scores.map{|sw|sw.student_work_id}.join(',')+')' %>
- <% student_works = activity.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where("student_works.id in #{ids}").order("score desc") %>
- <% student_works.each_with_index do |sw, i| %>
-
- <% if i == 4 %>
- <% break %>
- <% end %>
- <% end %>
- <% if student_works.count > 5 %>
- <%= link_to "更多>>", student_work_index_path(:homework => activity.id),:class=>'linkGrey2 fl ml50',:style=>'margin-top:60px;'%>
- <% end %>
-
+ <% if activity.homework_type != 2 %>
+ <% ids = student_work_scores.empty? ? "(-1)" : '('+student_work_scores.map{|sw|sw.student_work_id}.join(',')+')' %>
+ <% student_works = activity.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where("student_works.id in #{ids}").order("score desc") %>
+ <% else %>
+ <% student_works = activity.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").order("score desc") %>
+ <% end %>
+ <% student_works.each_with_index do |sw, i| %>
+
+ <% if i == 4 %>
+ <% break %>
+ <% end %>
+ <% end %>
+ <% if student_works.count > 5 %>
+ <%= link_to "更多>>", student_work_index_path(:homework => activity.id),:class=>'linkGrey2 fl ml50',:style=>'margin-top:60px;'%>
+ <% end %>
+
+
<% if activity.homework_type == 3 && activity.homework_detail_group.base_on_project == 1 %>
diff --git a/app/views/users/_course_homework.html.erb b/app/views/users/_course_homework.html.erb
index 603772269..7c5aa5e4f 100644
--- a/app/views/users/_course_homework.html.erb
+++ b/app/views/users/_course_homework.html.erb
@@ -128,7 +128,7 @@
<% if activity.student_works.count != 0 %>
<% sw = activity.student_works.reorder("created_at desc").first %>
-
+
# <%=time_from_now sw.created_at %><%= link_to sw.user.show_name, user_activities_path(sw.user_id), :class => "newsBlue ml5 mr5"%>提交了作品
<% end %>
@@ -138,30 +138,36 @@
<% student_work_scores = StudentWorksScore.find_by_sql("select max(created_at) as created_at, student_work_id, user_id from student_works_scores where student_work_id in #{sw_id} group by student_work_id order by max(created_at) desc") %>
<% unless student_work_scores.empty? %>
<% last_score = student_work_scores.first %>
-
+
# <%=time_from_now last_score.created_at %>
<%= link_to last_score.user.show_name, user_activities_path(last_score.user_id), :class => "newsBlue ml5 mr5"%>评阅了作品,优秀排行:
- <% ids = '('+student_work_scores.map{|sw|sw.student_work_id}.join(',')+')' %>
- <% student_works = activity.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where("student_works.id in #{ids}").order("score desc") %>
- <% student_works.each_with_index do |sw, i| %>
-
- <% if i == 4 %>
- <% break %>
- <% end %>
- <% end %>
- <% if student_works.count > 5 %>
- <%= link_to "更多>>", student_work_index_path(:homework => activity.id),:class=>'linkGrey2 fl ml50',:style=>'margin-top:60px;'%>
- <% end %>
-
<% end %>
+
+ <% if activity.homework_type != 2 %>
+ <% ids = student_work_scores.empty? ? "(-1)" : '('+student_work_scores.map{|sw|sw.student_work_id}.join(',')+')' %>
+ <% student_works = activity.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where("student_works.id in #{ids}").order("score desc") %>
+ <% else %>
+ <% student_works = activity.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").order("score desc") %>
+ <% end %>
+ <% student_works.each_with_index do |sw, i| %>
+
+ <% if i == 4 %>
+ <% break %>
+ <% end %>
+ <% end %>
+ <% if student_works.count > 5 %>
+ <%= link_to "更多>>", student_work_index_path(:homework => activity.id),:class=>'linkGrey2 fl ml50',:style=>'margin-top:60px;'%>
+ <% end %>
+
+
<% end %>
<% if activity.homework_type == 3 && activity.homework_detail_group.base_on_project == 1 %>
diff --git a/app/views/users/_user_homework_detail.html.erb b/app/views/users/_user_homework_detail.html.erb
index 00a3a7536..70624ce38 100644
--- a/app/views/users/_user_homework_detail.html.erb
+++ b/app/views/users/_user_homework_detail.html.erb
@@ -131,7 +131,7 @@
<% if homework_common.student_works.count != 0 %>
<% sw = homework_common.student_works.reorder("created_at desc").first %>
-
+
# <%=time_from_now sw.created_at %><%= link_to sw.user.show_name, user_activities_path(sw.user_id), :class => "newsBlue ml5 mr5"%>提交了作品
<% end %>
@@ -142,30 +142,36 @@
<%# student_work_scores = StudentWorksScore.where("student_work_id in #{sw_id}").reorder("created_at desc") %>
<% unless student_work_scores.empty? %>
<% last_score = student_work_scores.first %>
-
+
# <%=time_from_now last_score.created_at %>
<%= link_to last_score.user.show_name, user_activities_path(last_score.user_id), :class => "newsBlue ml5 mr5"%>评阅了作品,优秀排行:
- <% ids = '('+student_work_scores.map{|sw|sw.student_work_id}.join(',')+')' %>
- <% student_works = homework_common.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where("student_works.id in #{ids}").order("score desc") %>
- <% student_works.each_with_index do |sw, i| %>
-
- <% if i == 4 %>
- <% break %>
- <% end %>
- <% end %>
- <% if student_works.count > 5%>
- <%= link_to "更多>>", student_work_index_path(:homework => homework_common.id),:class=>'linkGrey2 fl ml50',:style=>'margin-top:60px;'%>
- <% end %>
-
<% end %>
+
+ <% if homework_common.homework_type != 2 %>
+ <% ids = student_work_scores.empty? ? "(-1)" : '('+student_work_scores.map{|sw|sw.student_work_id}.join(',')+')' %>
+ <% student_works = homework_common.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where("student_works.id in #{ids}").order("score desc") %>
+ <% else %>
+ <% student_works = homework_common.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").order("score desc") %>
+ <% end %>
+ <% student_works.each_with_index do |sw, i| %>
+
+ <% if i == 4 %>
+ <% break %>
+ <% end %>
+ <% end %>
+ <% if student_works.count > 5%>
+ <%= link_to "更多>>", student_work_index_path(:homework => homework_common.id),:class=>'linkGrey2 fl ml50',:style=>'margin-top:60px;'%>
+ <% end %>
+
+
<% end %>
<% if homework_common.homework_type == 3 && homework_common.homework_detail_group.base_on_project == 1 %>