diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index 593d6bf53..018a293e3 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -631,7 +631,7 @@ class StudentWorkController < ApplicationController unless @homework.save logger.debug @homework.errors.full_messages else - student_work = @homework.student_works.where(user_id: User.current.id).first + student_work = StudentWork.where(homework_common_id: @homework.id, user_id: User.current.id).first end end student_work diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 150d7aa83..01e08c3dd 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -348,7 +348,7 @@ class UsersController < ApplicationController @user = User.current @homework = HomeworkCommon.find(params[:homework_id]) @is_test = params[:is_test] == 'true' - @student_work = @homework.student_works.where(user_id: User.current.id).first + @student_work = StudentWork.where(homework_common_id: @homework.id, user_id: User.current.id).first if @student_work.nil? @student_work = StudentWork.new end @@ -363,7 +363,7 @@ class UsersController < ApplicationController def user_commit_homework homework = HomeworkCommon.find(params[:homework]) - student_work = homework.student_works.where(user_id: User.current.id).first + student_work = StudentWork.where(homework_common_id: homework.id, user_id: User.current.id).first if student_work student_work.save flash[:notice] = l(:notice_successful_create) diff --git a/app/views/users/_user_activities.html.erb b/app/views/users/_user_activities.html.erb index f071cbeb4..5ab315fab 100644 --- a/app/views/users/_user_activities.html.erb +++ b/app/views/users/_user_activities.html.erb @@ -62,5 +62,12 @@ <% end %> <% if user_activities.count == 10%> - <%= link_to "点击展开更多",user_activities_path(@user.id,:type => type,:page => page),:id => "show_more_activities",:remote => "true",:class => "loadMore mt10 f_grey"%> +