Merge branch 'weixin_guange' into develop

This commit is contained in:
yuanke 2016-10-13 14:23:52 +08:00
commit 1afa774fa9
40 changed files with 439 additions and 562 deletions

View File

@ -112,7 +112,7 @@ module Mobile
# end
if reply_type == nil || reply_type == 0
homework_common = HomeworkCommon.find(params[:id])
feedback = HomeworkCommon.add_homework_jour(current_user, params[:content], params[:id])
feedback = HomeworkCommon.add_homework_jour(current_user, params[:content], params[:id], params[:id])
if (feedback.errors.empty?)
homework_common.update_column(:updated_at, Time.now)
result = 2
@ -124,7 +124,7 @@ module Mobile
homework_common = HomeworkCommon.find reply.jour_id
options = {:notes => params[:content], :reply_id => reply.user_id,:user_id => current_user.id,:m_parent_id => params[:id].to_i,:m_reply_id => params[:id].to_i}
feedback = HomeworkCommon.add_homework_jour(current_user, params[:content], reply.jour_id, options)
feedback = HomeworkCommon.add_homework_jour(current_user, params[:content], reply.jour_id, reply.jour_id, options)
if (feedback.errors.empty?)
homework_common.update_column(:updated_at, Time.now)
result = 2
@ -189,6 +189,7 @@ module Mobile
reply.content = params[:content]
reply.parent_id = params[:id]
reply.subject = "RE: #{topic.subject}"
reply.root_id = topic.id
if message.children << reply
result = 2
update_id = topic.id
@ -224,6 +225,7 @@ module Mobile
:m_parent_id => parent_id,
:m_reply_id => reply_id,
:reply_id => reply_user_id,
:root_id => jour.id,
:notes => content,
:is_readed => false}
jfm = jour.user.add_jour(nil, nil, nil, options)
@ -278,6 +280,7 @@ module Mobile
blogComment.blog = blog.blog
blogComment.content = params[:content]
blogComment.title = "RE: #{blog.title}"
blogComment.root_id = blog.id
if blog.children << blogComment
result = 2
update_id = blog.id
@ -293,6 +296,7 @@ module Mobile
parent = BlogComment.find params[:id]
blogComment.parent_id = params[:id] #被回复的回复
blogComment.reply_id = parent.author.id #被回复者id
blogComment.root_id = blog.id
if parent.children << blogComment
result = 2

View File

@ -25,8 +25,10 @@ module Mobile
elsif ac.act_type == "News"
ac.nil? || ac.act.nil? ? 0 : ac.act.comments.count
elsif ac.act_type == "Message" || ac.act_type == "BlogComment" || ac.act_type == "JournalsForMessage"
all_comments = []
ac.nil? || ac.act.nil? ? 0 : get_all_children(all_comments, ac.act).count
className = ac.act_type.classify.constantize
# all_comments = []
# ac.nil? || ac.act.nil? ? 0 : get_all_children(all_comments, ac.act).count
ac.nil? || ac.act.nil? ? 0 : className.where("root_id = #{ac.act.id}").count
elsif ac.act_type == "Issue"
ac.nil? || ac.act.nil? ? 0 : ac.act.journals.where("notes is not null and notes != ''").count
end

View File

@ -145,10 +145,12 @@ class BlogCommentsController < ApplicationController
@blogComment.content = params[:blog_comment][:content]
parent = BlogComment.find params[:parent_id]
@blogComment.reply_id = params[:id]
@blogComment.root_id = parent.root_id.nil? ? parent.id : parent.root_id
parent.children << @blogComment
else
@quote = params[:quote][:quote] || ""
@blogComment.content = @quote + @blogComment.content
@blogComment.root_id = @article.id
@article.children << @blogComment
end
@article.save

View File

@ -126,7 +126,8 @@ class BoardsController < ApplicationController
@type = 2
@topics.each do |topic|
all_comments = []
count=get_all_children(all_comments, topic).count
#count=get_all_children(all_comments, topic).count
count=Message.where("root_id = #{topic.id}").count
topic[:infocount] = get_praise_num(topic) + count
if topic[:infocount] < 0
topic[:infocount] = 0

View File

@ -45,7 +45,7 @@ class MessagesController < ApplicationController
# page = 1 + offset / REPLIES_PER_PAGE
# end
all_comments = []
@replies = get_all_children(all_comments, @topic)
@replies = Message.where("root_id = #{@topic.id}").reorder("created_on desc")
@reply_count = @replies.count
@page = params[:page] ? params[:page].to_i + 1 : 0
@limit = 10
@ -165,6 +165,7 @@ class MessagesController < ApplicationController
@reply.content = params[:content]
@reply.subject = "RE: #{@topic.subject}"
@reply.reply_id = params[:id]
@reply.root_id = parent.root_id.nil? ? parent.id : parent.root_id
# @reply.reply_id = params[:id]
parent.children << @reply
@user_activity_id = params[:user_activity_id] if params[:user_activity_id]
@ -178,6 +179,7 @@ class MessagesController < ApplicationController
@reply.safe_attributes = params[:reply]
@reply.content = @quote + @reply.content
@reply.subject = "RE: #{@topic.subject}" unless params[:reply][:subject]
@reply.root_id = @topic.id
@topic.children << @reply
# @reply.reply_id = params[:id]
end

View File

@ -89,6 +89,7 @@ class OrgDocumentCommentsController < ApplicationController
@act = OrgActivity.find(params[:act_id])
@comment = OrgDocumentComment.new(:organization_id => @document.organization_id, :creator_id => User.current.id, :reply_id => params[:id])
@comment.content = params[:org_content]
@comment.root_id = @document.id
@document.children << @comment
@document.save
end
@ -102,6 +103,7 @@ class OrgDocumentCommentsController < ApplicationController
@comment.content = params[:org_comment][:org_content]
end
@comment.root_id = @document.id
@document.children << @comment
@document.save
respond_to do |format|
@ -161,6 +163,7 @@ class OrgDocumentCommentsController < ApplicationController
@org_document.title = params[:org_document_comment][:title]
@org_document.content = params[:org_document_comment][:content]
@org_document.root_id = @document.root_id.nil? ? @document.id : @document.root_id
@document.children << @org_document
@document = @document.root

View File

@ -3524,19 +3524,19 @@ class UsersController < ApplicationController
if params[:type].present?
case params[:type]
when 'OrgDocumentComment'
obj = OrgDocumentComment.where('id = ?', params[:id].to_i).first
#obj = OrgDocumentComment.where('id = ?', params[:id].to_i).first
@user_activity_id = params[:div_id].to_i if params[:div_id]
@type = 'OrgDocumentComment'
comments = []
@journals = get_all_children(comments, obj)
#comments = []
@journals = OrgDocumentComment.where("root_id = #{params[:id].to_i}").reorder("created_at desc")
when 'Message'
obj = Message.where('id = ?', params[:id].to_i).first
#obj = Message.where('id = ?', params[:id].to_i).first
@type = 'Message'
@is_course = params[:is_course]
@is_board = params[:is_board]
@user_activity_id = params[:div_id].to_i if params[:div_id]
comments = []
@journals = get_all_children(comments, obj)
#comments = []
@journals = Message.where("root_id = #{params[:id].to_i}").reorder("created_on desc")
when 'News'
obj = News.where('id = ?', params[:id].to_i).first
@journals = obj.comments.reorder("created_on desc")
@ -3548,9 +3548,9 @@ class UsersController < ApplicationController
@type = 'Syllabus'
@user_activity_id = params[:div_id].to_i if params[:div_id]
when 'JournalsForMessage'
obj = JournalsForMessage.where('id = ?', params[:id].to_i).first
journals = []
@journals = get_all_children(journals, obj)
#obj = JournalsForMessage.where('id = ?', params[:id].to_i).first
#journals = []
@journals = JournalsForMessage.where("root_id = #{params[:id].to_i}").reorder("created_on desc")
@type = 'JournalsForMessage'
@user_activity_id = params[:div_id].to_i if params[:div_id]
when 'Issue'
@ -3559,13 +3559,13 @@ class UsersController < ApplicationController
@type = 'Issue'
@user_activity_id = params[:div_id].to_i if params[:div_id]
when 'BlogComment'
obj = BlogComment.where('id = ?', params[:id].to_i).first
#obj = BlogComment.where('id = ?', params[:id].to_i).first
@user_activity_id = params[:div_id].to_i if params[:div_id]
@homepage = params[:homepage].to_i
@type = 'BlogComment'
@user_id = obj.author_id
comments = []
@journals = get_all_children(comments, obj)
#comments = []
@journals = BlogComment.where("root_id = #{params[:id].to_i}").reorder("created_on desc")
when 'HomeworkCommon'
obj = HomeworkCommon.where('id = ?', params[:id].to_i).first
@type = 'HomeworkCommon'

View File

