待匿评的作业

This commit is contained in:
cxt 2016-12-16 14:38:27 +08:00
parent 1ff1ed3c54
commit 271cee79d1
2 changed files with 22 additions and 17 deletions

View File

@ -1838,7 +1838,7 @@ class UsersController < ApplicationController
=end
@unsolved_issues_count = Issue.where(:assigned_to_id => @user.id, :status_id => [1, 2, 4, 6]).includes(:author, :project).order("updated_on desc").count
# 用户待完成的作业
my_course_ids = StudentsForCourse.where(:student_id => @user.id).blank? ? "(-1)" : "(" + StudentsForCourse.where(:student_id => @user.id).map{|sc| sc.course_id}.join(",") + ")"
my_course_ids = StudentsForCourse.includes(:course).where("student_id = #{@user.id} and courses.is_delete = 0").blank? ? "(-1)" : "(" + StudentsForCourse.includes(:course).where("student_id = #{@user.id} and courses.is_delete = 0").map{|sc| sc.course_id}.join(",") + ")"
homeworks = HomeworkCommon.where("course_id in #{my_course_ids} and publish_time <= '#{Date.today}'")
homework_ids = homeworks.blank? ? "(-1)" : "(" + homeworks.map{|homework| homework.id}.join(",") + ")"
student_works = StudentWork.where("user_id = #{@user.id} and homework_common_id in #{homework_ids} and work_status != 0")
@ -2020,12 +2020,17 @@ class UsersController < ApplicationController
# 待匿评的作业
def anonymous_evaluation_list
student_work_evaluations = @user.student_works_evaluation_distributions
student_work_ids = student_work_evaluations.blank? ? "(-1)" : "(" + student_work_evaluations.map{|st| st.student_work_id}.join(",") + ")"
student_work_scores = @user.student_works_scores.where("student_work_id in #{student_work_ids} and reviewer_role = 3")
student_work_scores = @user.student_works_scores.where("reviewer_role = 3")
anonymous_evaluation_ids = student_work_scores.blank? ? "(-1)" : "(" + student_work_scores.map{|st| st.student_work_id}.join(",") + ")"
@anonymous_evaluation = @user.student_works_evaluation_distributions.where("student_work_id not in #{anonymous_evaluation_ids}")
unfinished_evaluations = @user.student_works_evaluation_distributions.where("student_work_id not in #{anonymous_evaluation_ids}")
unfinished_evaluations_work_ids = unfinished_evaluations.blank? ? "(-1)" : "(" + unfinished_evaluations.map{|st| st.student_work_id}.join(",") + ")"
homework_ids = StudentWork.where("id in #{unfinished_evaluations_work_ids}").blank? ? "(-1)" : "(" + StudentWork.where("id in #{unfinished_evaluations_work_ids}").map{|st| st.homework_common_id}.join(",") + ")"
@anonymous_evaluation = HomeworkCommon.where("id in #{homework_ids}").includes(:course).where("courses.is_delete = 0")
@anonymous_evaluation_count = @anonymous_evaluation.count
@limit = 20
@anonymous_evaluation_pages = Paginator.new @anonymous_evaluation_count, @limit, params['page'] || 1
@offset ||= @anonymous_evaluation_pages.offset
@anonymous_evaluation = paginateHelper @anonymous_evaluation, @limit
respond_to do |format|
format.js
end

View File

@ -10,16 +10,16 @@
</tr>
</thead>
<tbody>
<%# @anonymous_evaluation.student_common.each do |ae| %>
<% @anonymous_evaluation.each do |ae| %>
<tr>
<th>
<li class="homepageTabTitle">
1 <%#= link_to ae.name.to_s, "", :target => "_blank", :class => "homepageTabTitle fl ml5" %>
1 <%= link_to ae.name.to_s, "", :target => "_blank", :class => "homepageTabTitle fl ml5" %>
</li>
</th>
<th>
<li class="homepageTabProjectName ml5">
1 <%#= link_to uh.course.try(:name),"", :target => "_blank", :class => "homepageTabTitle ml5"%>
1 <%= link_to uh.course.try(:name),"", :target => "_blank", :class => "homepageTabTitle ml5"%>
<li>
</th>
<th>
@ -30,21 +30,21 @@
<th>
<li class="homepageTabTime ml5" >
1
<!-- <%# if uh.end_time > Time.now.to_i %>
<span class="c_red"><%#= (uh.end_time - Time.now.to_i) / (24*60*60) %></span> 天
<span class="c_red"><%#= ((uh.end_time - Time.now.to_i) % (24*60*60)) / (60*60)%></span> 小时
<span class="c_red"><%#= (((uh.end_time - Time.now.to_i) % (24*60*60)) % (60*60)) / 60%></span> 分
<%# else %>
<% if uh.end_time > Time.now.to_i %>
<span class="c_red"><%= (uh.end_time - Time.now.to_i) / (24*60*60) %></span> 天
<span class="c_red"><%= ((uh.end_time - Time.now.to_i) % (24*60*60)) / (60*60)%></span> 小时
<span class="c_red"><%= (((uh.end_time - Time.now.to_i) % (24*60*60)) % (60*60)) / 60%></span> 分
<% else %>
<span class="c_red">已截止</span>
<%# end %>-->
<% end %>
</li>
</th>
</tr>
<%# end %>
<% end %>
</tbody>
</table>
<ul class="pages" style="width: auto;display: table;margin-left: auto;margin-right: auto; padding-top: 10px">
<%#= pagination_links_full @unfinished_homework_pages, @unfinished_homeworks_count, :per_page_links => false, :remote => true, :flag => true, :is_new => true %>
<%= pagination_links_full @anonymous_evaluation_pages, @anonymous_evaluation_count, :per_page_links => false, :remote => true, :flag => true, :is_new => true %>
</ul>
</div>
</div>