diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb index 87b495f0..e65fe174 100644 --- a/app/helpers/users_helper.rb +++ b/app/helpers/users_helper.rb @@ -247,4 +247,15 @@ module UsersHelper displayed_flag = %w|index| !displayed_flag.include?(params['action']) end + + #获取指定用户的未过期的课程列表 + def user_courses_list user + result = [] + user.coursememberships.map(&:course).each do |course| + if !course_endTime_timeout?(course) + result << course + end + end + return result + end end diff --git a/app/views/users/_user_show.html.erb b/app/views/users/_user_show.html.erb index bf97ad29..0873f271 100644 --- a/app/views/users/_user_show.html.erb +++ b/app/views/users/_user_show.html.erb @@ -39,7 +39,7 @@
- <% unless user.memberships.empty? %> - <% cond = Project.visible_condition(User.current) + " AND projects.project_type = 1" %> - <% memberships = user.memberships.all(:conditions => cond) %> - <%= l(:label_x_course_contribute_to, :count => memberships.count) %> - <% for member in memberships %> - <%= link_to_project(member.project) %><%= (user.memberships.last == member) ? '' : ',' %> - <% end %> + <%# unless user.memberships.empty? %> + <%# cond = Project.visible_condition(User.current) + " AND projects.project_type = 1" %> + <%# memberships = user.memberships.all(:conditions => cond) %> + <% user_courses = user.coursememberships.map(&:course) %> + <%= l(:label_x_course_contribute_to, :count => user_courses.count) %> + <% for course in user_courses %> + <%# if course.name != nil %> + <%= link_to course.name,course_path(course) %><%= (user_courses.last == course) ? '' : ',' %> + <%# end %> <% end %> + <%# end %>
<%= user.changesets.count == 0 ? '' : "#{l(:label_x_total_commit, :count => user.changesets.count)}" %>