Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh
This commit is contained in:
commit
a99d56b2e6
|
@ -49,6 +49,9 @@ class CommentsController < ApplicationController
|
||||||
# end
|
# end
|
||||||
# # <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ض<EFBFBD>̬<EFBFBD>ļ<EFBFBD>¼add end
|
# # <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ض<EFBFBD>̬<EFBFBD>ļ<EFBFBD>¼add end
|
||||||
flash[:notice] = l(:label_comment_added)
|
flash[:notice] = l(:label_comment_added)
|
||||||
|
user_activity = UserActivity.where("act_type='News' and act_id =#{@news.id}").first
|
||||||
|
user_activity.updated_at = @comment.created_on
|
||||||
|
user_activity.save
|
||||||
end
|
end
|
||||||
|
|
||||||
if params[:user_activity_id]
|
if params[:user_activity_id]
|
||||||
|
|
|
@ -394,6 +394,9 @@ class IssuesController < ApplicationController
|
||||||
jour.notes = params[:notes]
|
jour.notes = params[:notes]
|
||||||
jour.journalized = @issue
|
jour.journalized = @issue
|
||||||
jour.save
|
jour.save
|
||||||
|
user_activity = UserActivity.where("act_type='Issue' and act_id =#{@issue.id}").first
|
||||||
|
user_activity.updated_at = jour.created_on
|
||||||
|
user_activity.save
|
||||||
@user_activity_id = params[:user_activity_id]
|
@user_activity_id = params[:user_activity_id]
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.js
|
format.js
|
||||||
|
|
|
@ -161,6 +161,9 @@ class MessagesController < ApplicationController
|
||||||
@reply.content = @quote + @reply.content
|
@reply.content = @quote + @reply.content
|
||||||
@reply.subject = "RE: #{@topic.subject}" unless params[:reply][:subject]
|
@reply.subject = "RE: #{@topic.subject}" unless params[:reply][:subject]
|
||||||
@topic.children << @reply
|
@topic.children << @reply
|
||||||
|
user_activity = UserActivity.where("act_type='Message' and act_id =#{@topic.id}").first
|
||||||
|
user_activity.updated_at = @reply.created_on
|
||||||
|
user_activity.save
|
||||||
#@topic.update_attribute(:updated_on, Time.now)
|
#@topic.update_attribute(:updated_on, Time.now)
|
||||||
if !@reply.new_record?
|
if !@reply.new_record?
|
||||||
if params[:asset_id]
|
if params[:asset_id]
|
||||||
|
|
|
@ -853,24 +853,24 @@ class UsersController < ApplicationController
|
||||||
if params[:type].present?
|
if params[:type].present?
|
||||||
case params[:type]
|
case params[:type]
|
||||||
when "course_homework"
|
when "course_homework"
|
||||||
@user_activities = UserActivity.where("container_type = 'Course' and container_id in #{user_course_ids} and act_type = 'HomeworkCommon'").order('created_at desc').limit(10).offset(@page * 10)
|
@user_activities = UserActivity.where("container_type = 'Course' and container_id in #{user_course_ids} and act_type = 'HomeworkCommon'").order('updated_at desc').limit(10).offset(@page * 10)
|
||||||
when "course_news"
|
when "course_news"
|
||||||
@user_activities = UserActivity.where("container_type = 'Course' and container_id in #{user_course_ids} and act_type = 'News'").order('created_at desc').limit(10).offset(@page * 10)
|
@user_activities = UserActivity.where("container_type = 'Course' and container_id in #{user_course_ids} and act_type = 'News'").order('updated_at desc').limit(10).offset(@page * 10)
|
||||||
when "course_message"
|
when "course_message"
|
||||||
@user_activities = UserActivity.where("container_type = 'Course' and container_id in #{user_course_ids} and act_type = 'Message'").order('created_at desc').limit(10).offset(@page * 10)
|
@user_activities = UserActivity.where("container_type = 'Course' and container_id in #{user_course_ids} and act_type = 'Message'").order('updated_at desc').limit(10).offset(@page * 10)
|
||||||
when "course_poll"
|
when "course_poll"
|
||||||
@user_activities = UserActivity.where("container_type = 'Course' and container_id in #{user_course_ids} and act_type = 'Poll'").order('created_at desc').limit(10).offset(@page * 10)
|
@user_activities = UserActivity.where("container_type = 'Course' and container_id in #{user_course_ids} and act_type = 'Poll'").order('updated_at desc').limit(10).offset(@page * 10)
|
||||||
when "project_issue"
|
when "project_issue"
|
||||||
@user_activities = UserActivity.where("container_type = 'Project' and container_id in #{user_project_ids} and act_type = 'Issue'").order('created_at desc').limit(10).offset(@page * 10)
|
@user_activities = UserActivity.where("container_type = 'Project' and container_id in #{user_project_ids} and act_type = 'Issue'").order('updated_at desc').limit(10).offset(@page * 10)
|
||||||
when "project_message"
|
when "project_message"
|
||||||
@user_activities = UserActivity.where("container_type = 'Project' and container_id in #{user_project_ids} and act_type = 'Message'").order('created_at desc').limit(10).offset(@page * 10)
|
@user_activities = UserActivity.where("container_type = 'Project' and container_id in #{user_project_ids} and act_type = 'Message'").order('updated_at desc').limit(10).offset(@page * 10)
|
||||||
when "current_user"
|
when "current_user"
|
||||||
@user_activities = UserActivity.where("user_id = #{@user.id} and ((container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}))").order('created_at desc').limit(10).offset(@page * 10)
|
@user_activities = UserActivity.where("user_id = #{@user.id} and ((container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}))").order('updated_at desc').limit(10).offset(@page * 10)
|
||||||
else
|
else
|
||||||
@user_activities = UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types})").order('created_at desc').limit(10).offset(@page * 10)
|
@user_activities = UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types})").order('updated_at desc').limit(10).offset(@page * 10)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
@user_activities = UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types})").order('created_at desc').limit(10).offset(@page * 10)
|
@user_activities = UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types})").order('updated_at desc').limit(10).offset(@page * 10)
|
||||||
end
|
end
|
||||||
# @user_activities = paginateHelper @user_activities,500
|
# @user_activities = paginateHelper @user_activities,500
|
||||||
@type = params[:type]
|
@type = params[:type]
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
.ke-inline-block{display: none;}
|
.ke-inline-block{display: none;}
|
||||||
div.ke-container{float:left;}
|
div.ke-container{float:left;}
|
||||||
</style>
|
</style>
|
||||||
<% first_user_activity = user_activities.first.id %>
|
<% first_user_activity = user_activities.first.id unless user_activities.first.nil? %>
|
||||||
<% user_activities.each do |user_activity|
|
<% user_activities.each do |user_activity|
|
||||||
if user_activities %>
|
if user_activities %>
|
||||||
<script>
|
<script>
|
||||||
|
@ -31,10 +31,10 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function expand_reply_input(id) {
|
function expand_reply_input(id) {
|
||||||
$(id).toggle();
|
$(id).toggle();
|
||||||
}
|
}
|
||||||
|
|
||||||
$(function() {
|
$(function() {
|
||||||
init_KindEditor_data(<%= user_activity.id%>,"30px","85%");
|
init_KindEditor_data(<%= user_activity.id%>,"30px","85%");
|
||||||
});
|
});
|
||||||
|
@ -45,22 +45,22 @@
|
||||||
<% if act %>
|
<% if act %>
|
||||||
<% case user_activity.act_type.to_s %>
|
<% case user_activity.act_type.to_s %>
|
||||||
<% when 'HomeworkCommon' %>
|
<% when 'HomeworkCommon' %>
|
||||||
<%= render :partial => 'course_homework', :locals => {:activity => act,:user_activity_id =>user_activity.id,:first_user_activity =>first_user_activity,:page => page} %>
|
<%= render :partial => 'course_homework', :locals => {:activity => act,:user_activity_id =>user_activity.id,:first_user_activity =>first_user_activity,:page => page} %>
|
||||||
<% when 'News' %>
|
<% when 'News' %>
|
||||||
<%= render :partial => 'course_news', :locals => {:activity => act,:user_activity_id =>user_activity.id,:first_user_activity =>first_user_activity,:page => page} %>
|
<%= render :partial => 'course_news', :locals => {:activity => act,:user_activity_id =>user_activity.id,:first_user_activity =>first_user_activity,:page => page} %>
|
||||||
<% when 'Message'%>
|
<% when 'Message'%>
|
||||||
<%= render :partial => 'course_message', :locals => {:activity => act,:user_activity_id =>user_activity.id,:first_user_activity =>first_user_activity,:page => page} %>
|
<%= render :partial => 'course_message', :locals => {:activity => act,:user_activity_id =>user_activity.id,:first_user_activity =>first_user_activity,:page => page} %>
|
||||||
<% when 'Poll' %>
|
<% when 'Poll' %>
|
||||||
<%= render :partial => 'course_poll', :locals => {:activity => act, :user_activity_id => user_activity.id,:first_user_activity =>first_user_activity,:page => page} %>
|
<%= render :partial => 'course_poll', :locals => {:activity => act, :user_activity_id => user_activity.id,:first_user_activity =>first_user_activity,:page => page} %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% when 'Project' %>
|
<% when 'Project' %>
|
||||||
<% if act %>
|
<% if act %>
|
||||||
<% case user_activity.act_type.to_s %>
|
<% case user_activity.act_type.to_s %>
|
||||||
<% when 'Issue' %>
|
<% when 'Issue' %>
|
||||||
<%= render :partial => 'project_issue', :locals => {:activity => act,:user_activity_id =>user_activity.id,:first_user_activity =>first_user_activity,:page => page} %>
|
<%= render :partial => 'project_issue', :locals => {:activity => act,:user_activity_id =>user_activity.id,:first_user_activity =>first_user_activity,:page => page} %>
|
||||||
<% when 'Message' %>
|
<% when 'Message' %>
|
||||||
<%= render :partial => 'project_message', :locals => {:activity => act,:user_activity_id =>user_activity.id,:first_user_activity =>first_user_activity,:page => page} %>
|
<%= render :partial => 'project_message', :locals => {:activity => act,:user_activity_id =>user_activity.id,:first_user_activity =>first_user_activity,:page => page} %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
class UpdateUserActivitiesUpdateAt < ActiveRecord::Migration
|
||||||
|
def up
|
||||||
|
count = UserActivity.all.count / 30 + 2
|
||||||
|
transaction do
|
||||||
|
for i in 1 ... count do i
|
||||||
|
UserActivity.page(i).per(30).each do |activity|
|
||||||
|
activity.updated_at = activity.created_at
|
||||||
|
activity.save
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
end
|
||||||
|
end
|
43
db/schema.rb
43
db/schema.rb
|
@ -11,7 +11,7 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended to check this file into your version control system.
|
# It's strongly recommended to check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(:version => 20150911064528) do
|
ActiveRecord::Schema.define(:version => 20150917071652) do
|
||||||
|
|
||||||
create_table "activities", :force => true do |t|
|
create_table "activities", :force => true do |t|
|
||||||
t.integer "act_id", :null => false
|
t.integer "act_id", :null => false
|
||||||
|
@ -476,13 +476,6 @@ ActiveRecord::Schema.define(:version => 20150911064528) do
|
||||||
|
|
||||||
add_index "delayed_jobs", ["priority", "run_at"], :name => "delayed_jobs_priority"
|
add_index "delayed_jobs", ["priority", "run_at"], :name => "delayed_jobs_priority"
|
||||||
|
|
||||||
create_table "discuss_demos", :force => true do |t|
|
|
||||||
t.string "title"
|
|
||||||
t.text "body"
|
|
||||||
t.datetime "created_at", :null => false
|
|
||||||
t.datetime "updated_at", :null => false
|
|
||||||
end
|
|
||||||
|
|
||||||
create_table "documents", :force => true do |t|
|
create_table "documents", :force => true do |t|
|
||||||
t.integer "project_id", :default => 0, :null => false
|
t.integer "project_id", :default => 0, :null => false
|
||||||
t.integer "category_id", :default => 0, :null => false
|
t.integer "category_id", :default => 0, :null => false
|
||||||
|
@ -497,26 +490,23 @@ ActiveRecord::Schema.define(:version => 20150911064528) do
|
||||||
add_index "documents", ["created_on"], :name => "index_documents_on_created_on"
|
add_index "documents", ["created_on"], :name => "index_documents_on_created_on"
|
||||||
add_index "documents", ["project_id"], :name => "documents_project_id"
|
add_index "documents", ["project_id"], :name => "documents_project_id"
|
||||||
|
|
||||||
create_table "dts", :primary_key => "Num", :force => true do |t|
|
create_table "dts", :force => true do |t|
|
||||||
t.string "Defect", :limit => 50
|
t.string "IPLineCode"
|
||||||
t.string "Category", :limit => 50
|
|
||||||
t.string "File"
|
|
||||||
t.string "Method"
|
|
||||||
t.string "Module", :limit => 20
|
|
||||||
t.string "Variable", :limit => 50
|
|
||||||
t.integer "StartLine"
|
|
||||||
t.integer "IPLine"
|
|
||||||
t.string "IPLineCode", :limit => 200
|
|
||||||
t.string "Judge", :limit => 15
|
|
||||||
t.integer "Review", :limit => 1
|
|
||||||
t.string "Description"
|
t.string "Description"
|
||||||
t.text "PreConditions", :limit => 2147483647
|
t.string "Num"
|
||||||
t.text "TraceInfo", :limit => 2147483647
|
t.string "Variable"
|
||||||
t.text "Code", :limit => 2147483647
|
t.string "TraceInfo"
|
||||||
|
t.string "Method"
|
||||||
|
t.string "File"
|
||||||
|
t.string "IPLine"
|
||||||
|
t.string "Review"
|
||||||
|
t.string "Category"
|
||||||
|
t.string "Defect"
|
||||||
|
t.string "PreConditions"
|
||||||
|
t.string "StartLine"
|
||||||
t.integer "project_id"
|
t.integer "project_id"
|
||||||
t.datetime "created_at"
|
t.datetime "created_at", :null => false
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at", :null => false
|
||||||
t.integer "id", :null => false
|
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "enabled_modules", :force => true do |t|
|
create_table "enabled_modules", :force => true do |t|
|
||||||
|
@ -916,6 +906,7 @@ ActiveRecord::Schema.define(:version => 20150911064528) do
|
||||||
t.datetime "created_on"
|
t.datetime "created_on"
|
||||||
t.integer "comments_count", :default => 0, :null => false
|
t.integer "comments_count", :default => 0, :null => false
|
||||||
t.integer "course_id"
|
t.integer "course_id"
|
||||||
|
t.datetime "updated_on"
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "news", ["author_id"], :name => "index_news_on_author_id"
|
add_index "news", ["author_id"], :name => "index_news_on_author_id"
|
||||||
|
|
Loading…
Reference in New Issue