diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index ace4ae903..0382e7be0 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -462,14 +462,14 @@ class UsersController < ApplicationController ids = [] ids << Issue.where(id: act_ids, project_id: p_ids).map{|x| x.id} - #Bid - act_ids = activity.where(act_type: 'Bid').select('act_id').map{|x| x.act_id} - course_ids = HomeworkForCourse.where(bid_id: act_ids).select('distinct course_id').map{|x| x.course_id} + #HomeworkCommon + act_ids = activity.where(act_type: 'HomeworkCommon').select('act_id').map{|x| x.act_id} + course_ids = HomeworkCommon.where(id: act_ids).select('distinct course_id').map{|x| x.course_id} c_ids = [] Course.where(id: course_ids).each do |x| c_ids << x.id unless x.is_public !=0 && User.current.member_of_course?(x) end - ids << HomeworkForCourse.where(bid_id: act_ids, course_id: c_ids).map{|x| x.id} + ids << HomeworkCommon.where(id: act_ids, course_id: c_ids).map{|x| x.id} #Journal act_ids = activity.where(act_type: 'Journal').select('act_id').map{|x| x.act_id} diff --git a/app/models/homework_common.rb b/app/models/homework_common.rb index 925ebb106..ac10b2516 100644 --- a/app/models/homework_common.rb +++ b/app/models/homework_common.rb @@ -14,7 +14,10 @@ class HomeworkCommon < ActiveRecord::Base has_many :student_works_evaluation_distributions, :through => :student_works #一个作业的分配的匿评列表 has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy #用户活动 acts_as_attachable - + acts_as_event :title => Proc.new {|o| "#{l(:label_course_homework)} ##{o.id}: #{o.name}" }, + :description => :description, + :author => :author, + :url => Proc.new {|o| {:controller => 'student_work', :action => 'index', :homework => o.id}} after_create :act_as_activity after_destroy :delete_kindeditor_assets diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index 6083b547c..40122fba7 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -45,7 +45,7 @@ <% (Rails.logger.error "[Error] =========================================================> NameError: uninitialized constant " + e.act_type.to_s; next;) if e.act_type.safe_constantize.nil? %> <% act = e.act %> <% unless act.nil? %> - <% if e.act_type == 'JournalsForMessage' || e.act_type == 'Bid' || e.act_type == 'Journal'|| e.act_type == 'Changeset' || e.act_type == 'Message' || e.act_type == 'Principal' || e.act_type == 'News' || e.act_type == 'Issue' || e.act_type == 'Contest' %> + <% if e.act_type == 'JournalsForMessage' || e.act_type == 'HomeworkCommon' || e.act_type == 'Journal'|| e.act_type == 'Changeset' || e.act_type == 'Message' || e.act_type == 'Principal' || e.act_type == 'News' || e.act_type == 'Issue' || e.act_type == 'Contest' %> @@ -119,52 +119,28 @@
- <% when 'Bid' %> + <% when 'HomeworkCommon' %> - <% if act.reward_type == 3 && @show_course == 1 %> - <% if e.user == User.current %> - - <% else %> - + <% else %> + - <% end %> - <% else %> - <% if e.user == User.current %> - - <% else %> - - <% end %> + <%= link_to format_activity_title("#{l(:label_active_homework)}##{act.id}:#{act.name}"), student_work_index_path(:homework => e.act_id) %> + <% end %> @@ -177,7 +153,7 @@
- - <%= link_to("#{l(:label_i)}", user_path(e.user_id)) %> - + <% if e.user == User.current %> + + + <%= link_to("#{l(:label_i)}", user_path(e.user_id)) %> + <%= l(:label_i_new_activity) %> - <%= link_to format_activity_title("#{l(:label_active_homework)}##{act.id}:#{act.name}"), course_for_bid_path(e.act_id) %> - - - <%= link_to(h(e.user), user_path(e.user_id)) %> -   + <%= link_to format_activity_title("#{l(:label_active_homework)}##{act.id}:#{act.name}"), student_work_index_path(:homework => e.act_id) %> + + + <%= link_to(h(e.user), user_path(e.user_id)) %> +   <%= l(:label_new_activity) %>   - <%= link_to format_activity_title("#{l(:label_active_homework)}##{act.id}:#{act.name}"), course_for_bid_path(e.act_id) %> - - - <%= link_to("#{l(:label_i)}", user_path(e.user_id)) %> - - - <%= l(:label_i_new_activity) %> - - <%= link_to format_activity_title("#{l(:label_active_call)}##{act.id}:#{act.name}"), respond_path(e.act_id) %> - - - <%= link_to(h(e.user), user_path(e.user_id)) %> -   - - <%= l(:label_new_activity) %> -   - <%= link_to format_activity_title("#{l(:label_active_call)}##{act.id}:#{act.name}"), respond_path(e.act_id) %> -
- <%= (l(:label_update_time).to_s << ': ' << format_time(e.act.created_on)).to_s %> + <%= (l(:label_update_time).to_s << ': ' << format_time(e.act.created_at)).to_s %>