diff --git a/app/controllers/exercise_controller.rb b/app/controllers/exercise_controller.rb index d1df22dff..0b1a035c1 100644 --- a/app/controllers/exercise_controller.rb +++ b/app/controllers/exercise_controller.rb @@ -13,9 +13,9 @@ class ExerciseController < ApplicationController remove_invalid_exercise(@course) @is_teacher = User.current.allowed_to?(:as_teacher,@course) if @is_teacher - exercises = @course.exercises + exercises = @course.exercises.order("created_at asc") else - exercises = @course.exercises.where(:exercise_status => 2) + exercises = @course.exercises.where(:exercise_status => 2).order("created_at asc") end @exercises = paginateHelper exercises,20 #分页 respond_to do |format| diff --git a/app/views/exercise/_exercise.html.erb b/app/views/exercise/_exercise.html.erb index 40654d327..d7a457047 100644 --- a/app/views/exercise/_exercise.html.erb +++ b/app/views/exercise/_exercise.html.erb @@ -8,7 +8,7 @@ <%# else %> <%#= link_to poll_name, exercise_path(poll.id), :class => "polls_title polls_title_w fl c_dblue" %> <%# end %> - <%= link_to exercise_name, exercise_path(exercise.id), :class => "polls_title polls_title_w fl c_dblue" %> + <%= link_to (index+1).to_s+". "+exercise_name, exercise_path(exercise.id), :class => "polls_title polls_title_w fl c_dblue" %> @@ -16,8 +16,10 @@ <% if exercise.exercise_status == 1 %>