@ -153,72 +153,10 @@ class WelcomeController < ApplicationController
def search
@name = params[:q]
@search_type = params[:search_type]
case params[:search_type]
when 'all'
@alls = Elasticsearch::Model.search({
query: {
multi_match: {
query: @name,
type:"most_fields",
operator: "or",
fields: ['login', 'firstname','lastname','name','description^0.5','filename','subject','content^0.5']
}
},
highlight: {
pre_tags: ['<span class="c_red">'],
post_tags: ['</span>'],
fields: {
login: {},
firstname: {},
lastname: {},
name:{},
description:{},
filename:{},
subject:{},
content:{}
}
}
},[User,Course,Attachment,Project,Memo] ).page(params[:page] || 1).per(20).results
when 'user'
@users = User.search(@name).page(params[:page] || 1).per(20)
when 'project'
@projects = Project.search(@name).page(params[:page] || 1).per(20).results
when 'course'
@courses = Course.search(@name).page(params[:page] || 1).per(20).results
when 'attachment'
@attachments = Attachment.search(@name).page(params[:page] || 1).per(20).results
when 'memo'
@memos = Memo.search(@name).page(params[:page] || 1).per(20).results
else
@alls = Elasticsearch::Model.search({
query: {
multi_match: {
query: @name,
type:"most_fields",
operator: "or",
fields: ['login', 'firstname','lastname','name','description^0.5','filename','subject','content^0.5']
}
},
highlight: {
pre_tags: ['<span class="c_red">'],
post_tags: ['</span>'],
fields: {
login: {},
firstname: {},
lastname: {},
name:{},
description:{},
filename:{},
subject:{},
content:{}
}
}
},[User,Course,Attachment,Project,Memo] ).page(params[:page] || 1).per(20).results
end
page = (params[:page] || 1).to_i
@users_count = User.search(@name).results.total
@syllabus_count = Syllabus.search(@name).results.total
@course_count = Course.search(@name).results.total
@attach_count = Attachment.search(@name).results.total
@project_count = Project.search(@name).results.total
@ -229,7 +167,7 @@ class WelcomeController < ApplicationController
query: @name,
type:"most_fields",
operator: "or",
fields: ['login', 'firstname','lastname','name','description^0.5','filename','subject','content^0.5']
fields: ['login', 'firstname','lastname','title','name','description^0.5','filename','subject','content^0.5']
}
},
highlight: {
@ -239,6 +177,7 @@ class WelcomeController < ApplicationController
login: {},
firstname: {},
lastname: {},
title:{},
name:{},
description:{},
filename:{},
@ -246,7 +185,110 @@ class WelcomeController < ApplicationController
content:{}
}
}
},[User,Course,Attachment,Project,Memo] ).results.total
},[User,Syllabus,Course,Attachment,Project,Memo] ).results.total
case params[:search_type]
when 'all'
if (page-1)*20 >= @total_count
page = 1
params[:page] = "1"
end
@alls = Elasticsearch::Model.search({
query: {
multi_match: {
query: @name,
type:"most_fields",
operator: "or",
fields: ['login', 'firstname','lastname','title','name','description^0.5','filename','subject','content^0.5']
}
},
highlight: {
pre_tags: ['<span class="c_red">'],
post_tags: ['</span>'],
fields: {
login: {},
firstname: {},
lastname: {},
title:{},
name:{},
description:{},
filename:{},
subject:{},
content:{}
}
}
},[User,Syllabus,Course,Attachment,Project,Memo] ).page(page).per(20).results
when 'user'
if (page-1)*20 >= @users_count
page = 1
params[:page] = "1"
end
@users = User.search(@name).page(page).per(20)
when 'syllabus'
if (page-1)*20 >= @syllabus_count
page = 1
params[:page] = "1"
end
@syllabuses = Syllabus.search(@name).page(page).per(20).results
when 'project'
if (page-1)*20 >= @project_count
page = 1
end
@projects = Project.search(@name).page(page).per(20).results
when 'course'
if (page-1)*20 >= @course_count
page = 1
params[:page] = "1"
end
@courses = Course.search(@name).page(page).per(20).results
when 'attachment'
if (page-1)*20 >= @attach_count
page = 1
params[:page] = "1"
end
@attachments = Attachment.search(@name).page(page).per(20).results
when 'memo'
if (page-1)*20 >= @memo_count
page = 1
params[:page] = "1"
end
@memos = Memo.search(@name).page(page).per(20).results
else
if (page-1)*20 >= @total_count
page = 1
params[:page] = "1"
end
@alls = Elasticsearch::Model.search({
query: {
multi_match: {
query: @name,
type:"most_fields",
operator: "or",
fields: ['login', 'firstname','lastname','title','name','description^0.5','filename','subject','content^0.5']
}
},
highlight: {
pre_tags: ['<span class="c_red">'],
post_tags: ['</span>'],
fields: {
login: {},
firstname: {},
lastname: {},
title:{},
name:{},
description:{},
filename:{},
subject:{},
content:{}
}
}
},[User,Syllabus,Course,Attachment,Project,Memo] ).page(page).per(20).results
end
# search_type = params[:search_type].to_sym unless search_condition.blank?
# search_by = params[:search_by]
#

View File

@ -41,6 +41,7 @@ class WordsController < ApplicationController
# 删除留言功能要调用destroy也记得在destroy.js中修改
# deny api. api useless
parent = JournalsForMessage.find params[:reference_id].to_i
parent_id = params[:reference_id]
author_id = User.current.id
reply_user_id = params[:reference_user_id]
@ -53,6 +54,7 @@ class WordsController < ApplicationController
:m_reply_id => reply_id,
:reply_id => reply_user_id,
:notes => content,
:root_id => parent.root_id.nil? ? parent.id : parent.root_id,
:is_readed => false}
@activity = params[:activity_id].nil? ? JournalsForMessage.find(parent_id) : JournalsForMessage.find(params[:activity_id].to_i)
@jfm = add_reply_adapter(@activity, options)
@ -274,7 +276,7 @@ class WordsController < ApplicationController
@user = User.current
@syllabus = Syllabus.find(params[:id]);
if params[:comment].size>0 && User.current.logged? && @user
feedback = Syllabus.add_syllabus_jour(@user, params[:comment], params[:id])
feedback = Syllabus.add_syllabus_jour(@user, params[:comment], params[:id], @syllabus.id)
if (feedback.errors.empty?)
if params[:asset_id]
ids = params[:asset_id].split(',')
@ -296,7 +298,7 @@ class WordsController < ApplicationController
@user = User.current
@homework_common = HomeworkCommon.find(params[:id]);
if params[:homework_message].size>0 && User.current.logged? && @user
feedback = HomeworkCommon.add_homework_jour(@user, params[:homework_message], params[:id])
feedback = HomeworkCommon.add_homework_jour(@user, params[:homework_message], params[:id], @homework_common.id)
if (feedback.errors.empty?)
if params[:asset_id]
ids = params[:asset_id].split(',')
@ -329,7 +331,7 @@ class WordsController < ApplicationController
reply = JournalsForMessage.find params[:id].to_i
@homework_common = HomeworkCommon.find reply.jour_id
if params[:reply_message].size>0 && User.current.logged? && @user
options = {:notes => params[:reply_message], :reply_id => reply.user_id,:user_id => @user.id,:m_parent_id => params[:id].to_i,:m_reply_id => params[:id].to_i}
options = {:notes => params[:reply_message], :reply_id => reply.user_id,:user_id => @user.id,:m_parent_id => params[:id].to_i,:m_reply_id => params[:id].to_i, :root_id => reply.root_id}
feedback = HomeworkCommon.add_homework_jour(@user, params[:reply_message], reply.jour_id, options)
if (feedback.errors.empty?)
if params[:asset_id]
@ -363,7 +365,7 @@ class WordsController < ApplicationController
reply = JournalsForMessage.find params[:id].to_i
@syllabus = Syllabus.find reply.jour_id
if params[:reply_message].size>0 && User.current.logged? && @user
options = {:notes => params[:reply_message], :reply_id => reply.user_id,:user_id => @user.id,:m_parent_id => params[:id].to_i,:m_reply_id => params[:id].to_i}
options = {:notes => params[:reply_message], :reply_id => reply.user_id,:user_id => @user.id,:m_parent_id => params[:id].to_i,:m_reply_id => params[:id].to_i, :root_id => reply.root_id}
feedback = Syllabus.add_syllabus_jour(@user, params[:reply_message], reply.jour_id, options)
if (feedback.errors.empty?)
if params[:asset_id]

View File

@ -19,7 +19,7 @@ class BlogComment < ActiveRecord::Base
validates_presence_of :title, :content
validates_length_of :title, :maximum => 255
#validate :cannot_reply_to_locked_comment, :on => :create
safe_attributes 'title', 'content',"sticky", "locked"
safe_attributes 'title', 'content',"sticky", "locked", "root_id"
after_save :add_user_activity
after_update :update_activity

View File

@ -113,10 +113,10 @@ class HomeworkCommon < ActiveRecord::Base
end
###添加回复
def self.add_homework_jour(user, notes, id , options = {})
def self.add_homework_jour(user, notes, id, root_id, options = {})
homework = HomeworkCommon.find(id)
if options.count == 0
jfm = homework.journals_for_messages.build(:user_id => user.id, :notes => notes, :reply_id => 0)
jfm = homework.journals_for_messages.build(:user_id => user.id, :notes => notes, :reply_id => 0, :root_id => root_id)
else
jfm = homework.journals_for_messages.build(options)
end

View File

@ -19,7 +19,8 @@ class JournalsForMessage < ActiveRecord::Base
"m_reply_count", # 留言的回复数量
"m_reply_id" , # 回复某留言的留言id(a留言回复了b留言这是b留言的id)
"is_comprehensive_evaluation", # 1 教师评论、2 匿评、3 留言
"private"
"private",
"root_id"
acts_as_tree :foreign_key => 'm_parent_id', :counter_cache => :m_reply_count, :order => "#{JournalsForMessage.table_name}.created_on ASC"
after_destroy :delete_kindeditor_assets
belongs_to :project,

View File

