作业动态优化
This commit is contained in:
parent
85b1d145fe
commit
070e18a9b2
|
@ -2884,7 +2884,7 @@ module ApplicationHelper
|
||||||
end
|
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
|
count = homework.student_works.has_committed.count
|
||||||
if User.current.member_of_course?(homework.course)
|
if User.current.member_of_course?(homework.course)
|
||||||
if is_teacher #老师显示作品数量
|
if is_teacher #老师显示作品数量
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<div class="homepagePostBrief">
|
<div class="homepagePostBrief">
|
||||||
<div class="homepagePostPortrait">
|
<div class="homepagePostPortrait">
|
||||||
<%= link_to image_tag(url_to_avatar(activity.user), :width => "50", :height => "50"), user_path(activity.user_id), :alt => "用户头像" %>
|
<%= 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} %>
|
||||||
</div>
|
</div>
|
||||||
<div class="homepagePostDes">
|
<div class="homepagePostDes">
|
||||||
<div class="homepagePostTo break_word">
|
<div class="homepagePostTo break_word">
|
||||||
|
@ -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} %>
|
<%= render :partial => 'users/homework_post_reply', :locals => {:activity => activity, :user_activity_id => user_activity_id, :hw_status => hw_status, :is_teacher => is_teacher} %>
|
||||||
</div>
|
</div>
|
||||||
<script type="text/javascript">
|
|
||||||
$("#moreProject_<%=user_activity_id %>").click(function(){
|
|
||||||
$("#relatePWrap_<%=user_activity_id %>").toggleClass('relatePWrap');
|
|
||||||
$("#relatePWrap_<%=user_activity_id %>").css("height","auto");
|
|
||||||
$(this).hide();
|
|
||||||
});
|
|
||||||
$("#hideProject_<%=user_activity_id %>").click(function(){
|
|
||||||
$("#relatePWrap_<%=user_activity_id %>").toggleClass('relatePWrap');
|
|
||||||
$("#moreProject_<%=user_activity_id %>").show();
|
|
||||||
});
|
|
||||||
$(function(){
|
|
||||||
user_card_show_hide();
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
|
@ -14,8 +14,6 @@
|
||||||
<div class="homepagePostDeadline">
|
<div class="homepagePostDeadline">
|
||||||
缺评扣分:<%= activity.homework_detail_manual.absence_penalty%>分/作品
|
缺评扣分:<%= activity.homework_detail_manual.absence_penalty%>分/作品
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
|
||||||
<% if activity.anonymous_comment == 0%>
|
|
||||||
<div class="homepagePostDeadline" style="float: right; margin-right: 220px;" id="evaluation_end_time_<%=user_activity_id %>">
|
<div class="homepagePostDeadline" style="float: right; margin-right: 220px;" id="evaluation_end_time_<%=user_activity_id %>">
|
||||||
匿评关闭时间:<%= activity.homework_detail_manual.evaluation_end%> 23:59
|
匿评关闭时间:<%= activity.homework_detail_manual.evaluation_end%> 23:59
|
||||||
</div>
|
</div>
|
||||||
|
@ -27,9 +25,7 @@
|
||||||
<div class="mt10 homepagePostDeadline">
|
<div class="mt10 homepagePostDeadline">
|
||||||
# <%=time_from_now sw.commit_time %><%= link_to sw.user.show_name, user_activities_path(sw.user_id), :class => "newsBlue ml5 mr5"%>提交了作品
|
# <%=time_from_now sw.commit_time %><%= link_to sw.user.show_name, user_activities_path(sw.user_id), :class => "newsBlue ml5 mr5"%>提交了作品
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<div class="cl"></div>
|
||||||
<div class="cl"></div>
|
|
||||||
<% if activity.student_works.has_committed.count != 0 %>
|
|
||||||
<% sw_id = "("+activity.student_works.map{|sw| sw.id}.join(",")+")" %>
|
<% 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.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") %>
|
<% student_work_scores = StudentWorksScore.where("student_work_id in #{sw_id} and score is not null").reorder("created_at desc") %>
|
||||||
|
@ -42,13 +38,8 @@
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
<div>
|
<div>
|
||||||
<% if activity.homework_type != 2 %>
|
<% 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) %>
|
||||||
<% ids = student_work_scores.empty? ? "(-1)" : '('+student_work_scores.map{|sw|sw.student_work_id}.join(',')+')' %>
|
<% student_works.includes(:user).each do |sw| %>
|
||||||
<% 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| %>
|
|
||||||
<div class="fl mr10 w100" style="text-align:center;">
|
<div class="fl mr10 w100" style="text-align:center;">
|
||||||
<a href="javascript:void(0);" class="linkBlue">
|
<a href="javascript:void(0);" class="linkBlue">
|
||||||
<% if User.current.member_of_course?(activity.course) || User.current.admin? || activity.is_open == 1 %>
|
<% if User.current.member_of_course?(activity.course) || User.current.admin? || activity.is_open == 1 %>
|
||||||
|
@ -63,14 +54,11 @@
|
||||||
</p>
|
</p>
|
||||||
<% end %>
|
<% end %>
|
||||||
</a>
|
</a>
|
||||||
<% 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 %>
|
||||||
<p class="fontGrey2">分数:<span class="c_red"><%=format("%.1f",score.to_f < 0 ? 0 : score.to_f) %>分</span></p>
|
<p class="fontGrey2">分数:<span class="c_red"><%=format("%.1f",score.to_f < 0 ? 0 : score.to_f) %>分</span></p>
|
||||||
</div>
|
</div>
|
||||||
<% if i == 4 %>
|
|
||||||
<% break %>
|
|
||||||
<% end %>
|
|
||||||
<% 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;'%>
|
<%= link_to "更多>>", student_work_index_url_in_org(activity.id, 2),:class=>'linkGrey2 fl ml50',:style=>'margin-top:60px;'%>
|
||||||
<% end %>
|
<% end %>
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
|
@ -83,11 +71,11 @@
|
||||||
<% sort_projects = project_sort_update projects %>
|
<% sort_projects = project_sort_update projects %>
|
||||||
<div class="mt10 relatePWrap" id="relatePWrap_<%=user_activity_id %>">
|
<div class="mt10 relatePWrap" id="relatePWrap_<%=user_activity_id %>">
|
||||||
<div class="mr5 fontGrey2">
|
<div class="mr5 fontGrey2">
|
||||||
<%# first_pro = sort_projects.first %>
|
<% first_pro_act = sort_projects.first %>
|
||||||
<% first_pro = Project.find sort_projects.first.project_id %>
|
<% first_pro = Project.find first_pro_act.project_id %>
|
||||||
<% commit_time = first_pro.project_score.commit_time %>
|
<% 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 %>
|
<%# 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"%>更新了项目
|
# <%=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"%>更新了项目
|
||||||
</div>
|
</div>
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -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)%>
|
<% 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 %>
|
<% projects = cur_user_projects_for_homework activity %>
|
||||||
<% works = cur_user_works_for_homework activity %>
|
<% if work.nil? && projects.nil? %>
|
||||||
<% if works.nil? && projects.nil? %>
|
|
||||||
<div class="homepagePostSubmit">
|
<div class="homepagePostSubmit">
|
||||||
<%=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=> '请各组长关联作业项目' %>
|
<%=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=> '请各组长关联作业项目' %>
|
||||||
</div>
|
</div>
|
||||||
<% elsif works.nil? %>
|
<% elsif work.nil? %>
|
||||||
<div class="homepagePostSubmit">
|
<div class="homepagePostSubmit">
|
||||||
<%=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=> '取消关联项目' %>
|
<%=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=> '取消关联项目' %>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<div class="homepagePostSubmit">
|
<div class="homepagePostSubmit">
|
||||||
<%= user_for_homework_common activity,is_teacher %>
|
<%= user_for_homework_common activity,is_teacher,work %>
|
||||||
</div>
|
</div>
|
||||||
<% work = cur_user_works_for_homework activity %>
|
|
||||||
<% if !is_teacher && !work.nil? && work.user == User.current && activity.end_time < Date.today %>
|
<% if !is_teacher && !work.nil? && work.user == User.current && activity.end_time < Date.today %>
|
||||||
<div class="homepagePostSubmit">
|
<div class="homepagePostSubmit">
|
||||||
<%=link_to "追加附件", student_work_index_url_in_org(activity.id, 2, 1), :class => 'c_blue', :title => "可追加作品修订附件" %>
|
<%=link_to "追加附件", student_work_index_url_in_org(activity.id, 2, 1), :class => 'c_blue', :title => "可追加作品修订附件" %>
|
||||||
|
@ -35,8 +34,7 @@
|
||||||
语言:
|
语言:
|
||||||
<%= activity.language_name%>
|
<%= activity.language_name%>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% elsif activity.homework_type == 3 && activity.homework_detail_group%>
|
||||||
<% if activity.homework_type == 3 && activity.homework_detail_group%>
|
|
||||||
<% if activity.homework_detail_group.base_on_project == 1 %>
|
<% if activity.homework_detail_group.base_on_project == 1 %>
|
||||||
<div class="homepagePostDeadline mr15">
|
<div class="homepagePostDeadline mr15">
|
||||||
项目(<%=activity.student_work_projects.where("is_leader = 1").count %>)
|
项目(<%=activity.student_work_projects.where("is_leader = 1").count %>)
|
||||||
|
|
Loading…
Reference in New Issue