diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb index eeedbd19d..ba77d1edd 100644 --- a/app/helpers/courses_helper.rb +++ b/app/helpers/courses_helper.rb @@ -343,8 +343,7 @@ module CoursesHelper end #获取当前用户在指定作业下提交的作业的集合 def cur_user_homework_for_bid bid - cur_user_homework = HomeworkAttach.where("user_id = ? and bid_id = ?",User.current,bid.id) - cur_user_homework + bid.homeworks.where("user_id = ?",User.current) end #判断当前用户对指定作业是否已经评价过 diff --git a/app/views/bids/_bid_homework_show.html.erb b/app/views/bids/_bid_homework_show.html.erb index f098de895..bf5f700cb 100644 --- a/app/views/bids/_bid_homework_show.html.erb +++ b/app/views/bids/_bid_homework_show.html.erb @@ -23,10 +23,16 @@ <%= link_to(bid.name, course_for_bid_path(bid), :class => 'bid_path') %> - <% if(User.current.logged? && (!Member.where('user_id = ? and course_id = ?', User.current.id, bid.courses.first.id).first.nil? && (Member.where('user_id = ? and course_id = ?', User.current.id, bid.courses.first.id).first.roles&Role.where('id = ? or id = ? or id =?',5, 10, 7)).size >0)) %> + <% if User.current.logged? && is_cur_course_student(@course) %> <% cur_user_homework = cur_user_homework_for_bid(bid) %> - <% if cur_user_homework!= nil && cur_user_homework.count == 0 %> - <%= link_to l(:label_commit_homework),new_homework_attach_path(bid) %> + <% if cur_user_homework!= nil && cur_user_homework.empty? %> + <% if bid.comment_status == 0 %> + <%= link_to l(:label_commit_homework),new_exercise_book_path(bid) %> + <% else %> + + 提交作业 + + <% end %> <% else %> <%= l(:lable_has_commit_homework)%> diff --git a/app/views/layouts/base_homework.html.erb b/app/views/layouts/base_homework.html.erb index e91d0c700..65b57598a 100644 --- a/app/views/layouts/base_homework.html.erb +++ b/app/views/layouts/base_homework.html.erb @@ -79,7 +79,7 @@ - <%= link_to course.name.to_s, homework_course_path(course) if course %> + <%= link_to "返回课程主页", course_path(course) if course %> diff --git a/app/views/welcome/_course_list.html.erb b/app/views/welcome/_course_list.html.erb index 5fdd8cf3d..c33cc841e 100644 --- a/app/views/welcome/_course_list.html.erb +++ b/app/views/welcome/_course_list.html.erb @@ -5,17 +5,17 @@
- - <% unless course.is_public == 1 %> - <%= l(:label_private) %> - <% end %> - <%= link_to(course.name.truncate(30, omission: '...')+":", course_path(course.id), :class => "d-g-blue d-p-project-name", :title => "#{course.name}") %> + + <% unless course.is_public == 1 %> + <%= l(:label_private) %> + <% end %> + <%= link_to(course.name.truncate(30, omission: '...')+":", course_path(course.id), :class => "d-g-blue d-p-project-name", :title => "#{course.name}") %> - - - <%= link_to(course.try(:teacher).try(:realname), user_path(course.teacher)) %> - <%#=course.try(:teacher).try(:name)%> - + + + <%= link_to(course.try(:teacher).try(:realname), user_path(course.teacher)) %> + <%#=course.try(:teacher).try(:name)%> +
[<%= get_course_term course %>]