@ -96,7 +96,7 @@ class Message < ActiveRecord::Base
}
safe_attributes 'subject', 'content', 'reply_id'
safe_attributes 'subject', 'content', 'reply_id', 'root_id'
safe_attributes 'board_id','locked', 'sticky',
:if => lambda {|message, user|
if message.project

View File

@ -1,6 +1,6 @@
class OrgDocumentComment < ActiveRecord::Base
# status: 1 模式二中置顶 0模式二中正常显示
attr_accessible :content, :creator_id, :organization_id, :parent_id, :reply_id, :title, :sticky, :locked, :status
attr_accessible :content, :creator_id, :organization_id, :parent_id, :reply_id, :title, :sticky, :locked, :status, :root_id
include Redmine::SafeAttributes
include ApplicationHelper
belongs_to :organization

View File

@ -2,6 +2,18 @@
class Syllabus < ActiveRecord::Base
include Redmine::SafeAttributes
include ApplicationHelper
#elasticsearch
include Elasticsearch::Model
#elasticsearch kaminari init
Kaminari::Hooks.init
Elasticsearch::Model::Response::Response.__send__ :include, Elasticsearch::Model::Response::Pagination::Kaminari
settings index: { number_of_shards: 5 } do
mappings dynamic: 'false' do
indexes :title, analyzer: 'smartcn',index_options: 'offsets'
indexes :description, analyzer: 'smartcn',index_options: 'offsets'
indexes :updated_at, index:"not_analyzed", type:'date'
end
end
acts_as_taggable
acts_as_attachable
has_many_kindeditor_assets :assets, :dependent => :destroy
@ -17,6 +29,12 @@ class Syllabus < ActiveRecord::Base
validates :title, :user_id, presence: true
after_update :update_syllabus_ealasticsearch_index
after_create :create_syllabus_ealasticsearch_index
before_destroy :delete_syllabus_ealasticsearch_index
scope :indexable,lambda { where(nil) }#用于elastic建索引的scope
scope :like, lambda {|arg|
if arg.blank?
where(nil)
@ -47,14 +65,65 @@ class Syllabus < ActiveRecord::Base
end
###添加回复
def self.add_syllabus_jour(user, notes, id , options = {})
def self.add_syllabus_jour(user, notes, id, root_id, options = {})
syllabus = Syllabus.find(id)
if options.count == 0
jfm = syllabus.journals_for_messages.build(:user_id => user.id, :notes => notes, :reply_id => 0)
jfm = syllabus.journals_for_messages.build(:user_id => user.id, :notes => notes, :reply_id => 0, :root_id => root_id)
else
jfm = syllabus.journals_for_messages.build(options)
end
jfm.save
jfm
end
def create_syllabus_ealasticsearch_index
return if Rails.env.development?
self.__elasticsearch__.index_document
end
def update_syllabus_ealasticsearch_index
return if Rails.env.development?
begin
self.__elasticsearch__.update_document
rescue => e
self.__elasticsearch__.index_document
end
end
def delete_syllabus_ealasticsearch_index
return if Rails.env.development?
begin
self.__elasticsearch__.delete_document
rescue => e
end
end
def self.search(query)
__elasticsearch__.search(
{
query: {
multi_match: {
query: query,
type:"most_fields",
operator: "or",
fields: ['title']
}
},
sort: {
_score:{order: "desc" },
updated_at:{order:"desc"}
},
highlight: {
pre_tags: ['<span class="c_red">'],
post_tags: ['</span>'],
fields: {
title: {},
description: {}
}
}
}
)
end
end

View File

@ -431,6 +431,12 @@ class User < Principal
name = lastname + firstname
name.empty? || name.nil? ? login : name
end
def show_occupation
if self.user_extensions && self.user_extensions.school
self.user_extensions.school.name
end
end
## end
def get_at_show_name

View File

@ -106,7 +106,7 @@
</div>
<div class="cl"></div>
<% all_comments = []%>
<% all_replies = get_all_children(all_comments, @article) %>
<% all_replies = BlogComment.where("root_id = #{@article.id}").reorder("created_on desc") %>
<% count= all_replies.count %>
<div class="homepagePostReply">
<div class="homepagePostReplyBanner">

View File

@ -36,12 +36,8 @@
<% end %>
<div class="cl"></div>
</li>
<% count=0 %>
<% if activity.parent %>
<% count=activity.parent.children.count%>
<% else %>
<% count=activity.children.count%>
<% end %>
<% count=BlogComment.where("root_id = #{activity.id}").count%>
<li class="ml15">
<span class="grayTxt">发布:<%= format_time(activity.created_on) %></span>
<span class="grayTxt">更新:<%= format_time(activity.updated_on) %></span>

View File

@ -46,7 +46,7 @@
<div class="cl"></div>
</div>
<% all_comments = []%>
<% all_repies = get_all_children(all_comments, activity) %>
<% all_repies = BlogComment.where("root_id = #{activity.id}").reorder("created_on desc") %>
<% count = all_repies.count %>
<div class="homepagePostReply">
<%= render :partial => 'users/reply_banner', :locals => {:count => count, :activity => activity, :user_activity_id => user_activity_id, :homepage => 1} %>

View File

@ -51,7 +51,7 @@
<% name = name%>
<%= form_tag({controller: :welcome, action: :search },:class=>'navHomepageSearchBox', method: :get) do %>
<input type="text" name="q" value="<%= name.nil? ? "" : name%>" id="navHomepageSearchInput" class="navHomepageSearchInput" placeholder="请输入关键词搜索公开的班级、项目、用户、资源以及帖子"/>
<input type="text" name="q" value="<%= name.nil? ? "" : name%>" id="navHomepageSearchInput" class="navHomepageSearchInput" placeholder="请输入关键词搜索公开的课程、班级、项目、用户、资源以及帖子"/>
<input type="hidden" name="search_type" id="type" value="all"/>
<input type="text" style="display: none;"/>
<a href="javascript:void(0);" class="homepageSearchIcon" onclick="search_in_header($(this));"></a>

View File

@ -75,7 +75,7 @@
</div>
</div>
<% all_comments = []%>
<% all_replies = get_all_children(all_comments, @document) %>
<% all_replies = OrgDocumentComment.where("root_id = #{@document.id}").reorder("created_at desc") %>
<% count = all_replies.count %>
<div class="homepagePostReply fl" style="background-color: #f1f1f1;" id="<%= @document.id %>">

View File

@ -70,7 +70,7 @@
<div class="cl"></div>
</div>
<% all_comments = []%>
<% all_replies = get_all_children(all_comments, activity) %>
<% all_replies = OrgDocumentComment.where("root_id = #{activity.id}").reorder("created_at desc") %>
<% count = all_replies.count %>
<div class="homepagePostReply">
<%= render :partial => 'users/reply_banner', :locals => {:count => count, :activity => activity, :user_activity_id => user_activity_id,:is_course => 0,:is_board =>0} %>

View File

@ -68,7 +68,7 @@
</div>
</div>
<% all_comments = []%>
<% all_replies = get_all_children(all_comments, document) %>
<% all_replies = OrgDocumentComment.where("root_id = #{document.id}").reorder("created_at desc") %>
<% count = all_replies.count %>
<div class="homepagePostReply fl" style="background-color: #f1f1f1;" id="<%= document.id %>">

View File

@ -47,7 +47,7 @@
</span>
<span class="grayTxt">更新:<%= format_time(activity.children.any? ? activity.children.last[:created_on] : activity[:created_on] ) %></span>
<% all_comments = []%>
<% count=get_all_children(all_comments, activity).count %>
<% count=Message.where("root_id = #{activity.id}").count %>
<p class="list-info fr grayTxt"><span><%= count>0 ? "#{count}" : "0" %></span><span>回复</span><span>|</span><span><%= get_praise_num(activity) > 0 ? "#{get_praise_num(activity)}" : "0" %></span><span>赞</span></p>
</div>
<div class="cl"></div>

View File

@ -41,7 +41,7 @@
<div class="cl"></div>
</div>
<% all_comments = []%>
<% all_replies = get_all_children(all_comments, activity) %>
<% all_replies = JournalsForMessage.where("root_id = #{activity.id}").reorder("created_on desc") %>
<% count = all_replies.count %>
<div class="homepagePostReply">
<%= render :partial => 'users/reply_banner', :locals => {:count => count, :activity => activity, :user_activity_id => user_activity_id} %>

View File

@ -81,7 +81,8 @@
<div class="cl"></div>
</div>
<% all_comments = []%>
<% all_replies = get_all_children(all_comments, activity) %>
<%# all_replies = get_all_children(all_comments, activity) %>
<% all_replies = Message.where("root_id = #{activity.id}").reorder("created_on desc") %>
<% count = all_replies.count %>
<div class="homepagePostReply">
<%= render :partial => 'users/reply_banner', :locals => {:count => count, :activity => activity, :user_activity_id => user_activity_id,:is_course => is_course,:is_board =>is_board} %>

View File

@ -47,7 +47,7 @@
</span>
<span class="grayTxt">更新:<%= format_time(activity.children.any? ? activity.children.last[:created_on] : activity[:created_on] ) %></span>
<% all_comments = []%>
<% count=get_all_children(all_comments, activity).count %>
<% count=Message.where("root_id = #{activity.id}").count %>
<p class="list-info fr grayTxt"><span><%= count>0 ? "#{count}" : "0" %></span><span>回复</span><span>|</span><span><%= get_praise_num(activity) > 0 ? "#{get_praise_num(activity)}" : "0" %></span><span>赞</span></p>
</div>
<div class="cl"></div>

View File

@ -82,7 +82,7 @@
<div class="cl"></div>
</div>
<% all_comments = []%>
<% all_replies = get_all_children(all_comments, activity) %>
<% all_replies = Message.where("root_id = #{activity.id}").reorder("created_on desc") %>
<% count = all_replies.count %>
<%# allow_delete = (activity.user == User.current || User.current.admin? || User.current.allowed_to?(:as_teacher,activity.course)) %>
<%# count = fetch_user_leaveWord_reply(activity).count %>

View File

@ -41,8 +41,8 @@
</div>
<div class="cl"></div>
</div>
<% all_comments = []%>
<% all_replies = get_all_children(all_comments, activity) %>
<%# all_comments = []%>
<% all_replies = BlogComment.where("root_id = #{activity.id}").reorder("created_on desc") %>
<% count = all_replies.count %>
<div class="homepagePostReply">
<%= render :partial => 'users/reply_banner', :locals => {:count => count, :activity => activity, :user_activity_id => user_activity_id, :homepage => 0} %>

View File

@ -63,7 +63,7 @@
<div class="cl"></div>
</div>
<% all_comments = []%>
<% all_replies = get_all_children(all_comments, activity) %>
<% all_replies = JournalsForMessage.where("root_id = #{activity.id}").reorder("created_on desc") %>
<% count = all_replies.count %>
<div class="homepagePostReply">
<%= render :partial => 'users/reply_banner', :locals => {:count => count, :activity => activity, :user_activity_id => user_activity_id} %>

View File

@ -16,15 +16,31 @@
<div class="mt5 fl"><%= image_tag("search_icon_03.png", :width=>"8", :height=>"16" ,:class=>"fl") %><span class="searchTag"><%= get_user_identity(User.find(item.id).user_extensions.identity) %></span></div>
<div class="cl"></div>
</li>
<li class="fontGrey3 mb5"><%= User.find(item.id).user_extensions && User.find(item.id).user_extensions.brief_introduction.present? ? User.find(item.id).user_extensions.brief_introduction : '这位童鞋很懒,什么也没有留下~'%></li>
<% user = User.find(item.id)%>
<li class="fontGrey3 mb5"><%= user.user_extensions && user.user_extensions.brief_introduction.present? ? user.user_extensions.brief_introduction : '这位童鞋很懒,什么也没有留下~'%></li>
<li class="f12 fontGrey2">
<span class="mr30">加入时间:<%= format_date( User.find(item.id).created_on)%></span><span class="mr30">
最后登录时间:<%= format_date( User.find(item.id).last_login_on)%></span><span class="mr30">
<%= User.find(item.id).user_extensions.occupation.present? ? '单位:'+User.find(item.id).user_extensions.occupation : ''%></span></li>
<span class="mr30">加入时间:<%= format_date( user.created_on)%></span><span class="mr30">
最后登录时间:<%= format_date( user.last_login_on)%></span><span class="mr30">
<%=user.show_occupation.nil? ? "": "单位:"+user.show_occupation %></span></li>
</ul>
</li>
<div class="cl"></div>
</ul>
<% when 'syllabus'%>
<ul class="searchContent w968">
<li class="f16 mb5 fontGrey3">
<a href="<%= syllabus_path(item.id)%>" class="fontGrey3 fl"><%= item.try(:highlight).try(:title) ? item.highlight.title[0].html_safe : item.title %>课程</a>
<div class="mt5 fl"><%= image_tag("search_icon_03.png", :width=>"8", :height=>"16" ,:class=>"fl") %><span class="searchTag">课程</span></div><div class="cl"></div></li>
<li class="f12 fontGrey2">
<% user = User.find(item.user_id)%>
<% syllabus = Syllabus.find(item.id) %>
<span class="mr30">创建者:<%=user.login+"("+user.show_name+")"%></span>
<span class="mr30">教师团队:<%=syllabus.syllabus_members.count%></span>
<span class="mr30">班级:<%=syllabus.courses.count%></span>
<span class="mr30">更新时间:<%=format_date(item.updated_at)%></span>
<span class="mr30"><%=user.show_occupation.nil? ? "": "单位:"+user.show_occupation %></span>
</li>
</ul>
<% when 'course'%>
<ul class="searchContent">
<li class="fl">
@ -38,10 +54,11 @@
</li>
<li class="fontGrey3 mb5"><%= item.try(:highlight).try(:description) ? item.highlight.description[0].html_safe : item.description %></li>
<li class="f12 fontGrey2">
<span class="mr30">教师:<%= User.find(item.tea_id).realname %></span>
<% user = User.find(item.tea_id)%>
<span class="mr30">教师:<%= user.realname %></span>
<span class="mr30">授课时间:<%= item.time.to_s + item.term%></span>
<span class="mr30">更新时间:<%= format_date(item.updated_at)%></span>
<span class="mr30"><%= User.find(item.tea_id).user_extensions.occupation.present? ? '单位:'+User.find(item.tea_id).user_extensions.occupation : ''%></span></li>
<span class="mr30"><%=user.show_occupation.nil? ? "": "单位:"+user.show_occupation %></span></li>
</ul>
</li>
<div class="cl"></div>
@ -56,7 +73,8 @@
<div class="mt5 fl"><%= image_tag("search_icon_03.png", :width=>"8", :height=>"16" ,:class=>"fl") %><span class="searchTag">资源</span></div>
<div class="cl"></div>
</li>
<li class="f12 fontGrey2"><span class="mr30">发布者:<%= User.find(item.author_id).login%><%= User.find(item.author_id).realname%></span>
<% user = User.find(item.author_id)%>
<li class="f12 fontGrey2"><span class="mr30">发布者:<%= user.login%><%= user.realname%></span>
<!--<span class="mr30">职称:<%#= get_technical_title User.find(item.author_id) %></span>-->
<span class="mr30">发布时间:<%= format_date(item.created_on)%></span>
<span class="mr30">下载次数:<%= item.downloads%>次</span>

View File

@ -10,7 +10,8 @@
<div class="mt5 fl"><%= image_tag("search_icon_03.png", :width=>"8", :height=>"16" ,:class=>"fl") %><span class="searchTag">资源</span></div>
<div class="cl"></div>
</li>
<li class="f12 fontGrey2"><span class="mr30">发布者:<%= User.find(attachment.author_id).login%><%= User.find(attachment.author_id).realname%></span>
<% user = User.find(attachment.author_id)%>
<li class="f12 fontGrey2"><span class="mr30">发布者:<%= user.login%><%= user.realname%></span>
<!--<span class="mr30">职称:<%#= get_technical_title User.find(attachment.author_id) %></span>-->
<span class="mr30">发布时间:<%= format_date(attachment.created_on)%></span>
<span class="mr30">下载次数:<%= attachment.downloads%>次</span>
@ -21,6 +22,6 @@
</ul>
<% end %>
<div class="pageRoll">
<!%= paginate attachments,:params => {:controller => 'welcome', :action => 'search',:search_type=>'attachment'}%>
<%= paginate attachments,:params => {:controller => 'welcome', :action => 'search',:search_type=>'attachment'}%>
</div>
<% end %>

View File

@ -13,10 +13,11 @@
</li>
<li class="fontGrey3 mb5"><%= course.try(:highlight).try(:description) ? course.highlight.description[0].html_safe : (course.description.present? ? course.description : '暂时没有该班级描述') %></li>
<li class="f12 fontGrey2">
<span class="mr30">教师:<%= User.find(course.tea_id).realname %></span>
<% user = User.find(course.tea_id)%>
<span class="mr30">教师:<%= user.realname %></span>
<span class="mr30">授课时间:<%= course.time.to_s + course.term%></span>
<span class="mr30">更新时间:<%= format_date(course.updated_at)%></span>
<span class="mr30"><%= User.find(course.tea_id).user_extensions.occupation.present? ? '单位:'+User.find(course.tea_id).user_extensions.occupation : ''%></span></li>
<span class="mr30"><%=user.show_occupation.nil? ? "": "单位:"+user.show_occupation %></span></li>
</ul>
</li>
<div class="cl"></div>

View File

@ -0,0 +1,22 @@
<% unless syllabuses.nil? || syllabuses.empty?%>
<% syllabuses.each do |item|%>
<ul class="searchContent w968">
<li class="f16 mb5 fontGrey3">
<!--<a href="<%#= syllabus_path(syllabus.id)%>" class="fontGrey3 fl"><span class="c_red"><%#= syllabus.title %></span>课程</a>-->
<a href="<%= syllabus_path(item.id)%>" class="fontGrey3 fl"><%= item.try(:highlight).try(:title) ? item.highlight.title[0].html_safe : item.title %>课程</a>
<div class="mt5 fl"><%= image_tag("search_icon_03.png", :width=>"8", :height=>"16" ,:class=>"fl") %><span class="searchTag">课程</span></div><div class="cl"></div></li>
<li class="f12 fontGrey2">
<% user = User.find(item.user_id)%>
<% syllabus = Syllabus.find(item.id) %>
<span class="mr30">创建者:<%=user.login+"("+user.show_name+")"%></span>
<span class="mr30">教师团队:<%=syllabus.syllabus_members.count%></span>
<span class="mr30">班级:<%=syllabus.courses.count%></span>
<span class="mr30">更新时间:<%=format_date(syllabus.updated_at)%></span>
<span class="mr30"><%=user.show_occupation.nil? ? "": "单位:"+user.show_occupation %></span>
</li>
</ul>
<% end %>
<div class="pageRoll">
<%= paginate syllabuses,:params => {:controller => 'welcome', :action => 'search',:search_type=>'syllabus'}%>
</div>
<% end %>

View File

@ -1,20 +1,21 @@
<% unless users.nil? || users.empty?%>
<% users.each do |user|%>
<% users.each do |item|%>
<ul class="searchContent">
<li class="fl">
<!--<img src="images/homepageImage.jpg" alt="个人图片" width="75" height="75" class="searchCourseImage" />-->
<%= link_to image_tag(url_to_avatar(User.find(user.id)), :width => "75", :height => "75",:class=>'searchCourseImage'), user_path(user.id), :alt => "用户头像" %>
<% user = User.find(item.id)%>
<%= link_to image_tag(url_to_avatar(user), :width => "75", :height => "75",:class=>'searchCourseImage'), user_path(user.id), :alt => "用户头像" %>
</li>
<li class="fl searchContentDes">
<ul class="fl">
<li class="f16 mb5"><a href="<%= user_path(user.id)%>" class="fontGrey3 fl"><%= user.try(:highlight).try(:login) ? user.highlight.login[0].html_safe : user.login %>(<%= user.try(:highlight).try(:lastname) ? user.highlight.lastname[0].html_safe : user.lastname%><%= user.try(:highlight).try(:firstname) ? user.highlight.firstname[0].html_safe : user.firstname %>)</a>
<div class="mt5 fl"><%= image_tag("search_icon_03.png", :width=>"8", :height=>"16" ,:class=>"fl") %><span class="searchTag"><%= get_user_identity(User.find(user.id).user_extensions.identity) %></span></div>
<li class="f16 mb5"><a href="<%= user_path(user.id)%>" class="fontGrey3 fl"><%= item.try(:highlight).try(:login) ? item.highlight.login[0].html_safe : user.login %>(<%= item.try(:highlight).try(:lastname) ? item.highlight.lastname[0].html_safe : user.lastname%><%= item.try(:highlight).try(:firstname) ? item.highlight.firstname[0].html_safe : user.firstname %>)</a>
<div class="mt5 fl"><%= image_tag("search_icon_03.png", :width=>"8", :height=>"16" ,:class=>"fl") %><span class="searchTag"><%= get_user_identity(user.user_extensions.identity) %></span></div>
<div class="cl"></div>
</li>
<li class="fontGrey3 mb5"><%= User.find(user.id).user_extensions && User.find(user.id).user_extensions.brief_introduction.present? ? User.find(user.id).user_extensions.brief_introduction : '这位童鞋很懒,什么也没有留下~'%></li>
<li class="f12 fontGrey2"><span class="mr30">加入时间:<%= format_date( User.find(user.id).created_on)%></span><span class="mr30">
最后登录时间:<%= format_date( User.find(user.id).last_login_on)%></span><span class="mr30">
<%= User.find(user.id).user_extensions.occupation.present? ? '单位:'+User.find(user.id).user_extensions.occupation : ''%></span></li>
<li class="fontGrey3 mb5"><%= user.user_extensions && user.user_extensions.brief_introduction.present? ? user.user_extensions.brief_introduction : '这位童鞋很懒,什么也没有留下~'%></li>
<li class="f12 fontGrey2"><span class="mr30">加入时间:<%= format_date( user.created_on)%></span><span class="mr30">
最后登录时间:<%= format_date( user.last_login_on)%></span><span class="mr30">
<%=user.show_occupation.nil? ? "": "单位:"+user.show_occupation %></span></li>
</ul>
</li>
<div class="cl"></div>

View File

@ -3,7 +3,7 @@
function g(o){return document.getElementById(o);}
function HoverLi(n){
//如果有N个标签,就将i<=N;
for(var i=1;i<=6;i++){
for(var i=1;i<=7;i++){
g('searchBaner_'+i).className='searchBannerNormal';
g('searchContent_'+i).className='undis';g('searchNum_'+i).className="numRed";
g('searchType_'+i).className="fontGrey2 f14";
@ -23,12 +23,14 @@
//$("#searchContent_2").html('<%#= escape_javascript(render :partial => 'search_user_results',:locals => {:users=>@users})%>');
search('user')
}else if(n == 3){
search('course')
search('syllabus')
}else if(n == 4){
search('attachment')
search('course')
}else if(n == 5){
search('project')
search('attachment')
}else if(n == 6){
search('project')
}else if(n == 7){
search('memo')
}
}
@ -49,19 +51,22 @@
}else if('<%= @search_type%>' == 'user'){
HoverLi(2)
$("#searchContent_2").html('<%= escape_javascript(render :partial => 'search_user_results',:locals => {:users=>@users})%>');
}else if('<%= @search_type%>' == 'course'){
}else if('<%= @search_type%>' == 'syllabus'){
HoverLi(3)
$("#searchContent_3").html('<%= escape_javascript(render :partial => 'search_course_results',:locals => {:courses=>@courses})%>');
}else if('<%= @search_type%>' == 'attachment'){
$("#searchContent_3").html('<%= escape_javascript(render :partial => 'search_syllabus_results',:locals => {:syllabuses=>@syllabuses})%>');
}else if('<%= @search_type%>' == 'course'){
HoverLi(4)
$("#searchContent_4").html('<%= escape_javascript(render :partial => 'search_attachment_results',:locals => {:attachments=>@attachments})%>');
}else if('<%= @search_type%>' == 'project'){
$("#searchContent_4").html('<%= escape_javascript(render :partial => 'search_course_results',:locals => {:courses=>@courses})%>');
}else if('<%= @search_type%>' == 'attachment'){
HoverLi(5)
$("#searchContent_5").html('<%= escape_javascript(render :partial => 'search_project_results',:locals => {:projects=>@projects})%>');
$("#searchContent_5").html('<%= escape_javascript(render :partial => 'search_attachment_results',:locals => {:attachments=>@attachments})%>');
}else if('<%= @search_type%>' == 'project'){
HoverLi(6)
$("#searchContent_6").html('<%= escape_javascript(render :partial => 'search_project_results',:locals => {:projects=>@projects})%>');
}else if('<%= @search_type%>' == 'memo')
{
HoverLi(6)
$("#searchContent_6").html('<%= escape_javascript(render :partial => 'search_memo_results',:locals => {:memos=>@memos})%>');
HoverLi(7)
$("#searchContent_7").html('<%= escape_javascript(render :partial => 'search_memo_results',:locals => {:memos=>@memos})%>');
}
})
//如果要做成点击后再转到请将<li>中的onmouseover 改成 onclick;
@ -79,10 +84,11 @@
<ul id="searchBanner">
<li id="searchBaner_1" class="searchBannerActive" onclick="HoverLi(1);on_click_search(1);"><a href="javascript:void(0);" id="searchType_1" class="fontGrey3 f14">全部<span style="font-weight:normal;"><font id="searchNum_1" class="c_red">(<%= @total_count%>)</font></span></a></li>
<li id="searchBaner_2" onclick="HoverLi(2);on_click_search(2);"><a href="javascript:void(0);" id="searchType_2" class="fontGrey2 f14">用户<span class="numRed" style="font-weight:normal;"><font id="searchNum_2" class="numRed">(<%= @users_count%>)</font></span></a></li>
<li id="searchBaner_3" onclick="HoverLi(3);on_click_search(3);"><a href="javascript:void(0);" id="searchType_3" class="fontGrey2 f14">班级<span style="font-weight:normal;"><font id="searchNum_3" class="numRed">(<%=@course_count%>)</font></span></a></li>
<li id="searchBaner_4" onclick="HoverLi(4);on_click_search(4);"><a href="javascript:void(0);" id="searchType_4" class="fontGrey2 f14">资源<span class="numRed" style="font-weight:normal;"><font id="searchNum_4" class="numRed">(<%= @attach_count%>)</font></span></a></li>
<li id="searchBaner_5" onclick="HoverLi(5);on_click_search(5);"><a href="javascript:void(0);" id="searchType_5" class="fontGrey2 f14">项目<span class="numRed" style="font-weight:normal;"><font id="searchNum_5" class="numRed">(<%= @project_count%>)</font></span></a></li>
<li id="searchBaner_6" onclick="HoverLi(6);on_click_search(6);"><a href="javascript:void(0);" id="searchType_6" class="fontGrey2 f14">帖子<span class="numRed" style="font-weight:normal;"><font id="searchNum_6" class="numRed">(<%= @memo_count%>)</font></span></a></li>
<li id="searchBaner_3" onclick="HoverLi(3);on_click_search(3);"><a href="javascript:void(0);" id="searchType_3" class="fontGrey2 f14">课程<span style="font-weight:normal;"><font id="searchNum_3" class="numRed">(<%=@syllabus_count%>)</font></span></a></li>
<li id="searchBaner_4" onclick="HoverLi(4);on_click_search(4);"><a href="javascript:void(0);" id="searchType_4" class="fontGrey2 f14">班级<span style="font-weight:normal;"><font id="searchNum_4" class="numRed">(<%=@course_count%>)</font></span></a></li>
<li id="searchBaner_5" onclick="HoverLi(5);on_click_search(5);"><a href="javascript:void(0);" id="searchType_5" class="fontGrey2 f14">资源<span class="numRed" style="font-weight:normal;"><font id="searchNum_5" class="numRed">(<%= @attach_count%>)</font></span></a></li>
<li id="searchBaner_6" onclick="HoverLi(6);on_click_search(6);"><a href="javascript:void(0);" id="searchType_6" class="fontGrey2 f14">项目<span class="numRed" style="font-weight:normal;"><font id="searchNum_6" class="numRed">(<%= @project_count%>)</font></span></a></li>
<li id="searchBaner_7" onclick="HoverLi(7);on_click_search(7);"><a href="javascript:void(0);" id="searchType_7" class="fontGrey2 f14">帖子<span class="numRed" style="font-weight:normal;"><font id="searchNum_7" class="numRed">(<%= @memo_count%>)</font></span></a></li>
<div class="cl"></div>
</ul>
<ul id="searchTips" style="display:none;">
@ -97,13 +103,15 @@
<div id="searchContent_3" class="undis">
</div>
<div id="searchContent_4" class="undis">
</div>
<div id="searchContent_5" class="undis">
</div>
<div id="searchContent_6" class="undis">
</div>
<div id="searchContent_7" class="undis">
</div>
</div>
</div>

