|
|
|
@ -6,6 +6,7 @@ class TidingsController < ApplicationController
|
|
|
|
|
|
|
|
|
|
def index
|
|
|
|
|
tidings = current_user.tidings
|
|
|
|
|
@onclick_time = current_user.click_time
|
|
|
|
|
|
|
|
|
|
tiding_types =
|
|
|
|
|
case params[:type]
|
|
|
|
@ -18,11 +19,13 @@ class TidingsController < ApplicationController
|
|
|
|
|
end
|
|
|
|
|
tidings = tidings.where(tiding_type: tiding_types) if tiding_types.present?
|
|
|
|
|
|
|
|
|
|
tidings = tidings.where(container_type: 'JoinCourse') if params[:type] == 'course_apply'
|
|
|
|
|
@course_apply_count = tidings.where("created_at > '#{@onclick_time}'").where(container_type: 'JoinCourse').count
|
|
|
|
|
|
|
|
|
|
tidings = tidings.where(container_type: 'ProjectPackage') if params[:type] == 'project_package'
|
|
|
|
|
|
|
|
|
|
@count = tidings.count
|
|
|
|
|
@tidings = paginate(tidings.order(created_at: :desc), per_page: 10)
|
|
|
|
|
@onclick_time = current_user.click_time
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
private
|
|
|
|
|