diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index cf90e58a6..683bf2057 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -2884,7 +2884,7 @@ module ApplicationHelper end #根据传入作业确定显示为编辑作品还是新建作品,或者显示作品数量 - def user_for_homework_common homework,is_teacher + def user_for_homework_common homework,is_teacher,work count = homework.student_works.has_committed.count if User.current.member_of_course?(homework.course) if is_teacher #老师显示作品数量 diff --git a/app/views/users/_course_homework.html.erb b/app/views/users/_course_homework.html.erb index f234a383a..00da3215d 100644 --- a/app/views/users/_course_homework.html.erb +++ b/app/views/users/_course_homework.html.erb @@ -3,7 +3,7 @@
<%= link_to image_tag(url_to_avatar(activity.user), :width => "50", :height => "50"), user_path(activity.user_id), :alt => "用户头像" %> - <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.user} %> + <%#= render :partial => 'users/show_detail_info', :locals => {:user => activity.user} %>
@@ -63,17 +63,3 @@ <%= render :partial => 'users/homework_post_reply', :locals => {:activity => activity, :user_activity_id => user_activity_id, :hw_status => hw_status, :is_teacher => is_teacher} %>
- diff --git a/app/views/users/_homework_base_info.html.erb b/app/views/users/_homework_base_info.html.erb index a3d216ef2..716a860ce 100644 --- a/app/views/users/_homework_base_info.html.erb +++ b/app/views/users/_homework_base_info.html.erb @@ -14,8 +14,6 @@
缺评扣分:<%= activity.homework_detail_manual.absence_penalty%>分/作品
- <% end %> - <% if activity.anonymous_comment == 0%>
匿评关闭时间:<%= activity.homework_detail_manual.evaluation_end%> 23:59
@@ -27,9 +25,7 @@
# <%=time_from_now sw.commit_time %><%= link_to sw.user.show_name, user_activities_path(sw.user_id), :class => "newsBlue ml5 mr5"%>提交了作品
-<% end %> -
-<% if activity.student_works.has_committed.count != 0 %> +
<% sw_id = "("+activity.student_works.map{|sw| sw.id}.join(",")+")" %> <%# 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") %> <% student_work_scores = StudentWorksScore.where("student_work_id in #{sw_id} and score is not null").reorder("created_at desc") %> @@ -42,13 +38,8 @@
<% 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.has_committed.select("student_works.*,student_works.work_score as score").where("student_works.id in #{ids}").order("score desc") %> - <% else %> - <% student_works = activity.student_works.has_committed.select("student_works.*,student_works.work_score as score").order("score desc") %> - <% end %> - <% student_works.includes(:user).each_with_index do |sw, i| %> + <% student_works = activity.student_works.select("student_works.*,student_works.work_score as score").where("work_score is not null and work_status != 0").order("score desc").limit(5) %> + <% student_works.includes(:user).each do |sw| %>
<% if User.current.member_of_course?(activity.course) || User.current.admin? || activity.is_open == 1 %> @@ -63,14 +54,11 @@

<% end %>
- <% score = sw.respond_to?("score") ? sw.score : (sw.final_score || 0) - sw.absence_penalty - sw.late_penalty %> + <% score = sw.respond_to?("score") ? sw.score : sw.work_score %>

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

- <% if i == 4 %> - <% break %> - <% end %> <% end %> - <% if student_works.count > 5 %> + <% if student_works.count == 5 %> <%= link_to "更多>>", student_work_index_url_in_org(activity.id, 2),:class=>'linkGrey2 fl ml50',:style=>'margin-top:60px;'%> <% end %>
@@ -83,11 +71,11 @@ <% sort_projects = project_sort_update projects %>
- <%# first_pro = sort_projects.first %> - <% first_pro = Project.find sort_projects.first.project_id %> + <% first_pro_act = sort_projects.first %> + <% first_pro = Project.find first_pro_act.project_id %> <% commit_time = first_pro.project_score.commit_time %> - <% one_forge_time=ForgeActivity.where("project_id=?",first_pro.id).last.updated_at if ForgeActivity.where("project_id=?",first_pro.id).last %> - # <%=time_from_now !commit_time.nil? && format_time(commit_time) > format_time(one_forge_time) ? commit_time : one_forge_time %><%= link_to User.find(first_pro.user_id).show_name, user_activities_path(first_pro.user_id), :class => "newsBlue ml5 mr5"%>更新了项目 + <%# one_forge_time=ForgeActivity.where("project_id=?",first_pro.id).last.updated_at if ForgeActivity.where("project_id=?",first_pro.id).last %> + # <%=time_from_now !commit_time.nil? && format_time(commit_time) > format_time(first_pro_act.updated_at) ? commit_time : first_pro_act.updated_at %><%= link_to User.find(first_pro.user_id).show_name, user_activities_path(first_pro.user_id), :class => "newsBlue ml5 mr5"%>更新了项目
diff --git a/app/views/users/_homework_opr.html.erb b/app/views/users/_homework_opr.html.erb index 90acbf830..9105f7067 100644 --- a/app/views/users/_homework_opr.html.erb +++ b/app/views/users/_homework_opr.html.erb @@ -1,20 +1,19 @@ +<% work = cur_user_works_for_homework activity %> <% if activity.homework_type == 3 && !is_teacher && activity.homework_detail_group.base_on_project == 1 && User.current.member_of_course?(activity.course)%> <% projects = cur_user_projects_for_homework activity %> - <% works = cur_user_works_for_homework activity %> - <% if works.nil? && projects.nil? %> + <% if work.nil? && projects.nil? %>
<%=link_to "关联项目",new_student_work_project_student_work_index_path(:homework => activity.id,:hw_status=>hw_status,:user_activity_id=>user_activity_id),remote: true,:class=> 'c_blue', :title=> '请各组长关联作业项目' %>
- <% elsif works.nil? %> + <% elsif work.nil? %>
<%=link_to "取消关联",cancel_relate_project_student_work_index_path(:homework => activity.id,:hw_status=>hw_status,:user_activity_id=>user_activity_id), :confirm => "您确定要取消关联吗?", remote: true,:class => "c_blue", :title=> '取消关联项目' %>
<% end %> <% end %>
- <%= user_for_homework_common activity,is_teacher %> + <%= user_for_homework_common activity,is_teacher,work %>
-<% work = cur_user_works_for_homework activity %> <% if !is_teacher && !work.nil? && work.user == User.current && activity.end_time < Date.today %>
<%=link_to "追加附件", student_work_index_url_in_org(activity.id, 2, 1), :class => 'c_blue', :title => "可追加作品修订附件" %> @@ -35,8 +34,7 @@ 语言: <%= activity.language_name%>
-<% end %> -<% if activity.homework_type == 3 && activity.homework_detail_group%> +<% elsif activity.homework_type == 3 && activity.homework_detail_group%> <% if activity.homework_detail_group.base_on_project == 1 %>
项目(<%=activity.student_work_projects.where("is_leader = 1").count %>)