View File

@ -3,13 +3,15 @@
$("#searchContent_1").html('<%= escape_javascript(render :partial => 'search_all_results',:locals => {:all_results=> @alls})%>');
<% when 'user'%>
$("#searchContent_2").html('<%= escape_javascript(render :partial => 'search_user_results',:locals => {:users=>@users})%>');
<% when 'syllabus'%>
$("#searchContent_3").html('<%= escape_javascript(render :partial => 'search_syllabus_results',:locals => {:syllabuses=>@syllabuses})%>');
<% when 'course'%>
$("#searchContent_3").html('<%= escape_javascript(render :partial => 'search_course_results',:locals => {:courses=>@courses})%>');
$("#searchContent_4").html('<%= escape_javascript(render :partial => 'search_course_results',:locals => {:courses=>@courses})%>');
<% when 'project'%>
$("#searchContent_5").html('<%= escape_javascript(render :partial => 'search_project_results',:locals => {:projects=>@projects})%>');
$("#searchContent_6").html('<%= escape_javascript(render :partial => 'search_project_results',:locals => {:projects=>@projects})%>');
<% when 'attachment'%>
$("#searchContent_4").html('<%= escape_javascript(render :partial => 'search_attachment_results',:locals => {:attachments=>@attachments})%>');
$("#searchContent_5").html('<%= escape_javascript(render :partial => 'search_attachment_results',:locals => {:attachments=>@attachments})%>');
<% when 'memo'%>
$("#searchContent_6").html('<%= escape_javascript(render :partial => 'search_memo_results',:locals => {:memos=>@memos})%>');
$("#searchContent_7").html('<%= escape_javascript(render :partial => 'search_memo_results',:locals => {:memos=>@memos})%>');
<%else%>
<%end %>

