更新新闻viewed

This commit is contained in:
ouyangxuhua 2015-08-24 17:45:00 +08:00
parent bf596d7b4b
commit f0483b6de8
2 changed files with 18 additions and 8 deletions

View File

@ -113,12 +113,12 @@ class UsersController < ApplicationController
forge_querys = @user.forge_messages
user_querys = @user.user_feedback_messages
forum_querys = @user.memo_messages
if User.current.id == @user.id
course_querys.update_all(:viewed => true)
forge_querys.update_all(:viewed => true)
user_querys.update_all(:viewed => true)
forum_querys.update_all(:viewed => true)
end
# if User.current.id == @user.id
# course_querys.update_all(:viewed => true)
# forge_querys.update_all(:viewed => true)
# user_querys.update_all(:viewed => true)
# forum_querys.update_all(:viewed => true)
# end
@new_message_count = @user.forge_messages.count + @user.memo_messages.count + @user.course_messages.count + @user.user_feedback_messages.count
case params[:type]
when nil

View File

@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20150820025358) do
ActiveRecord::Schema.define(:version => 20150820022416) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
@ -572,6 +572,16 @@ ActiveRecord::Schema.define(:version => 20150820025358) do
t.datetime "updated_at", :null => false
end
create_table "forum_messages", :force => true do |t|
t.integer "user_id"
t.integer "forum_id"
t.integer "memo_message_id"
t.string "memo_message_type"
t.integer "viewed"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "forums", :force => true do |t|
t.string "name", :null => false
t.text "description"
@ -1307,7 +1317,6 @@ ActiveRecord::Schema.define(:version => 20150820025358) do
t.datetime "updated_at", :null => false
t.integer "late_penalty", :default => 0
t.integer "absence_penalty", :default => 0
t.integer "system_score"
end
create_table "student_works_evaluation_distributions", :force => true do |t|
@ -1525,6 +1534,7 @@ ActiveRecord::Schema.define(:version => 20150820025358) do
t.string "identity_url"
t.string "mail_notification", :default => "", :null => false
t.string "salt", :limit => 64
t.integer "gid"
end
add_index "users", ["auth_source_id"], :name => "index_users_on_auth_source_id"