<%= 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} %>
<% if activity.try(:user).try(:realname) == ' ' %>
<%= link_to activity.try(:user), user_path(activity.user_id,:host=>Setting.host_user), :class => "newsBlue mr15" %>
<% else %>
<%= link_to activity.try(:user).try(:realname), user_path(activity.user_id,:host=>Setting.host_user), :class => "newsBlue mr15" %>
<% end %> TO
<%= link_to activity.course.name.to_s+" | 课程作业", homework_common_index_path(:course => activity.course.id, :host=> Setting.host_course), :class => "newsBlue ml15"%>
<%= link_to activity.name.to_s, student_work_index_path(:homework => activity.id,:host=> Setting.host_course), :class => "postGrey"%>
<% if activity.homework_detail_manual%>
<% if activity.homework_detail_manual.comment_status == 1%>
<% if activity.anonymous_comment == 0%>
未开启匿评
<% else %>
匿评已禁用
<% end %>
<% if Time.parse(activity.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d")%>
作品提交中
<% elsif Time.parse(activity.end_time.to_s).strftime("%Y-%m-%d") < Time.now.strftime("%Y-%m-%d") %>
作品补交中
<% end %>
<% elsif activity.homework_detail_manual.comment_status == 2%>
<% if activity.anonymous_comment == 0%>
匿评中
<% else %>
匿评已禁用
<% end %>
教师评阅中
<% elsif activity.homework_detail_manual.comment_status == 3%>
<% if activity.anonymous_comment == 0%>
匿评已结束
<% else %>
匿评已禁用
<% end %>
教师评阅中
<% end%>
<% end%>
<% if activity.homework_type == 3 && activity.homework_detail_group.base_on_project == 1%>
系统提示:该作业要求各组长<%=link_to "创建项目", new_project_path(:host=>Setting.host_name),:class=>"c_red",:title=>"新建项目",:style=>"text-decoration:underline;"%>,组成员加入项目,然后由组长关联项目。谢谢配合!
<% elsif activity.homework_type == 3 && activity.homework_detail_group.base_on_project == 0%>
系统提示:该作业要求各组长提交作品,提交作品时请添加组成员。谢谢配合!
<% end %>
<% 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? %>
<%=link_to "关联项目",new_student_work_project_student_work_index_path(:homework => activity.id,:is_in_course=>-1,:user_activity_id=>user_activity_id,:course_activity=>course_activity),remote: true,:class=> 'c_blue', :title=> '请各组长关联作业项目' %>
<%#= relate_project(activity,is_teacher,-1,user_activity_id,course_activity) %>
<% elsif works.nil? %>
<%=link_to "取消关联",cancel_relate_project_student_work_index_path(:homework => activity.id,:is_in_course=>-1,:user_activity_id=>user_activity_id,:course_activity=>course_activity), :confirm => "您确定要取消关联吗?", remote: true,:class => "c_blue", :title=> '取消关联项目' %>
<% end %>
<% end %>
<% is_teacher = User.current.allowed_to?(:as_teacher,activity.course) %>
<%= user_for_homework_common activity,is_teacher %>
<% if activity.homework_type == 2 && is_teacher%>
<%= link_to "模拟答题", new_user_commit_homework_users_path(homework_id: activity.id, is_test: true), class: 'c_blue test-program-btn', title: '教师可以通过模拟答题设置作业的标准答案' %>
<% end %>
<% if activity.homework_type == 2%>
语言:
<%= activity.language_name%>
<% end %>
<% if activity.homework_type == 3 && activity.homework_detail_group%>
分组人数:<%=activity.homework_detail_group.min_num %>-<%=activity.homework_detail_group.max_num %> 人
<% end %>
<% if activity.homework_detail_manual && activity.homework_detail_manual.comment_status < 2 %>
提交截止时间:<%= activity.end_time.to_s %> 23:59
<% elsif activity.homework_detail_manual && activity.homework_detail_manual.comment_status >= 2 && activity.anonymous_comment == 0%>
匿评截止时间:<%= activity.homework_detail_manual.evaluation_end.to_s %> 23:59
<% end %>
<%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>activity.description} %>
<%= render :partial=>"attachments/activity_attach", :locals=>{:activity => activity} %>
迟交扣分:<%= activity.late_penalty%>分
<% if activity.anonymous_comment == 0%>
匿评开启时间:<%= activity.homework_detail_manual.evaluation_start%> 00:00
<% end %>
<% if activity.anonymous_comment == 0%>
缺评扣分:<%= activity.homework_detail_manual.absence_penalty%>分/作品
<% end %>
<% if activity.anonymous_comment == 0%>
匿评关闭时间:<%= activity.homework_detail_manual.evaluation_end%> 23:59
<% end %>
<% 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 %>
<% if activity.student_works.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") %>
<% 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 %>
<% end %>
<% if activity.homework_type == 3 && activity.homework_detail_group.base_on_project == 1 %>
<% projects = activity.student_work_projects.where("is_leader = 1") %>
<% unless projects.empty? %>
<% sort_projects = project_sort_update projects %>
# <%=time_from_now sort_projects.first.updated_at %><%= link_to User.find(sort_projects.first.user_id).show_name, user_activities_path(sort_projects.first.user_id), :class => "newsBlue ml5 mr5"%>更新了项目,最近更新:
<% sort_projects.each_with_index do |pro, i| %>
<% project = Project.find pro.project_id %>
<% if project.is_public || User.current.member_of?(project) || User.current.admin? %>
<%= link_to image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius"),project_path(project.id,:host=>Setting.host_name),:id=>"project_img_"+project.id.to_s+"_"+activity.id.to_s,:alt =>"项目头像" %>
<% else %>
<%= image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius",:id=>"project_img_"+project.id.to_s+"_"+activity.id.to_s,:alt =>"项目头像") %>
<% end %>
<% com_time = project.project_score.commit_time %>
<% time=project.updated_on %>
<% time=ForgeActivity.where("project_id=?",project.id).last.updated_at if ForgeActivity.where("project_id=?",project.id).last %>
<%=(User.find project.user_id).show_name %>(组长)
<%=time_from_now !com_time.nil? && format_time(com_time) > format_time(time) ? com_time : time %> <%= project.project_score.changeset_num %>提交
项目名称:<%=project.name %>
创建者:<%=(User.find project.user_id).show_name %>(组长)
更新时间:<%=time_from_now time %>
<% if i == 9 && projects.count > 10 %>
更多>>
<% end %>
<% if i > 9 && i == (projects.count - 1) %>
收回<<
<% end %>
<% end %>
<% end %>
<% end %>
<% if is_teacher%>
<% comment_status = activity.homework_detail_manual.comment_status %>
-
-
<%= link_to l(:button_edit),edit_homework_common_path(activity,:is_in_course => -1,:course_activity=>course_activity), :class => "postOptionLink"%>
-
<%= link_to(l(:label_bid_respond_delete), homework_common_path(activity,:is_in_course => -1,:course_activity=>course_activity),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "postOptionLink") %>
-
<%= link_to("评分设置", score_rule_set_homework_common_path(activity,:user_activity_id => user_activity_id, :is_in_course => -1,:course_activity=>course_activity),:class => "postOptionLink", :remote => true) %>
<% if activity.anonymous_comment == 0 %>
-
<%= link_to("匿评设置", start_evaluation_set_homework_common_path(activity,:user_activity_id => user_activity_id, :is_in_course => -1,:course_activity=>course_activity),:class => "postOptionLink", :remote => true) if activity.homework_detail_manual.comment_status == 1%>
-
<%= homework_anonymous_comment activity,-1,user_activity_id,course_activity %>
<% end %>
<% if activity.anonymous_comment == 0 && (comment_status == 0 || comment_status == 1)%>
-
<%= link_to("禁用匿评", alert_forbidden_anonymous_comment_homework_common_path(activity,:user_activity_id => user_activity_id,:course_activity=>course_activity),:class => "postOptionLink",
:title => "匿评是同学之间的双盲互评过程:每个同学将评阅系统分配给他/她的若干个作品", :remote => true)%>
<% end %>
<% if (activity.anonymous_comment == 1 && activity.is_open == 0) || (activity.anonymous_comment == 0 && comment_status == 3 && activity.is_open == 0) %>
-
<%= link_to("公开作品", alert_open_student_works_homework_common_path(activity,:user_activity_id => user_activity_id, :is_in_course => -1,:course_activity=>course_activity),:class => "postOptionLink", :remote => true)%>
<% elsif activity.is_open == 1 %>
-
<%= link_to("取消公开", alert_open_student_works_homework_common_path(activity,:user_activity_id => user_activity_id, :is_in_course => -1,:course_activity=>course_activity),:class => "postOptionLink", :remote => true)%>
<% end %>
<% end%>