修改进入未批列表修改排序后,老师进行评分之后排序会回到默认排序额问题

This commit is contained in:
sw 2015-01-22 15:16:15 +08:00
parent e72ed1054e
commit 683625066e
3 changed files with 6 additions and 5 deletions

View File

@ -26,6 +26,7 @@ class HomeworkAttachController < ApplicationController
get_not_batch_homework_list sort,direction, @bid.id
@cur_page = params[:page] || 1
@cur_type = 1
@cur_sort,@cur_direction = params[:sort] || "s_socre", params[:direction] || "desc"
@direction = direction == 'asc'? 'desc' : 'asc'
respond_to do |format|
format.js
@ -433,7 +434,7 @@ class HomeworkAttachController < ApplicationController
#添加留言
def addjours
@is_teacher,@is_anonymous_comments,@m_score = params[:is_teacher]=="true",params[:is_anonymous_comments]=="true",params[:stars_value]
@cur_page,@cur_type = params[:cur_page] || 1,params[:cur_type] || 5
@cur_page,@cur_type = params[:page] || 1,params[:cur_type] || 5
@homework = HomeworkAttach.find(params[:homework_id])
@stars_reates = @homework.rates(:quality)
homework = @homework
@ -479,7 +480,7 @@ class HomeworkAttachController < ApplicationController
if @cur_type == "1" #如果当前是老师未批列表,需要刷新整个作业列表界面
@bid = @homework.bid
get_not_batch_homework_list "s_socre","desc",@homework.bid_id
get_not_batch_homework_list params[:cur_sort] || "s_socre",params[:cur_direction] || "desc",@homework.bid_id
elsif @cur_type == "2" #老师已批列表
@result_homework = HomeworkAttach.find_by_sql("SELECT homework_attaches.*,
(SELECT stars FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND is_teacher_score = 1 AND stars IS NOT NULL ORDER BY updated_at DESC limit 0,1) AS t_score,

View File

@ -31,7 +31,7 @@
:url => {:controller => 'homework_attach',
:action => 'addjours',
:homework_id => homework_attach.id,
:cur_page => cur_page,
:page => cur_page,
:cur_type => cur_type,
:is_anonymous_comments => @is_anonymous_comments,
:is_teacher => @is_teacher

View File

@ -19,7 +19,7 @@
<% else %>
<% homework_filename = homework.name %>
<% end %>
<%= link_to homework_filename , homework_attach_path(homework,:cur_page => @cur_page,:cur_type => @cur_type), :title => homework_filename, :remote => true%>
<%= link_to homework_filename , homework_attach_path(homework,:cur_page => @cur_page,:cur_type => @cur_type,:cur_sort => @cur_sort, :cur_direction => @cur_direction), :title => homework_filename, :remote => true%>
<span class="c_grey ">
提交时间:
<%= format_time homework.created_at%>
@ -46,7 +46,7 @@
<% if is_teacher %>
<!-- 是老师,所有列表正常显示 -->
<li class="wping">
<%= link_to l(:label_work_rating),homework_attach_path(homework,:cur_page => @cur_page,:cur_type => @cur_type),:remote => true %>
<%= link_to l(:label_work_rating),homework_attach_path(homework,:cur_page => @cur_page,:cur_type => @cur_type,:cur_sort => @cur_sort, :cur_direction => @cur_direction),:remote => true %>
<% if Time.parse(bid.deadline.to_s).strftime("%Y-%m-%d") < Time.parse(homework.created_at.to_s).strftime("%Y-%m-%d") %>
<span class="c_red">&nbsp;&nbsp;迟交!</span>
<% end %>