diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index b69aec2e1..3bbadea64 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -7,8 +7,10 @@ class StudentWorkController < ApplicationController before_filter :author_of_work, :only => [:edit, :update, :destroy] def index - @stundet_works = @homework.student_works.order("final_score desc") + @order,sort = params[:order] || "final_score",params[:sort] || "desc" + @stundet_works = @homework.student_works.order("#{@order} #{sort}") @homework_commons = @course.homework_commons.order("created_at desc") + @score = sort == "desc" ? "asc" : "desc" respond_to do |format| format.html end diff --git a/app/views/student_work/index.html.erb b/app/views/student_work/index.html.erb index be2cbbcb1..ff5da8889 100644 --- a/app/views/student_work/index.html.erb +++ b/app/views/student_work/index.html.erb @@ -46,8 +46,7 @@