View File

@ -0,0 +1,73 @@
class AddRootId < ActiveRecord::Migration
def change
add_column :messages, :root_id, :integer, :default => nil
add_column :journals_for_messages, :root_id, :integer, :default => nil
add_column :blog_comments, :root_id, :integer, :default => nil
add_column :org_document_comments, :root_id, :integer, :default => nil
add_index :messages, :root_id
add_index :journals_for_messages,:root_id
add_index :blog_comments,:root_id
add_index :org_document_comments,:root_id
def get_base_parent comment
comm = comment
while comm.parent
comm = comm.parent
end
comm
end
count = Message.all.count / 30 + 2
transaction do
for i in 1 ... count do i
Message.page(i).per(30).each do |message|
unless message.parent.nil?
parent = get_base_parent message
message.update_column('root_id', parent.id)
end
end
end
end
count = JournalsForMessage.all.count / 30 + 2
transaction do
for i in 1 ... count do i
JournalsForMessage.page(i).per(30).each do |message|
if message.jour_type == "HomeworkCommon" || message.jour_type == "Syllabus"
message.update_column('root_id', message.jour_id)
else
unless message.parent.nil?
parent = get_base_parent message
message.update_column('root_id', parent.id)
end
end
end
end
end
count = BlogComment.all.count / 30 + 2
transaction do
for i in 1 ... count do i
BlogComment.page(i).per(30).each do |message|
unless message.parent.nil?
parent = get_base_parent message
message.update_column('root_id', parent.id)
end
end
end
end
count = OrgDocumentComment.all.count / 30 + 2
transaction do
for i in 1 ... count do i
OrgDocumentComment.page(i).per(30).each do |message|
unless message.parent.nil?
parent = get_base_parent message
message.update_column('root_id', parent.id)
end
end
end
end
end
end

