From fd8b40a36eaf3a0284589e0da305f04b881ba325 Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 4 Mar 2016 16:53:36 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=B9=E4=BA=8E=E7=BC=96=E7=A8=8B=E4=BD=9C?= =?UTF-8?q?=E4=B8=9A=EF=BC=8C=E7=B3=BB=E7=BB=9F=E8=AF=84=E5=88=86=E7=9A=84?= =?UTF-8?q?=E5=89=8D=E5=87=A0=E5=90=8D=E8=83=BD=E5=90=A6=E4=B9=9F=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E5=87=BA=E6=9D=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../_org_course_homework.html.erb | 46 +++++++++++-------- app/views/users/_course_homework.html.erb | 46 +++++++++++-------- .../users/_user_homework_detail.html.erb | 46 +++++++++++-------- 3 files changed, 78 insertions(+), 60 deletions(-) diff --git a/app/views/organizations/_org_course_homework.html.erb b/app/views/organizations/_org_course_homework.html.erb index a8b05f08f..2e038f01f 100644 --- a/app/views/organizations/_org_course_homework.html.erb +++ b/app/views/organizations/_org_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 %> @@ -139,30 +139,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 = 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| %> -
- <%= link_to image_tag(url_to_avatar(User.find sw.user_id), :width => "40", :height => "40"), student_work_index_path(:homework => activity.id), :alt => "学生头像" %> - - - <% score = sw.respond_to?("score") ? sw.score : (sw.final_score || 0) - sw.absence_penalty - sw.late_penalty %> -

分数:<%=format("%.1f",score<0 ? 0 : score) %>分

-
- <% 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| %> +
+ <%= link_to image_tag(url_to_avatar(User.find sw.user_id), :width => "40", :height => "40"), student_work_index_path(:homework => activity.id), :alt => "学生头像" %> + + + <% score = sw.respond_to?("score") ? sw.score : (sw.final_score || 0) - sw.absence_penalty - sw.late_penalty %> +

分数:<%=format("%.1f",score<0 ? 0 : score) %>分

+
+ <% 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/_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| %> -
- <%= link_to image_tag(url_to_avatar(User.find sw.user_id), :width => "40", :height => "40"), student_work_index_path(:homework => activity.id), :alt => "学生头像" %> - - - <% score = sw.respond_to?("score") ? sw.score : (sw.final_score || 0) - sw.absence_penalty - sw.late_penalty %> -

分数:<%=format("%.1f",score<0 ? 0 : score) %>分

-
- <% 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| %> +
+ <%= link_to image_tag(url_to_avatar(User.find sw.user_id), :width => "40", :height => "40"), student_work_index_path(:homework => activity.id), :alt => "学生头像" %> + + + <% score = sw.respond_to?("score") ? sw.score : (sw.final_score || 0) - sw.absence_penalty - sw.late_penalty %> +

分数:<%=format("%.1f",score<0 ? 0 : score) %>分

+
+ <% 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 %>