View File

@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20161009053958) do
ActiveRecord::Schema.define(:version => 20161011012114) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
@ -52,28 +52,6 @@ ActiveRecord::Schema.define(:version => 20161009053958) do
add_index "api_keys", ["access_token"], :name => "index_api_keys_on_access_token"
add_index "api_keys", ["user_id"], :name => "index_api_keys_on_user_id"
create_table "application_settings", :force => true do |t|
t.integer "default_projects_limit"
t.boolean "signup_enabled"
t.boolean "signin_enabled"
t.boolean "gravatar_enabled"
t.text "sign_in_text"
t.datetime "created_at"
t.datetime "updated_at"
t.string "home_page_url"
t.integer "default_branch_protection", :default => 2
t.boolean "twitter_sharing_enabled", :default => true
t.text "restricted_visibility_levels"
t.boolean "version_check_enabled", :default => true
t.integer "max_attachment_size", :default => 10, :null => false
t.integer "default_project_visibility"
t.integer "default_snippet_visibility"
t.text "restricted_signup_domains"
t.boolean "user_oauth_applications", :default => true
t.string "after_sign_out_path"
t.integer "session_expire_delay", :default => 10080, :null => false
end
create_table "applied_messages", :force => true do |t|
t.integer "user_id"
t.integer "applied_id"
@ -206,20 +184,6 @@ ActiveRecord::Schema.define(:version => 20161009053958) do
t.string "typeName", :limit => 50
end
create_table "audit_events", :force => true do |t|
t.integer "author_id", :null => false
t.string "type", :null => false
t.integer "entity_id", :null => false
t.string "entity_type", :null => false
t.text "details"
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "audit_events", ["author_id"], :name => "index_audit_events_on_author_id"
add_index "audit_events", ["entity_id", "entity_type"], :name => "index_audit_events_on_entity_id_and_entity_type"
add_index "audit_events", ["type"], :name => "index_audit_events_on_type"
create_table "auth_sources", :force => true do |t|
t.string "type", :limit => 30, :default => "", :null => false
t.string "name", :limit => 60, :default => "", :null => false
@ -285,8 +249,11 @@ ActiveRecord::Schema.define(:version => 20161009053958) do
t.integer "reply_id"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.integer "root_id"
end
add_index "blog_comments", ["root_id"], :name => "index_blog_comments_on_root_id"
create_table "blogs", :force => true do |t|
t.string "name", :default => "", :null => false
t.text "description"
@ -317,17 +284,6 @@ ActiveRecord::Schema.define(:version => 20161009053958) do
add_index "boards", ["last_message_id"], :name => "index_boards_on_last_message_id"
add_index "boards", ["project_id"], :name => "boards_project_id"
create_table "broadcast_messages", :force => true do |t|
t.text "message", :null => false
t.datetime "starts_at"
t.datetime "ends_at"
t.integer "alert_type"
t.datetime "created_at"
t.datetime "updated_at"
t.string "color"
t.string "font"
end
create_table "bug_to_osps", :force => true do |t|
t.integer "osp_id"
t.integer "relative_memo_id"
@ -357,16 +313,14 @@ ActiveRecord::Schema.define(:version => 20161009053958) do
add_index "changeset_parents", ["parent_id"], :name => "changeset_parents_parent_ids"
create_table "changesets", :force => true do |t|
t.integer "repository_id", :null => false
t.string "revision", :null => false
t.integer "repository_id", :null => false
t.string "revision", :null => false
t.string "committer"
t.datetime "committed_on", :null => false
t.datetime "committed_on", :null => false
t.text "comments"
t.date "commit_date"
t.string "scmid"
t.integer "user_id"
t.integer "project_id"
t.integer "type", :default => 0
end
add_index "changesets", ["committed_on"], :name => "index_changesets_on_committed_on"
@ -715,15 +669,6 @@ ActiveRecord::Schema.define(:version => 20161009053958) do
add_index "delayed_jobs", ["priority", "run_at"], :name => "delayed_jobs_priority"
create_table "deploy_keys_projects", :force => true do |t|
t.integer "deploy_key_id", :null => false
t.integer "project_id", :null => false
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "deploy_keys_projects", ["project_id"], :name => "index_deploy_keys_projects_on_project_id"
create_table "discuss_demos", :force => true do |t|
t.string "title"
t.text "body"
@ -773,16 +718,6 @@ ActiveRecord::Schema.define(:version => 20161009053958) do
t.datetime "created_at"
end
create_table "emails", :force => true do |t|
t.integer "user_id", :null => false
t.string "email", :null => false
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "emails", ["email"], :name => "index_emails_on_email", :unique => true
add_index "emails", ["user_id"], :name => "index_emails_on_user_id"
create_table "enabled_modules", :force => true do |t|
t.integer "project_id"
t.string "name", :null => false
@ -805,25 +740,6 @@ ActiveRecord::Schema.define(:version => 20161009053958) do
add_index "enumerations", ["id", "type"], :name => "index_enumerations_on_id_and_type"
add_index "enumerations", ["project_id"], :name => "index_enumerations_on_project_id"
create_table "events", :force => true do |t|
t.string "target_type"
t.integer "target_id"
t.string "title"
t.text "data"
t.integer "project_id"
t.datetime "created_at"
t.datetime "updated_at"
t.integer "action"
t.integer "author_id"
end
add_index "events", ["action"], :name => "index_events_on_action"
add_index "events", ["author_id"], :name => "index_events_on_author_id"
add_index "events", ["created_at"], :name => "index_events_on_created_at"
add_index "events", ["project_id"], :name => "index_events_on_project_id"
add_index "events", ["target_id"], :name => "index_events_on_target_id"
add_index "events", ["target_type"], :name => "index_events_on_target_type"
create_table "exercise_answers", :force => true do |t|
t.integer "user_id"
t.integer "exercise_question_id"
@ -926,15 +842,6 @@ ActiveRecord::Schema.define(:version => 20161009053958) do
add_index "forge_messages", ["forge_message_id", "forge_message_type"], :name => "index_forge_messages_on_forge_message_id_and_forge_message_type"
add_index "forge_messages", ["user_id", "project_id", "created_at"], :name => "index_forge_messages_on_user_id_and_project_id_and_created_at"
create_table "forked_project_links", :force => true do |t|
t.integer "forked_to_project_id", :null => false
t.integer "forked_from_project_id", :null => false
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "forked_project_links", ["forked_to_project_id"], :name => "index_forked_project_links_on_forked_to_project_id", :unique => true
create_table "forums", :force => true do |t|
t.string "name", :null => false
t.text "description"
@ -1064,21 +971,6 @@ ActiveRecord::Schema.define(:version => 20161009053958) do
t.datetime "updated_at", :null => false
end
create_table "identities", :force => true do |t|
t.string "extern_uid"
t.string "provider"
t.integer "user_id"
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "identities", ["created_at", "id"], :name => "index_identities_on_created_at_and_id"
add_index "identities", ["user_id"], :name => "index_identities_on_user_id"
create_table "innodb_monitor", :id => false, :force => true do |t|
t.integer "a"
end
create_table "invite_lists", :force => true do |t|
t.integer "project_id"
t.integer "user_id"
@ -1223,21 +1115,10 @@ ActiveRecord::Schema.define(:version => 20161009053958) do
t.integer "m_reply_id"
t.integer "is_comprehensive_evaluation"
t.integer "private", :default => 0
t.integer "root_id"
end
create_table "keys", :force => true do |t|
t.integer "user_id"
t.datetime "created_at"
t.datetime "updated_at"
t.text "key"
t.string "title"
t.string "type"
t.string "fingerprint"
t.boolean "public", :default => false, :null => false
end
add_index "keys", ["created_at", "id"], :name => "index_keys_on_created_at_and_id"
add_index "keys", ["user_id"], :name => "index_keys_on_user_id"
add_index "journals_for_messages", ["root_id"], :name => "index_journals_for_messages_on_root_id"
create_table "kindeditor_assets", :force => true do |t|
t.string "asset"
@ -1250,27 +1131,6 @@ ActiveRecord::Schema.define(:version => 20161009053958) do
t.integer "owner_type", :default => 0
end
create_table "label_links", :force => true do |t|
t.integer "label_id"
t.integer "target_id"
t.string "target_type"
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "label_links", ["label_id"], :name => "index_label_links_on_label_id"
add_index "label_links", ["target_id", "target_type"], :name => "index_label_links_on_target_id_and_target_type"
create_table "labels", :force => true do |t|
t.string "title"
t.string "color"
t.integer "project_id"
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "labels", ["project_id"], :name => "index_labels_on_project_id"
create_table "member_roles", :force => true do |t|
t.integer "member_id", :null => false
t.integer "role_id", :null => false
@ -1324,47 +1184,6 @@ ActiveRecord::Schema.define(:version => 20161009053958) do
t.integer "viewed_count", :default => 0
end
create_table "merge_request_diffs", :force => true do |t|
t.string "state"
t.text "st_commits", :limit => 2147483647
t.text "st_diffs", :limit => 2147483647
t.integer "merge_request_id", :null => false
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "merge_request_diffs", ["merge_request_id"], :name => "index_merge_request_diffs_on_merge_request_id", :unique => true
create_table "merge_requests", :force => true do |t|
t.string "target_branch", :null => false
t.string "source_branch", :null => false
t.integer "source_project_id", :null => false
t.integer "author_id"
t.integer "assignee_id"
t.string "title"
t.datetime "created_at"
t.datetime "updated_at"
t.integer "milestone_id"
t.string "state"
t.string "merge_status"
t.integer "target_project_id", :null => false
t.integer "iid"
t.text "description"
t.integer "position", :default => 0
t.datetime "locked_at"
end
add_index "merge_requests", ["assignee_id"], :name => "index_merge_requests_on_assignee_id"
add_index "merge_requests", ["author_id"], :name => "index_merge_requests_on_author_id"
add_index "merge_requests", ["created_at", "id"], :name => "index_merge_requests_on_created_at_and_id"
add_index "merge_requests", ["created_at"], :name => "index_merge_requests_on_created_at"
add_index "merge_requests", ["milestone_id"], :name => "index_merge_requests_on_milestone_id"
add_index "merge_requests", ["source_branch"], :name => "index_merge_requests_on_source_branch"
add_index "merge_requests", ["source_project_id"], :name => "index_merge_requests_on_source_project_id"
add_index "merge_requests", ["target_branch"], :name => "index_merge_requests_on_target_branch"
add_index "merge_requests", ["target_project_id", "iid"], :name => "index_merge_requests_on_target_project_id_and_iid", :unique => true
add_index "merge_requests", ["title"], :name => "index_merge_requests_on_title"
create_table "message_alls", :force => true do |t|
t.integer "user_id"
t.integer "message_id"
@ -1391,6 +1210,7 @@ ActiveRecord::Schema.define(:version => 20161009053958) do
t.integer "reply_id"
t.integer "quotes"
t.integer "status", :default => 0
t.integer "root_id"
end
add_index "messages", ["author_id"], :name => "index_messages_on_author_id"
@ -1398,39 +1218,7 @@ ActiveRecord::Schema.define(:version => 20161009053958) do
add_index "messages", ["created_on"], :name => "index_messages_on_created_on"
add_index "messages", ["last_reply_id"], :name => "index_messages_on_last_reply_id"
add_index "messages", ["parent_id"], :name => "messages_parent_id"
create_table "milestones", :force => true do |t|
t.string "title", :null => false
t.integer "project_id", :null => false
t.text "description"
t.date "due_date"
t.datetime "created_at"
t.datetime "updated_at"
t.string "state"
t.integer "iid"
end
add_index "milestones", ["created_at", "id"], :name => "index_milestones_on_created_at_and_id"
add_index "milestones", ["due_date"], :name => "index_milestones_on_due_date"
add_index "milestones", ["project_id", "iid"], :name => "index_milestones_on_project_id_and_iid", :unique => true
add_index "milestones", ["project_id"], :name => "index_milestones_on_project_id"
create_table "namespaces", :force => true do |t|
t.string "name", :null => false
t.string "path", :null => false
t.integer "owner_id"
t.datetime "created_at"
t.datetime "updated_at"
t.string "type"
t.string "description", :default => "", :null => false
t.string "avatar"
end
add_index "namespaces", ["created_at", "id"], :name => "index_namespaces_on_created_at_and_id"
add_index "namespaces", ["name"], :name => "index_namespaces_on_name", :unique => true
add_index "namespaces", ["owner_id"], :name => "index_namespaces_on_owner_id"
add_index "namespaces", ["path"], :name => "index_namespaces_on_path", :unique => true
add_index "namespaces", ["type"], :name => "index_namespaces_on_type"
add_index "messages", ["root_id"], :name => "index_messages_on_root_id"
create_table "news", :force => true do |t|
t.integer "project_id"
@ -1457,31 +1245,6 @@ ActiveRecord::Schema.define(:version => 20161009053958) do
t.datetime "updated_at", :null => false
end
create_table "notes", :force => true do |t|
t.text "note"
t.string "noteable_type"
t.integer "author_id"
t.datetime "created_at"
t.datetime "updated_at"
t.integer "project_id"
t.string "attachment"
t.string "line_code"
t.string "commit_id"
t.integer "noteable_id"
t.boolean "system", :default => false, :null => false
t.text "st_diff", :limit => 2147483647
end
add_index "notes", ["author_id"], :name => "index_notes_on_author_id"
add_index "notes", ["commit_id"], :name => "index_notes_on_commit_id"
add_index "notes", ["created_at", "id"], :name => "index_notes_on_created_at_and_id"
add_index "notes", ["created_at"], :name => "index_notes_on_created_at"
add_index "notes", ["noteable_id", "noteable_type"], :name => "index_notes_on_noteable_id_and_noteable_type"
add_index "notes", ["noteable_type"], :name => "index_notes_on_noteable_type"
add_index "notes", ["project_id", "noteable_type"], :name => "index_notes_on_project_id_and_noteable_type"
add_index "notes", ["project_id"], :name => "index_notes_on_project_id"
add_index "notes", ["updated_at"], :name => "index_notes_on_updated_at"
create_table "notificationcomments", :force => true do |t|
t.string "notificationcommented_type"
t.integer "notificationcommented_id"
@ -1491,49 +1254,6 @@ ActiveRecord::Schema.define(:version => 20161009053958) do
t.datetime "updated_at", :null => false
end
create_table "oauth_access_grants", :force => true do |t|
t.integer "resource_owner_id", :null => false
t.integer "application_id", :null => false
t.string "token", :null => false
t.integer "expires_in", :null => false
t.text "redirect_uri", :null => false
t.datetime "created_at", :null => false
t.datetime "revoked_at"
t.string "scopes"
end
add_index "oauth_access_grants", ["token"], :name => "index_oauth_access_grants_on_token", :unique => true
create_table "oauth_access_tokens", :force => true do |t|
t.integer "resource_owner_id"
t.integer "application_id"
t.string "token", :null => false
t.string "refresh_token"
t.integer "expires_in"
t.datetime "revoked_at"
t.datetime "created_at", :null => false
t.string "scopes"
end
add_index "oauth_access_tokens", ["refresh_token"], :name => "index_oauth_access_tokens_on_refresh_token", :unique => true
add_index "oauth_access_tokens", ["resource_owner_id"], :name => "index_oauth_access_tokens_on_resource_owner_id"
add_index "oauth_access_tokens", ["token"], :name => "index_oauth_access_tokens_on_token", :unique => true
create_table "oauth_applications", :force => true do |t|
t.string "name", :null => false
t.string "uid", :null => false
t.string "secret", :null => false
t.text "redirect_uri", :null => false
t.string "scopes", :default => "", :null => false
t.datetime "created_at"
t.datetime "updated_at"
t.integer "owner_id"
t.string "owner_type"
end
add_index "oauth_applications", ["owner_id", "owner_type"], :name => "index_oauth_applications_on_owner_id_and_owner_type"
add_index "oauth_applications", ["uid"], :name => "index_oauth_applications_on_uid", :unique => true
create_table "onclick_times", :force => true do |t|
t.integer "user_id"
t.datetime "onclick_time"
@ -1625,8 +1345,11 @@ ActiveRecord::Schema.define(:version => 20161009053958) do
t.integer "sticky", :default => 0
t.integer "org_subfield_id"
t.integer "status", :default => 0
t.integer "root_id"
end
add_index "org_document_comments", ["root_id"], :name => "index_org_document_comments_on_root_id"
create_table "org_member_roles", :force => true do |t|
t.integer "org_member_id"
t.integer "role_id"
@ -1691,23 +1414,6 @@ ActiveRecord::Schema.define(:version => 20161009053958) do
t.integer "allow_teacher", :default => 0
end
create_table "permissions", :force => true do |t|
t.string "controller", :limit => 30, :default => "", :null => false
t.string "action", :limit => 30, :default => "", :null => false
t.string "description", :limit => 60, :default => "", :null => false
t.boolean "is_public", :default => false, :null => false
t.integer "sort", :default => 0, :null => false
t.boolean "mail_option", :default => false, :null => false
t.boolean "mail_enabled", :default => false, :null => false
end
create_table "permissions_roles", :id => false, :force => true do |t|
t.integer "permission_id", :default => 0, :null => false
t.integer "role_id", :default => 0, :null => false
end
add_index "permissions_roles", ["role_id"], :name => "permissions_roles_role_id"
create_table "phone_app_versions", :force => true do |t|
t.string "version"
t.text "description"
@ -1790,11 +1496,6 @@ ActiveRecord::Schema.define(:version => 20161009053958) do
t.datetime "updated_at", :null => false
end
create_table "project_import_data", :force => true do |t|
t.integer "project_id"
t.text "data"
end
create_table "project_infos", :force => true do |t|
t.integer "project_id"
t.integer "user_id"
@ -1888,16 +1589,6 @@ ActiveRecord::Schema.define(:version => 20161009053958) do
add_index "projects_trackers", ["project_id", "tracker_id"], :name => "projects_trackers_unique", :unique => true
add_index "projects_trackers", ["project_id"], :name => "projects_trackers_project_id"
create_table "protected_branches", :force => true do |t|
t.integer "project_id", :null => false
t.string "name", :null => false
t.datetime "created_at"
t.datetime "updated_at"
t.boolean "developers_can_push", :default => false, :null => false
end
add_index "protected_branches", ["project_id"], :name => "index_protected_branches_on_project_id"
create_table "pull_requests", :force => true do |t|
t.integer "pull_request_id"
t.integer "gpid"
@ -2054,25 +1745,6 @@ ActiveRecord::Schema.define(:version => 20161009053958) do
t.integer "is_teacher_score", :default => 0
end
create_table "services", :force => true do |t|
t.string "type"
t.string "title"
t.integer "project_id"
t.datetime "created_at"
t.datetime "updated_at"
t.boolean "active", :default => false, :null => false
t.text "properties"
t.boolean "template", :default => false
t.boolean "push_events", :default => true
t.boolean "issues_events", :default => true
t.boolean "merge_requests_events", :default => true
t.boolean "tag_push_events", :default => true
t.boolean "note_events", :default => true, :null => false
end
add_index "services", ["created_at", "id"], :name => "index_services_on_created_at_and_id"
add_index "services", ["project_id"], :name => "index_services_on_project_id"
create_table "settings", :force => true do |t|
t.string "name", :default => "", :null => false
t.text "value"
@ -2111,26 +1783,6 @@ ActiveRecord::Schema.define(:version => 20161009053958) do
t.datetime "updated_at", :null => false
end
create_table "snippets", :force => true do |t|
t.string "title"
t.text "content", :limit => 2147483647
t.integer "author_id", :null => false
t.integer "project_id"
t.datetime "created_at"
t.datetime "updated_at"
t.string "file_name"
t.datetime "expires_at"
t.string "type"
t.integer "visibility_level", :default => 0, :null => false
end
add_index "snippets", ["author_id"], :name => "index_snippets_on_author_id"
add_index "snippets", ["created_at", "id"], :name => "index_snippets_on_created_at_and_id"
add_index "snippets", ["created_at"], :name => "index_snippets_on_created_at"
add_index "snippets", ["expires_at"], :name => "index_snippets_on_expires_at"
add_index "snippets", ["project_id"], :name => "index_snippets_on_project_id"
add_index "snippets", ["visibility_level"], :name => "index_snippets_on_visibility_level"
create_table "softapplications", :force => true do |t|
t.string "name"
t.text "description"
@ -2284,17 +1936,6 @@ ActiveRecord::Schema.define(:version => 20161009053958) do
t.datetime "updated_at", :null => false
end
create_table "subscriptions", :force => true do |t|
t.integer "user_id"
t.integer "subscribable_id"
t.string "subscribable_type"
t.boolean "subscribed"
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "subscriptions", ["subscribable_id", "subscribable_type", "user_id"], :name => "subscriptions_user_id_and_ref_fields", :unique => true
create_table "syllabus_members", :force => true do |t|
t.integer "rank"
t.integer "syllabus_id"
@ -2568,17 +2209,6 @@ ActiveRecord::Schema.define(:version => 20161009053958) do
add_index "users", ["id", "type"], :name => "index_users_on_id_and_type"
add_index "users", ["type"], :name => "index_users_on_type"
create_table "users_star_projects", :force => true do |t|
t.integer "project_id", :null => false
t.integer "user_id", :null => false
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "users_star_projects", ["project_id"], :name => "index_users_star_projects_on_project_id"
add_index "users_star_projects", ["user_id", "project_id"], :name => "index_users_star_projects_on_user_id_and_project_id", :unique => true
add_index "users_star_projects", ["user_id"], :name => "index_users_star_projects_on_user_id"
create_table "versions", :force => true do |t|
t.integer "project_id", :default => 0, :null => false
t.string "name", :default => "", :null => false
@ -2630,23 +2260,6 @@ ActiveRecord::Schema.define(:version => 20161009053958) do
t.datetime "updated_at", :null => false
end
create_table "web_hooks", :force => true do |t|
t.string "url"
t.integer "project_id"
t.datetime "created_at"
t.datetime "updated_at"
t.string "type", :default => "ProjectHook"
t.integer "service_id"
t.boolean "push_events", :default => true, :null => false
t.boolean "issues_events", :default => false, :null => false
t.boolean "merge_requests_events", :default => false, :null => false
t.boolean "tag_push_events", :default => false
t.boolean "note_events", :default => false, :null => false
end
add_index "web_hooks", ["created_at", "id"], :name => "index_web_hooks_on_created_at_and_id"
add_index "web_hooks", ["project_id"], :name => "index_web_hooks_on_project_id"
create_table "wechat_logs", :force => true do |t|
t.string "openid", :null => false
t.text "request_raw"

View File

@ -7,9 +7,8 @@ namespace :importer do
ENV['BATCH']='1000'
Rake::Task["elasticsearch:import:model"].execute
end
task :importproject => :environment do
ENV['CLASS']='Project'
task :importsyllabus => :environment do
ENV['CLASS']='Syllabus'
ENV['SCOPE']='indexable'
ENV['FORCE']='y'
ENV['BATCH']='1000'
@ -29,6 +28,14 @@ namespace :importer do
ENV['BATCH']='1000'
Rake::Task["elasticsearch:import:model"].execute
end
task :importproject => :environment do
ENV['CLASS']='Project'
ENV['SCOPE']='indexable'
ENV['FORCE']='y'
ENV['BATCH']='1000'
Rake::Task["elasticsearch:import:model"].execute
end
task :importmemo => :environment do
ENV['CLASS']='Memo'
ENV['SCOPE']='indexable'
@ -38,5 +45,5 @@ namespace :importer do
end
desc "Run all tasks"
task :all => [:importuser,:importproject,:importcourse,:importattachment,:importmemo]
task :all => [:importuser,:importsyllabus,:importcourse,:importattachment,:importproject,:importmemo]
end