Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh
This commit is contained in:
commit
967c377191
|
@ -161,7 +161,13 @@ class AttachmentsController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def autocomplete
|
def autocomplete
|
||||||
|
# modify by nwb
|
||||||
|
if params[:project_id]
|
||||||
@project = Project.find_by_id(params[:project_id])
|
@project = Project.find_by_id(params[:project_id])
|
||||||
|
elsif params[:course_id]
|
||||||
|
@course = Course.find_by_id(params[:course_id])
|
||||||
|
end
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.js
|
format.js
|
||||||
end
|
end
|
||||||
|
@ -197,6 +203,35 @@ class AttachmentsController < ApplicationController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def add_exist_file_to_course
|
||||||
|
class_id = params[:class_id]
|
||||||
|
attachments = params[:attachment][:attach]
|
||||||
|
|
||||||
|
obj = Course.find_by_id(class_id)
|
||||||
|
attachments.collect do |attach_id|
|
||||||
|
ori = Attachment.find_by_id(attach_id)
|
||||||
|
next if ori.blank?
|
||||||
|
attach_copied_obj = ori.copy
|
||||||
|
attach_copied_obj.tag_list.add(ori.tag_list) # tag关联
|
||||||
|
attach_copied_obj.container = obj
|
||||||
|
attach_copied_obj.created_on = Time.now
|
||||||
|
attach_copied_obj.author_id = User.current.id
|
||||||
|
@obj = obj
|
||||||
|
@save_flag = attach_copied_obj.save
|
||||||
|
@save_message = attach_copied_obj.errors.full_messages
|
||||||
|
end
|
||||||
|
|
||||||
|
respond_to do |format|
|
||||||
|
format.js
|
||||||
|
end
|
||||||
|
rescue NoMethodError
|
||||||
|
@save_flag = false
|
||||||
|
@save_message = [] << l(:error_attachment_empty)
|
||||||
|
respond_to do |format|
|
||||||
|
format.js
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
def find_project
|
def find_project
|
||||||
@attachment = Attachment.find(params[:id])
|
@attachment = Attachment.find(params[:id])
|
||||||
|
|
|
@ -122,7 +122,7 @@ class MembersController < ApplicationController
|
||||||
user_ids = attrs.delete(:user_ids)
|
user_ids = attrs.delete(:user_ids)
|
||||||
user_ids.each do |user_id|
|
user_ids.each do |user_id|
|
||||||
members << Member.new(:role_ids => params[:membership][:role_ids], :user_id => user_id)
|
members << Member.new(:role_ids => params[:membership][:role_ids], :user_id => user_id)
|
||||||
user_grades << UserGrade.new(:user_id => user_id, :course_id => @course.id)
|
#user_grades << UserGrade.new(:user_id => user_id, :course_id => @course.id)
|
||||||
if (params[:membership][:role_ids] && params[:membership][:role_ids][0] == "3")
|
if (params[:membership][:role_ids] && params[:membership][:role_ids][0] == "3")
|
||||||
course_info << CourseInfo.new(:user_id => user_id, :course_id => @course.id)
|
course_info << CourseInfo.new(:user_id => user_id, :course_id => @course.id)
|
||||||
end
|
end
|
||||||
|
|
|
@ -256,14 +256,14 @@ class TagsController < ApplicationController
|
||||||
|
|
||||||
# 获取有某类对象的tag总数
|
# 获取有某类对象的tag总数
|
||||||
def get_tags_size
|
def get_tags_size
|
||||||
@issues_tags_num = Issue.tag_counts.size
|
@issues_tags_num = ActsAsTaggableOn::Tagging.where(taggable_type:"Issue").count
|
||||||
@projects_tags_num = Project.tag_counts.size
|
@projects_tags_num = ActsAsTaggableOn::Tagging.where(taggable_type:"Project").count
|
||||||
@users_tags_num = User.tag_counts.size
|
@users_tags_num = ActsAsTaggableOn::Tagging.where(taggable_type:"User").count
|
||||||
@bids_tags_num = Bid.tag_counts.size
|
@bids_tags_num = ActsAsTaggableOn::Tagging.where(taggable_type:"Bid").count
|
||||||
forum_tags_num = Forum.tag_counts.size
|
forum_tags_num = ActsAsTaggableOn::Tagging.where(taggable_type:"Forum").count
|
||||||
attachment_tags_num = Attachment.tag_counts.size
|
attachment_tags_num = ActsAsTaggableOn::Tagging.where(taggable_type:"Attachment").count
|
||||||
@open_source_projects_num = OpenSourceProject.tag_counts.size
|
@open_source_projects_num = ActsAsTaggableOn::Tagging.where(taggable_type:"OpenSourceProject").count
|
||||||
@contests_tags_num = Contest.tag_counts.size
|
@contests_tags_num = ActsAsTaggableOn::Tagging.where(taggable_type:"Contest").count
|
||||||
return @users_tags_num,@projects_tags_num,@issues_tags_num,@bids_tags_num, forum_tags_num, attachment_tags_num, @contests_tags_num, @open_source_projects_num
|
return @users_tags_num,@projects_tags_num,@issues_tags_num,@bids_tags_num, forum_tags_num, attachment_tags_num, @contests_tags_num, @open_source_projects_num
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -52,6 +52,7 @@ class UsersController < ApplicationController
|
||||||
helper :custom_fields
|
helper :custom_fields
|
||||||
include CustomFieldsHelper
|
include CustomFieldsHelper
|
||||||
include AvatarHelper
|
include AvatarHelper
|
||||||
|
include WordsHelper
|
||||||
|
|
||||||
# added by liuping 关注
|
# added by liuping 关注
|
||||||
|
|
||||||
|
@ -235,6 +236,9 @@ class UsersController < ApplicationController
|
||||||
def user_newfeedback
|
def user_newfeedback
|
||||||
@jours = @user.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC')
|
@jours = @user.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC')
|
||||||
@jours.update_all(:is_readed => true, :status => false)
|
@jours.update_all(:is_readed => true, :status => false)
|
||||||
|
@jours.each do |journal|
|
||||||
|
fetch_user_leaveWord_reply(journal).update_all(:is_readed => true, :status => false)
|
||||||
|
end
|
||||||
|
|
||||||
@limit = 10
|
@limit = 10
|
||||||
@feedback_count = @jours.count
|
@feedback_count = @jours.count
|
||||||
|
|
|
@ -57,6 +57,7 @@ class WordsController < ApplicationController
|
||||||
reply_id = params[:reference_message_id] # 暂时不实现
|
reply_id = params[:reference_message_id] # 暂时不实现
|
||||||
content = params[:user_notes]
|
content = params[:user_notes]
|
||||||
options = {:user_id => author_id,
|
options = {:user_id => author_id,
|
||||||
|
:status => true,
|
||||||
:m_parent_id => parent_id,
|
:m_parent_id => parent_id,
|
||||||
:m_reply_id => reply_id,
|
:m_reply_id => reply_id,
|
||||||
:reply_id => reply_user_id,
|
:reply_id => reply_user_id,
|
||||||
|
|
|
@ -115,7 +115,7 @@ module AttachmentsHelper
|
||||||
|
|
||||||
s = content_tag('div', attachments_check_box_tags('attachment[attach][]', searched_attach), :id => 'attachments')
|
s = content_tag('div', attachments_check_box_tags('attachment[attach][]', searched_attach), :id => 'attachments')
|
||||||
links = pagination_links_full(@obj_pages, @obj_count, :per_page_links => false) {|text, parameters, options|
|
links = pagination_links_full(@obj_pages, @obj_count, :per_page_links => false) {|text, parameters, options|
|
||||||
link_to text, attachments_autocomplete_path( parameters.merge(:q => params[:q], :format => 'js')), :remote => true }
|
link_to text, attachments_autocomplete_path( parameters.merge(:project_id=>project.id,:q => params[:q], :format => 'js')), :remote => true }
|
||||||
|
|
||||||
return s + content_tag('div', content_tag('ul', links), :class => 'pagination')
|
return s + content_tag('div', content_tag('ul', links), :class => 'pagination')
|
||||||
|
|
||||||
|
@ -133,6 +133,35 @@ module AttachmentsHelper
|
||||||
# return searched_attach.to_json
|
# return searched_attach.to_json
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# add by nwb
|
||||||
|
def render_attachments_for_new_course(course, limit=nil)
|
||||||
|
# 查询条件
|
||||||
|
params[:q] ||= ""
|
||||||
|
filename_condition = params[:q].strip
|
||||||
|
|
||||||
|
attachAll = Attachment.scoped
|
||||||
|
|
||||||
|
# 除去当前课程的所有资源
|
||||||
|
nobelong_attach = Attachment.where("!(container_type = '#{course.class}' and container_id = #{course.id})") unless course.blank?
|
||||||
|
|
||||||
|
# 搜索域确定
|
||||||
|
domain = course.nil? ? attachAll : nobelong_attach
|
||||||
|
|
||||||
|
# 搜索到的资源
|
||||||
|
searched_attach = domain.where("filename LIKE :like ", like:"%#{filename_condition}%").limit(limit).order('created_on desc')
|
||||||
|
searched_attach = private_filter searched_attach
|
||||||
|
searched_attach = paginateHelper(searched_attach, 10)
|
||||||
|
|
||||||
|
#testattach = Attachment.public_attachments
|
||||||
|
|
||||||
|
s = content_tag('div', attachments_check_box_tags('attachment[attach][]', searched_attach), :id => 'attachments')
|
||||||
|
links = pagination_links_full(@obj_pages, @obj_count, :per_page_links => false) {|text, parameters, options|
|
||||||
|
link_to text, attachments_autocomplete_path( parameters.merge(:course_id=>course.id,:q => params[:q], :format => 'js')), :remote => true }
|
||||||
|
|
||||||
|
return s + content_tag('div', content_tag('ul', links), :class => 'pagination')
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
def attachments_check_box_tags(name, attachs)
|
def attachments_check_box_tags(name, attachs)
|
||||||
s = ''
|
s = ''
|
||||||
attachs.each do |attach|
|
attachs.each do |attach|
|
||||||
|
@ -144,18 +173,22 @@ module AttachmentsHelper
|
||||||
def private_filter resultSet
|
def private_filter resultSet
|
||||||
result = resultSet.to_a.dup
|
result = resultSet.to_a.dup
|
||||||
|
|
||||||
|
# modify by nwb
|
||||||
|
#添加对课程资源文件的判断
|
||||||
resultSet.map { |res|
|
resultSet.map { |res|
|
||||||
if(res.container.nil? ||
|
if(res.container.nil? ||
|
||||||
(res.container.class.to_s=="Project" && res.container.is_public == false) ||
|
(res.container.class.to_s=="Project" && res.container.is_public == false) ||
|
||||||
(res.container.has_attribute?(:project) && res.container.project.is_public == false) ||
|
(res.container.has_attribute?(:project) && res.container.project && res.container.project.is_public == false) ||
|
||||||
(res.container.class.to_s=="HomeworkAttach" && res.container.bid.reward_type == 3) ||
|
(res.container.class.to_s=="HomeworkAttach" && res.container.bid.reward_type == 3) ||
|
||||||
false
|
(res.container.class.to_s=="Course" && res.container.is_public == false) ||
|
||||||
|
(res.container.has_attribute?(:course) && res.container.course && res.container.course.is_public == false)
|
||||||
)
|
)
|
||||||
result.delete(res)
|
result.delete(res)
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
include Redmine::Pagination
|
include Redmine::Pagination
|
||||||
def paginateHelper obj, pre_size=10
|
def paginateHelper obj, pre_size=10
|
||||||
@obj_count = obj.count
|
@obj_count = obj.count
|
||||||
|
|
|
@ -235,6 +235,7 @@ module WelcomeHelper
|
||||||
def show_grade project
|
def show_grade project
|
||||||
grade = 0
|
grade = 0
|
||||||
begin
|
begin
|
||||||
|
#ActiveRecord::Base.connection.execute("CALL sp_project_status_cursor();")#执行存储过程速度慢
|
||||||
grade = project.project_status.grade if project && project.project_status
|
grade = project.project_status.grade if project && project.project_status
|
||||||
rescue Exception => e
|
rescue Exception => e
|
||||||
logger.error "Logger.Error [WelcomeHelper] ===> #{e}"
|
logger.error "Logger.Error [WelcomeHelper] ===> #{e}"
|
||||||
|
|
|
@ -68,6 +68,106 @@ class Attachment < ActiveRecord::Base
|
||||||
before_save :be_user_score # user_score
|
before_save :be_user_score # user_score
|
||||||
after_destroy :delete_from_disk
|
after_destroy :delete_from_disk
|
||||||
|
|
||||||
|
# add by nwb
|
||||||
|
# 获取所有可公开的资源文件列表
|
||||||
|
scope :public_attachments, lambda {
|
||||||
|
#joins(Project.table_name).where("container_type = 'Project' and ")
|
||||||
|
joins("LEFT JOIN #{Project.table_name} ON #{Attachment.table_name}.container_type='Project' AND #{Project.table_name}.id = #{Attachment.table_name}.container_id and #{Project.table_name}.is_public=1 " +
|
||||||
|
" LEFT JOIN #{Document.table_name} ON #{Attachment.table_name}.container_type='Project' AND #{Document.table_name}.project_id in "+self.public_project_id +
|
||||||
|
" LEFT JOIN #{Issue.table_name} ON #{Attachment.table_name}.container_type='Project' AND #{Issue.table_name}.project_id in "+self.public_project_id +
|
||||||
|
" LEFT JOIN #{Version.table_name} ON #{Attachment.table_name}.container_type='Project' AND #{Version.table_name}.project_id in "+self.public_project_id +
|
||||||
|
" LEFT JOIN #{WikiPage.table_name} ON #{Attachment.table_name}.container_type='WikiPage' AND #{WikiPage.table_name}.parent_id in "+self.public_wiki_id +
|
||||||
|
" LEFT JOIN #{Message.table_name} ON #{Attachment.table_name}.container_type='Message' AND #{Message.table_name}.parent_id in "+self.public_board_id +
|
||||||
|
" LEFT JOIN #{Course.table_name} ON #{Attachment.table_name}.container_type='Course' AND #{Course.table_name}.is_public=1 " +
|
||||||
|
" LEFT JOIN #{News.table_name} ON #{Attachment.table_name}.container_type='News' AND (#{News.table_name}.project_id in "+self.public_project_id + " OR #{News.table_name}.course_id in " + self.public_course_id + ")" +
|
||||||
|
" LEFT JOIN #{HomeworkAttach.table_name} ON #{Attachment.table_name}.container_type='HomeworkAttach' AND #{HomeworkAttach.table_name}.bid_id in "+self.public_bid_id)
|
||||||
|
}
|
||||||
|
|
||||||
|
# add by nwb
|
||||||
|
# 公开的项目id列表
|
||||||
|
def self.public_project_id
|
||||||
|
idlist = "("
|
||||||
|
projects=Project.all_public
|
||||||
|
count = projects.count
|
||||||
|
for i in 0...count
|
||||||
|
project = projects[i]
|
||||||
|
idlist+="'" + project.id.to_s + "'"
|
||||||
|
if i != count-1
|
||||||
|
idlist+=","
|
||||||
|
end
|
||||||
|
end
|
||||||
|
idlist += ")"
|
||||||
|
idlist
|
||||||
|
end
|
||||||
|
|
||||||
|
# add by nwb
|
||||||
|
# 公开的课程id列表
|
||||||
|
def self.public_course_id
|
||||||
|
idlist = "("
|
||||||
|
courses=Course.all_public
|
||||||
|
count = courses.count
|
||||||
|
for i in 0...count
|
||||||
|
course = courses[i]
|
||||||
|
idlist+="'" + course.id.to_s + "'"
|
||||||
|
if i != count-1
|
||||||
|
idlist = idlist + ","
|
||||||
|
end
|
||||||
|
end
|
||||||
|
idlist += ")"
|
||||||
|
idlist
|
||||||
|
end
|
||||||
|
|
||||||
|
# add by nwb
|
||||||
|
# 公开的wiki id列表
|
||||||
|
def self.public_wiki_id
|
||||||
|
idlist = "("
|
||||||
|
wikis=Wiki.where("project_id in " + public_project_id)
|
||||||
|
count = wikis.count
|
||||||
|
for i in 0...count
|
||||||
|
wiki = wikis[i]
|
||||||
|
idlist+="'" + wiki.id.to_s + "'"
|
||||||
|
if i != count-1
|
||||||
|
idlist = idlist + ","
|
||||||
|
end
|
||||||
|
end
|
||||||
|
idlist += ")"
|
||||||
|
idlist
|
||||||
|
end
|
||||||
|
|
||||||
|
# add by nwb
|
||||||
|
# 公开的board id列表
|
||||||
|
def self.public_board_id
|
||||||
|
idlist = "("
|
||||||
|
boards=Board.where("project_id in " + public_project_id + " or course_id in " + public_course_id)
|
||||||
|
count = boards.count
|
||||||
|
for i in 0...count
|
||||||
|
board = boards[i]
|
||||||
|
idlist+="'" + board.id.to_s + "'"
|
||||||
|
if i != count-1
|
||||||
|
idlist = idlist + ","
|
||||||
|
end
|
||||||
|
end
|
||||||
|
idlist += ")"
|
||||||
|
idlist
|
||||||
|
end
|
||||||
|
|
||||||
|
# add by nwb
|
||||||
|
# 公开的bid id列表
|
||||||
|
def self.public_bid_id
|
||||||
|
idlist = "("
|
||||||
|
bids=Bid.where("reward_type=3")
|
||||||
|
count = bids.count
|
||||||
|
for i in 0...count
|
||||||
|
bid = bids[i]
|
||||||
|
idlist+="'" + bid.id.to_s + "'"
|
||||||
|
if i != count-1
|
||||||
|
idlist = idlist + ","
|
||||||
|
end
|
||||||
|
end
|
||||||
|
idlist += ")"
|
||||||
|
idlist
|
||||||
|
end
|
||||||
|
|
||||||
# Returns an unsaved copy of the attachment
|
# Returns an unsaved copy of the attachment
|
||||||
def copy(attributes=nil)
|
def copy(attributes=nil)
|
||||||
copy = self.class.new
|
copy = self.class.new
|
||||||
|
|
|
@ -117,6 +117,15 @@ class JournalsForMessage < ActiveRecord::Base
|
||||||
update_all("m_reply_count = #{count.to_i}", ["id = ?", journals_for_messages.m_parent_id])
|
update_all("m_reply_count = #{count.to_i}", ["id = ?", journals_for_messages.m_parent_id])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
#如果是在项目中留言则返回该项目否则返回nil - zjc
|
||||||
|
def project
|
||||||
|
if self.jour_type == 'Project'
|
||||||
|
Project.find(self.jour_id)
|
||||||
|
else
|
||||||
|
nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
# 更新用户分数 -by zjc
|
# 更新用户分数 -by zjc
|
||||||
def be_user_score
|
def be_user_score
|
||||||
#新建了留言回复
|
#新建了留言回复
|
||||||
|
|
|
@ -202,7 +202,8 @@ class User < Principal
|
||||||
where(nil)
|
where(nil)
|
||||||
else
|
else
|
||||||
pattern = "%#{arg.to_s.strip.downcase}%"
|
pattern = "%#{arg.to_s.strip.downcase}%"
|
||||||
where(" LOWER(concat(lastname, firstname)) LIKE :p ", :p => pattern)
|
#where(" LOWER(concat(lastname, firstname)) LIKE :p ", :p => pattern)
|
||||||
|
where(" LOWER(login) LIKE :p ", :p => pattern)
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -576,15 +577,16 @@ class User < Principal
|
||||||
# Find a user account by matching the exact login and then a case-insensitive
|
# Find a user account by matching the exact login and then a case-insensitive
|
||||||
# version. Exact matches will be given priority.
|
# version. Exact matches will be given priority.
|
||||||
#通过用户名查找相应的用户,若没有匹配到,则不区分大小写进行查询
|
#通过用户名查找相应的用户,若没有匹配到,则不区分大小写进行查询
|
||||||
|
#修改:不再匹配不区分大小写情况 -zjc
|
||||||
def self.find_by_login(login)
|
def self.find_by_login(login)
|
||||||
if login.present?
|
if login.present?
|
||||||
login = login.to_s
|
login = login.to_s
|
||||||
# First look for an exact match
|
# First look for an exact match
|
||||||
user = where(:login => login).all.detect {|u| u.login == login}
|
user = where(:login => login).all.detect {|u| u.login == login}
|
||||||
unless user
|
#unless user
|
||||||
# Fail over to case-insensitive if none was found
|
# # Fail over to case-insensitive if none was found
|
||||||
user = where("LOWER(login) = ?", login.downcase).first
|
# user = where("LOWER(login) = ?", login.downcase).first
|
||||||
end
|
#end
|
||||||
user
|
user
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,4 +2,37 @@ class UserGrade < ActiveRecord::Base
|
||||||
# attr_accessible :title, :body
|
# attr_accessible :title, :body
|
||||||
attr_accessible :user_id, :project_id, :grade
|
attr_accessible :user_id, :project_id, :grade
|
||||||
belongs_to :project
|
belongs_to :project
|
||||||
|
before_save :correct_score
|
||||||
|
validates_uniqueness_of :user_id, :scope => [:project_id]
|
||||||
|
#validate :my_validation
|
||||||
|
|
||||||
|
#修正分数
|
||||||
|
#分数小于0时修正为0
|
||||||
|
#分数大于等于0时不修正 -by zjc
|
||||||
|
def correct_score
|
||||||
|
if !self.grade.nil? && self.grade < 0
|
||||||
|
self.grade = 0
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
#def self.exit_user_and_project(user,project)
|
||||||
|
# unless user.nil? || project.nil?
|
||||||
|
# if user.class.to_s == 'User' && project.class.to_s == 'Project'
|
||||||
|
# user_grade = UserGrade.find_by_user_id_and_project_id(user.id,project.id)
|
||||||
|
# user_grade
|
||||||
|
# else
|
||||||
|
# nil
|
||||||
|
# end
|
||||||
|
# else
|
||||||
|
# nil
|
||||||
|
# end
|
||||||
|
#end
|
||||||
|
|
||||||
|
#def my_validation
|
||||||
|
# if user_id.nil? || project_id.nil?
|
||||||
|
# errors[:Base] << "用户和项目不能为空"
|
||||||
|
# elsif UserGrade.exit_user_and_project(user_id,project_id)
|
||||||
|
# errors[:Base] << "当前记录已存在"
|
||||||
|
# end
|
||||||
|
#end
|
||||||
end
|
end
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
<% if @save_flag %>
|
||||||
|
window.location.reload();
|
||||||
|
<% else %>
|
||||||
|
// alert('添加文件失败:\n<%=@save_message[0]%>');
|
||||||
|
$('#ajax-modal').html('<h3 class="title">添加文件失败</h3><%=@save_message.join(', ')%>');
|
||||||
|
|
||||||
|
var el = $('#ajax-modal').first();
|
||||||
|
var title = el.find('h3.title').text();
|
||||||
|
el.dialog({
|
||||||
|
width: '200px',
|
||||||
|
modal: true,
|
||||||
|
resizable: false,
|
||||||
|
dialogClass: 'modal',
|
||||||
|
title: title
|
||||||
|
});
|
||||||
|
|
||||||
|
<% end %>
|
|
@ -1,2 +1,7 @@
|
||||||
$('#relation_file_form').show();
|
$('#relation_file_form').show();
|
||||||
|
<% if @project%>
|
||||||
$('#relation_file').html('<%=render_attachments_for_new_project(@project, nil)%>');
|
$('#relation_file').html('<%=render_attachments_for_new_project(@project, nil)%>');
|
||||||
|
<% elsif @course%>
|
||||||
|
$('#relation_file').html('<%=render_attachments_for_new_course(@course, nil)%>');
|
||||||
|
<% end%>
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@
|
||||||
<%= text_field_tag(:attach_search) %>
|
<%= text_field_tag(:attach_search) %>
|
||||||
<%#= submit_tag("Search") %>
|
<%#= submit_tag("Search") %>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
<%= form_tag attach_relation_path(:format => 'js'),
|
<%= form_tag course_attach_relation_path(:format => 'js'),
|
||||||
method: :post,
|
method: :post,
|
||||||
remote: true,
|
remote: true,
|
||||||
id: "relation_file_form",
|
id: "relation_file_form",
|
||||||
|
|
|
@ -13,10 +13,6 @@
|
||||||
<%= select_tag "version_id", content_tag('option', '') +
|
<%= select_tag "version_id", content_tag('option', '') +
|
||||||
options_from_collection_for_select(versions, "id", "name"), {style: 'width:100px'} %>
|
options_from_collection_for_select(versions, "id", "name"), {style: 'width:100px'} %>
|
||||||
</td>
|
</td>
|
||||||
<% else %>
|
|
||||||
<td><p></p></td> <td></td>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<% if attachmenttypes.any? %>
|
<% if attachmenttypes.any? %>
|
||||||
<td><%= l(:attachment_type) %></label></td>
|
<td><%= l(:attachment_type) %></label></td>
|
||||||
<td>
|
<td>
|
||||||
|
@ -25,6 +21,17 @@
|
||||||
"typeName", 2), {style: 'width:100px'} %>
|
"typeName", 2), {style: 'width:100px'} %>
|
||||||
</td>
|
</td>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<% else %>
|
||||||
|
<p>
|
||||||
|
<% if attachmenttypes.any? %>
|
||||||
|
<%= l(:attachment_type) %></label>
|
||||||
|
<%= select_tag "attachment_type",
|
||||||
|
options_from_collection_for_select(attachmenttypes, "id",
|
||||||
|
"typeName", 2), {style: 'width:100px'} %>
|
||||||
|
<% end %>
|
||||||
|
</p>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="debug">
|
<div class="debug hidden">
|
||||||
<%= debug(params) if Rails.env.development? %>
|
<%= debug(params) if Rails.env.development? %>
|
||||||
|
|
||||||
<script src="http://s4.cnzz.com/z_stat.php?id=1000482288&web_id=1000482288" language="JavaScript"></script>
|
<script src="http://s4.cnzz.com/z_stat.php?id=1000482288&web_id=1000482288" language="JavaScript"></script>
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
<div class="box ph10_5">
|
<div class="box ph10_5">
|
||||||
<!--[form:message]-->
|
<!--[form:message]-->
|
||||||
<p><label for="message_subject"><%= l(:field_subject) %></label><br />
|
<p><label for="message_subject"><%= l(:field_subject) %><span class="required"> * </span></label><br />
|
||||||
<%= f.text_field :subject,:size => 60, :style => "width: 99%;", :id => "message_subject" %><!--by young-->
|
<%= f.text_field :subject,:size => 60, :style => "width: 99%;", :id => "message_subject" %><!--by young-->
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
|
|
|
@ -101,7 +101,7 @@
|
||||||
<td align="center"><strong class="font_small_watch"><%= get_praise_num(obj)%></strong></td>
|
<td align="center"><strong class="font_small_watch"><%= get_praise_num(obj)%></strong></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><%= image_tag "/images/praise_tread/tread_true.png",weight:"22px", height:"22px",:title => l(:label_issue_not_tread_over) %> </td>
|
<td><%= image_tag "/images/praise_tread/tread_true.png",weight:"22px", height:"22px",:title => l(:label_issue_not_treed_over) %> </td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<% else %>
|
<% else %>
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
<% else %>
|
<% else %>
|
||||||
<div class="user_course_list menu-div">
|
<div class="user_course_list menu-div">
|
||||||
<div class="menu">
|
<div class="menu">
|
||||||
<%= link_to"#{l(:label_course_view_student)}",course_path(course: 1), :class => 'icon icon-add' %>
|
<%= link_to"#{l(:label_course_view_student)}",courses_path, :class => 'icon icon-add' %>
|
||||||
<ul>
|
<ul>
|
||||||
<li mode='doing' class="on">进行中</li>
|
<li mode='doing' class="on">进行中</li>
|
||||||
<li mode='end'>已完结</li>
|
<li mode='end'>已完结</li>
|
||||||
|
|
|
@ -68,7 +68,33 @@
|
||||||
<span class='font_lighter' title =<%=project.description.to_s%>><%=project.description.truncate(50, omission: '...')%></span>
|
<span class='font_lighter' title =<%=project.description.to_s%>><%=project.description.truncate(50, omission: '...')%></span>
|
||||||
</div>
|
</div>
|
||||||
<div style="position:absolute; bottom:0;right:0;margin:5px 10px 5px 5px ;">
|
<div style="position:absolute; bottom:0;right:0;margin:5px 10px 5px 5px ;">
|
||||||
<%= content_tag "span", show_grade(project),
|
<% issue_count = project.issues.count %>
|
||||||
|
<% issue_journal_count = project.issue_changes.count %>
|
||||||
|
<% issue_score = issue_count * 0.2 %>
|
||||||
|
<% issue_journal_score = issue_journal_count * 0.1 %>
|
||||||
|
<% finall_issue_score = issue_score + issue_journal_score %>
|
||||||
|
|
||||||
|
<% new_count = project.news.count %>
|
||||||
|
<% new_score = new_count * 0.1 %>
|
||||||
|
<% finall_new_score = new_score %>
|
||||||
|
|
||||||
|
<% document_count = project.documents.count %>
|
||||||
|
<% file_score = document_count * 0.1 %>
|
||||||
|
<% finall_file_score = file_score %>
|
||||||
|
|
||||||
|
<% changeset_count = project.changesets.count %>
|
||||||
|
<% code_submit_score = changeset_count * 0.3 %>
|
||||||
|
<% finall_code_submit_score = code_submit_score %>
|
||||||
|
|
||||||
|
<% board_message_count = 0 %>
|
||||||
|
<% project.boards.each do |board| %>
|
||||||
|
<% board_message_count += board.messages_count %>
|
||||||
|
<% end %>
|
||||||
|
<% topic_score = board_message_count * 0.1 %>
|
||||||
|
<% finall_topic_score = topic_score %>
|
||||||
|
|
||||||
|
<% finall_project_score = finall_issue_score + finall_new_score + finall_file_score + finall_code_submit_score + topic_score %>
|
||||||
|
<%= content_tag "span", l(:label_project_score)+ ":" + format("%.2f" , finall_project_score ),
|
||||||
:style => "cursor: pointer; display: inline-block; float: right; color: #ec6300; ",
|
:style => "cursor: pointer; display: inline-block; float: right; color: #ec6300; ",
|
||||||
:title => "项目得分,综合考虑了项目的各项活动,反映了该项目的活跃程度",
|
:title => "项目得分,综合考虑了项目的各项活动,反映了该项目的活跃程度",
|
||||||
:class => "tooltip",
|
:class => "tooltip",
|
||||||
|
|
|
@ -500,6 +500,7 @@ zh:
|
||||||
label_project_new: 新建项目
|
label_project_new: 新建项目
|
||||||
label_project_new_description: '项目可以是软件开发项目,也可以是协作研究项目。'
|
label_project_new_description: '项目可以是软件开发项目,也可以是协作研究项目。'
|
||||||
label_project_plural: 项目列表
|
label_project_plural: 项目列表
|
||||||
|
label_project_score: 项目评分
|
||||||
label_x_projects:
|
label_x_projects:
|
||||||
zero: 无项目
|
zero: 无项目
|
||||||
one: 1 个项目
|
one: 1 个项目
|
||||||
|
|
|
@ -510,6 +510,7 @@ RedmineApp::Application.routes.draw do
|
||||||
get 'attachments/autocomplete'
|
get 'attachments/autocomplete'
|
||||||
match 'attachments/autocomplete', :to => 'attachments#autocomplete', via: [:post]
|
match 'attachments/autocomplete', :to => 'attachments#autocomplete', via: [:post]
|
||||||
post 'attachments/relationfile', to: 'attachments#add_exist_file_to_project', as: 'attach_relation'
|
post 'attachments/relationfile', to: 'attachments#add_exist_file_to_project', as: 'attach_relation'
|
||||||
|
post 'attachments/courserelationfile', to: 'attachments#add_exist_file_to_course', as: 'course_attach_relation'
|
||||||
get 'attachments/renderTag/:attchmentId', :to => 'attachments#renderTag', :attchmentId => /\d+/
|
get 'attachments/renderTag/:attchmentId', :to => 'attachments#renderTag', :attchmentId => /\d+/
|
||||||
resources :attachments, :only => [:show, :destroy] do
|
resources :attachments, :only => [:show, :destroy] do
|
||||||
collection do
|
collection do
|
||||||
|
|
|
@ -11,7 +11,7 @@ class AddBoardsTypeToBoards < ActiveRecord::Migration
|
||||||
if project && project.project_type == 1
|
if project && project.project_type == 1
|
||||||
board.course_id = project.course_extra.id
|
board.course_id = project.course_extra.id
|
||||||
board.project_id = -1
|
board.project_id = -1
|
||||||
board.save
|
board.save(:validate => false)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -8,13 +8,19 @@ class StoredCourseProcedure < ActiveRecord::Migration
|
||||||
if project.project_type == 1
|
if project.project_type == 1
|
||||||
course = Course.find_by_extra(project.identifier)
|
course = Course.find_by_extra(project.identifier)
|
||||||
if course
|
if course
|
||||||
course.name = project.name
|
sql = "update courses set name='" + project.name.to_s + "',description='"
|
||||||
course.description = project.description
|
sql += project.description.to_s + "',status=" + project.status.to_s
|
||||||
course.status = project.status
|
sql += ",attachmenttype=2 where id=" +course.id.to_s
|
||||||
course.attachmenttype = 2
|
execute(sql)
|
||||||
|
|
||||||
|
# 以下方式保存,描述等经常不能成功
|
||||||
|
#course.name = project.name
|
||||||
|
#course.description = project.description
|
||||||
|
#course.status = project.status
|
||||||
|
#course.attachmenttype = 2
|
||||||
#course.lft = project.lft
|
#course.lft = project.lft
|
||||||
#course.rgt = project.rgt
|
#course.rgt = project.rgt
|
||||||
course.save
|
#course.save(:validate => false)
|
||||||
|
|
||||||
# 更新状态表
|
# 更新状态表
|
||||||
projectstatus = ProjectStatus.find_by_project_id(project.id)
|
projectstatus = ProjectStatus.find_by_project_id(project.id)
|
||||||
|
@ -25,7 +31,7 @@ class StoredCourseProcedure < ActiveRecord::Migration
|
||||||
courseStatus.watchers_count = projectstatus.watchers_count
|
courseStatus.watchers_count = projectstatus.watchers_count
|
||||||
courseStatus.grade = projectstatus.grade
|
courseStatus.grade = projectstatus.grade
|
||||||
courseStatus.course_ac_para = projectstatus.course_ac_para
|
courseStatus.course_ac_para = projectstatus.course_ac_para
|
||||||
courseStatus.save
|
courseStatus.save(:validate => false)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -6,12 +6,13 @@ class AddCourseidToEnabledModules < ActiveRecord::Migration
|
||||||
#EnabledModule.where('project_id IN (SELECT id FROM projects WHERE project_type=1)').update_all("course_id = project_id")
|
#EnabledModule.where('project_id IN (SELECT id FROM projects WHERE project_type=1)').update_all("course_id = project_id")
|
||||||
#EnabledModule.where('project_id IN (SELECT id FROM projects WHERE project_type=1)').update_all(project_id: -1)
|
#EnabledModule.where('project_id IN (SELECT id FROM projects WHERE project_type=1)').update_all(project_id: -1)
|
||||||
|
|
||||||
|
|
||||||
EnabledModule.all.each do |enablemodule|
|
EnabledModule.all.each do |enablemodule|
|
||||||
project = Project.find_by_id(enablemodule.project_id)
|
project = Project.find_by_id(enablemodule.project_id)
|
||||||
if project && project.project_type == 1
|
if project && project.project_type == 1
|
||||||
enablemodule.course_id = project.course_extra.id
|
enablemodule.course_id = project.course_extra.id
|
||||||
enablemodule.project_id = -1
|
enablemodule.project_id = -1
|
||||||
enablemodule.save
|
enablemodule.save(:validate => false)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -15,7 +15,7 @@ class AddCourseidToToMembers < ActiveRecord::Migration
|
||||||
if project && project.project_type == 1
|
if project && project.project_type == 1
|
||||||
member.course_id = project.course_extra.id
|
member.course_id = project.course_extra.id
|
||||||
member.project_id = -1
|
member.project_id = -1
|
||||||
member.save
|
member.save(:validate => false)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -7,7 +7,7 @@ class RenameProjectIdToHomeworkForCourses < ActiveRecord::Migration
|
||||||
project = Project.find_by_id(work.course_id)
|
project = Project.find_by_id(work.course_id)
|
||||||
if project && project.project_type == 1
|
if project && project.project_type == 1
|
||||||
work.course_id = project.course_extra.id
|
work.course_id = project.course_extra.id
|
||||||
work.save
|
work.save(:validate => false)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -16,7 +16,7 @@ class CreateCourseInfos < ActiveRecord::Migration
|
||||||
courseinfo = CourseInfos.new
|
courseinfo = CourseInfos.new
|
||||||
courseinfo.course_id = course.id
|
courseinfo.course_id = course.id
|
||||||
courseinfo.user_id = projinfo.user_id
|
courseinfo.user_id = projinfo.user_id
|
||||||
courseinfo.save
|
courseinfo.save(:validate => false)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -7,7 +7,7 @@ class MigrateCourseTags < ActiveRecord::Migration
|
||||||
if project && project.project_type == 1
|
if project && project.project_type == 1
|
||||||
tagging.taggable_type= 'Course'
|
tagging.taggable_type= 'Course'
|
||||||
tagging.taggable_id = project.course_extra.id
|
tagging.taggable_id = project.course_extra.id
|
||||||
tagging.save
|
tagging.save(:validate => false)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -6,7 +6,7 @@ class MigrateCourseJournals < ActiveRecord::Migration
|
||||||
if project && project.project_type == 1
|
if project && project.project_type == 1
|
||||||
journal.jour_type = 'Course'
|
journal.jour_type = 'Course'
|
||||||
journal.jour_id = project.course_extra.id
|
journal.jour_id = project.course_extra.id
|
||||||
journal.save
|
journal.save(:validate => false)
|
||||||
end
|
end
|
||||||
# 将自动设置的更新日期还原
|
# 将自动设置的更新日期还原
|
||||||
sql = ActiveRecord::Base.connection()
|
sql = ActiveRecord::Base.connection()
|
||||||
|
|
|
@ -47,7 +47,7 @@ class AddCourseRoles < ActiveRecord::Migration
|
||||||
role.permissions.append(:view_course_files )
|
role.permissions.append(:view_course_files )
|
||||||
role.permissions.append(:view_course_journals_for_messages )
|
role.permissions.append(:view_course_journals_for_messages )
|
||||||
role.permissions.append(:view_course_messages )
|
role.permissions.append(:view_course_messages )
|
||||||
role.save
|
role.save(:validate => false)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ class AddCourseidToNews < ActiveRecord::Migration
|
||||||
if project && project.project_type == 1
|
if project && project.project_type == 1
|
||||||
news.course_id = project.course_extra.id
|
news.course_id = project.course_extra.id
|
||||||
news.project_id = -1
|
news.project_id = -1
|
||||||
news.save
|
news.save(:validate => false)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ class RemoveDataToHomeworkAttach < ActiveRecord::Migration
|
||||||
homework.description = biding.description
|
homework.description = biding.description
|
||||||
homework.user_id = biding.user_id
|
homework.user_id = biding.user_id
|
||||||
homework.state = 0
|
homework.state = 0
|
||||||
homework.save
|
homework.save(:validate => false)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ class MigrateCourseStudents < ActiveRecord::Migration
|
||||||
project = Project.find_by_id(student.course_id)
|
project = Project.find_by_id(student.course_id)
|
||||||
if project && project.course_extra
|
if project && project.course_extra
|
||||||
student.course_id = project.course_extra.id
|
student.course_id = project.course_extra.id
|
||||||
student.save
|
student.save(:validate => false)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,7 +4,7 @@ class MigrateCourseFileType < ActiveRecord::Migration
|
||||||
Attachment.all.each do |attach|
|
Attachment.all.each do |attach|
|
||||||
if attach.container_type == "Course" && attach.attachtype == 1
|
if attach.container_type == "Course" && attach.attachtype == 1
|
||||||
attach.attachtype = 4
|
attach.attachtype = 4
|
||||||
attach.save
|
attach.save(:validate => false)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -6,7 +6,7 @@ class ModifyStudentRoles < ActiveRecord::Migration
|
||||||
role = Role.find_by_name('学生')
|
role = Role.find_by_name('学生')
|
||||||
if role
|
if role
|
||||||
role.permissions.append(:add_messages)
|
role.permissions.append(:add_messages)
|
||||||
role.save
|
role.save(:validate => false)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
class AddTagTypeIndexToTagging < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_index :taggings, :taggable_type
|
||||||
|
end
|
||||||
|
end
|
|
@ -17,6 +17,7 @@ namespace :user_score do
|
||||||
users[m.author.id] = users[m.author.id].to_i + 2
|
users[m.author.id] = users[m.author.id].to_i + 2
|
||||||
project = m.project
|
project = m.project
|
||||||
unless project.nil?
|
unless project.nil?
|
||||||
|
if m.author.member_of?(project)
|
||||||
user_grade = UserGrade.find_by_user_id_and_project_id(m.author.id, project.id)
|
user_grade = UserGrade.find_by_user_id_and_project_id(m.author.id, project.id)
|
||||||
if user_grade.nil?
|
if user_grade.nil?
|
||||||
user_grade = UserGrade.create(:user_id => m.author.id, :project_id => project.id)
|
user_grade = UserGrade.create(:user_id => m.author.id, :project_id => project.id)
|
||||||
|
@ -25,6 +26,8 @@ namespace :user_score do
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
end
|
||||||
puts ":post_message calculate Completed. collaboration users count: #{users.count}"
|
puts ":post_message calculate Completed. collaboration users count: #{users.count}"
|
||||||
|
|
||||||
# 对缺陷的留言
|
# 对缺陷的留言
|
||||||
|
@ -32,12 +35,15 @@ namespace :user_score do
|
||||||
users[j.user.id] = users[j.user.id].to_i + 1
|
users[j.user.id] = users[j.user.id].to_i + 1
|
||||||
project = j.project
|
project = j.project
|
||||||
unless project.nil?
|
unless project.nil?
|
||||||
|
if j.user.member_of?(project)
|
||||||
user_grade = UserGrade.find_by_user_id_and_project_id(j.user.id, project.id)
|
user_grade = UserGrade.find_by_user_id_and_project_id(j.user.id, project.id)
|
||||||
if user_grade.nil?
|
if user_grade.nil?
|
||||||
user_grade = UserGrade.create(:user_id => j.user.id, :project_id => project.id)
|
user_grade = UserGrade.create(:user_id => j.user.id, :project_id => project.id)
|
||||||
end
|
end
|
||||||
grades[user_grade.id] = grades[user_grade.id].to_i + 1
|
grades[user_grade.id] = grades[user_grade.id].to_i + 1
|
||||||
end
|
end
|
||||||
|
|
||||||
|
end
|
||||||
end
|
end
|
||||||
puts ":post_issue_message calculate Completed. collaboration users count: #{users.count}"
|
puts ":post_issue_message calculate Completed. collaboration users count: #{users.count}"
|
||||||
|
|
||||||
|
@ -46,6 +52,7 @@ namespace :user_score do
|
||||||
users[j.user.id] = users[j.user.id].to_i + 1
|
users[j.user.id] = users[j.user.id].to_i + 1
|
||||||
project = j.project
|
project = j.project
|
||||||
unless project.nil?
|
unless project.nil?
|
||||||
|
if j.user.member_of?(project)
|
||||||
user_grade = UserGrade.find_by_user_id_and_project_id(j.user.id, project.id)
|
user_grade = UserGrade.find_by_user_id_and_project_id(j.user.id, project.id)
|
||||||
if user_grade.nil?
|
if user_grade.nil?
|
||||||
user_grade = UserGrade.create(:user_id => j.user.id, :project_id => project.id)
|
user_grade = UserGrade.create(:user_id => j.user.id, :project_id => project.id)
|
||||||
|
@ -54,6 +61,8 @@ namespace :user_score do
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
end
|
||||||
puts ":change_issue_status calculate Completed. collaboration users count: #{users.count}"
|
puts ":change_issue_status calculate Completed. collaboration users count: #{users.count}"
|
||||||
|
|
||||||
# 对留言的回复
|
# 对留言的回复
|
||||||
|
@ -67,12 +76,15 @@ namespace :user_score do
|
||||||
users[m.author.id] = users[m.author.id].to_i + 1
|
users[m.author.id] = users[m.author.id].to_i + 1
|
||||||
project = m.project
|
project = m.project
|
||||||
unless project.nil?
|
unless project.nil?
|
||||||
|
if m.author.member_of?(project)
|
||||||
user_grade = UserGrade.find_by_user_id_and_project_id(m.author.id, project.id)
|
user_grade = UserGrade.find_by_user_id_and_project_id(m.author.id, project.id)
|
||||||
if user_grade.nil?
|
if user_grade.nil?
|
||||||
user_grade = UserGrade.create(:user_id =>m.author.id, :project_id => project.id)
|
user_grade = UserGrade.create(:user_id =>m.author.id, :project_id => project.id)
|
||||||
end
|
end
|
||||||
grades[user_grade.id] = grades[user_grade.id].to_i + 1
|
grades[user_grade.id] = grades[user_grade.id].to_i + 1
|
||||||
end
|
end
|
||||||
|
|
||||||
|
end
|
||||||
end
|
end
|
||||||
puts ":reply_posting calculate Completed. collaboration users count: #{users.count}"
|
puts ":reply_posting calculate Completed. collaboration users count: #{users.count}"
|
||||||
|
|
||||||
|
@ -116,69 +128,90 @@ namespace :user_score do
|
||||||
#踩帖
|
#踩帖
|
||||||
users_skill[pt.user.id] = users_skill[pt.user.id].to_i - 2 #踩别人帖-2分
|
users_skill[pt.user.id] = users_skill[pt.user.id].to_i - 2 #踩别人帖-2分
|
||||||
unless project.nil?
|
unless project.nil?
|
||||||
|
if pt.user.member_of?(project)
|
||||||
user_grade = UserGrade.find_by_user_id_and_project_id(pt.user.id, project.id)
|
user_grade = UserGrade.find_by_user_id_and_project_id(pt.user.id, project.id)
|
||||||
if user_grade.nil?
|
if user_grade.nil?
|
||||||
user_grade = UserGrade.create(:user_id =>pt.user.id, :project_id => project.id)
|
user_grade = UserGrade.create(:user_id =>pt.user.id, :project_id => project.id)
|
||||||
end
|
end
|
||||||
grades[user_grade.id] = grades[user_grade.id].to_i - 2
|
grades[user_grade.id] = grades[user_grade.id].to_i - 2
|
||||||
end
|
end
|
||||||
|
|
||||||
|
end
|
||||||
if level == 1
|
if level == 1
|
||||||
users_skill[target_user.id] = users_skill[target_user.id].to_i - 2 #帖子被一级会员踩-2分 add praise_tread
|
users_skill[target_user.id] = users_skill[target_user.id].to_i - 2 #帖子被一级会员踩-2分 add praise_tread
|
||||||
unless project.nil?
|
unless project.nil?
|
||||||
|
if target_user.member_of?(project)
|
||||||
user_grade = UserGrade.find_by_user_id_and_project_id(target_user.id, project.id)
|
user_grade = UserGrade.find_by_user_id_and_project_id(target_user.id, project.id)
|
||||||
if user_grade.nil?
|
if user_grade.nil?
|
||||||
user_grade = UserGrade.create(:user_id =>target_user.id, :project_id => project.id)
|
user_grade = UserGrade.create(:user_id =>target_user.id, :project_id => project.id)
|
||||||
end
|
end
|
||||||
grades[user_grade.id] = grades[user_grade.id].to_i - 2
|
grades[user_grade.id] = grades[user_grade.id].to_i - 2
|
||||||
end
|
end
|
||||||
|
|
||||||
|
end
|
||||||
elsif level == 2
|
elsif level == 2
|
||||||
users_skill[target_user.id] = users_skill[target_user.id].to_i - 4 #帖子被二级会员踩-4分 add praise_tread
|
users_skill[target_user.id] = users_skill[target_user.id].to_i - 4 #帖子被二级会员踩-4分 add praise_tread
|
||||||
unless project.nil?
|
unless project.nil?
|
||||||
|
if target_user.member_of?(project)
|
||||||
user_grade = UserGrade.find_by_user_id_and_project_id(target_user.id, project.id)
|
user_grade = UserGrade.find_by_user_id_and_project_id(target_user.id, project.id)
|
||||||
if user_grade.nil?
|
if user_grade.nil?
|
||||||
user_grade = UserGrade.create(:user_id =>target_user.id, :project_id => project.id)
|
user_grade = UserGrade.create(:user_id =>target_user.id, :project_id => project.id)
|
||||||
end
|
end
|
||||||
grades[user_grade.id] = grades[user_grade.id].to_i - 4
|
grades[user_grade.id] = grades[user_grade.id].to_i - 4
|
||||||
end
|
end
|
||||||
|
|
||||||
|
end
|
||||||
elsif level == 3
|
elsif level == 3
|
||||||
users_skill[target_user.id] = users_skill[target_user.id].to_i - 6 #帖子被三级会员踩-6分 add praise_tread
|
users_skill[target_user.id] = users_skill[target_user.id].to_i - 6 #帖子被三级会员踩-6分 add praise_tread
|
||||||
unless project.nil?
|
unless project.nil?
|
||||||
|
if target_user.member_of?(project)
|
||||||
user_grade = UserGrade.find_by_user_id_and_project_id(target_user.id, project.id)
|
user_grade = UserGrade.find_by_user_id_and_project_id(target_user.id, project.id)
|
||||||
if user_grade.nil?
|
if user_grade.nil?
|
||||||
user_grade = UserGrade.create(:user_id =>target_user.id, :project_id => project.id)
|
user_grade = UserGrade.create(:user_id =>target_user.id, :project_id => project.id)
|
||||||
end
|
end
|
||||||
grades[user_grade.id] = grades[user_grade.id].to_i - 6
|
grades[user_grade.id] = grades[user_grade.id].to_i - 6
|
||||||
end
|
end
|
||||||
|
|
||||||
|
end
|
||||||
end
|
end
|
||||||
elsif pt.praise_or_tread == 1
|
elsif pt.praise_or_tread == 1
|
||||||
#顶贴
|
#顶贴
|
||||||
if level == 1
|
if level == 1
|
||||||
users_skill[target_user.id] = users_skill[target_user.id].to_i + 4 #帖子被一级会员顶+4分 add praise_tread
|
users_skill[target_user.id] = users_skill[target_user.id].to_i + 4 #帖子被一级会员顶+4分 add praise_tread
|
||||||
unless project.nil?
|
unless project.nil?
|
||||||
|
if target_user.member_of?(project)
|
||||||
user_grade = UserGrade.find_by_user_id_and_project_id(target_user.id, project.id)
|
user_grade = UserGrade.find_by_user_id_and_project_id(target_user.id, project.id)
|
||||||
if user_grade.nil?
|
if user_grade.nil?
|
||||||
user_grade = UserGrade.create(:user_id =>target_user.id, :project_id => project.id)
|
user_grade = UserGrade.create(:user_id =>target_user.id, :project_id => project.id)
|
||||||
end
|
end
|
||||||
grades[user_grade.id] = grades[user_grade.id].to_i + 4
|
grades[user_grade.id] = grades[user_grade.id].to_i + 4
|
||||||
end
|
end
|
||||||
|
|
||||||
|
end
|
||||||
elsif level == 2
|
elsif level == 2
|
||||||
users_skill[target_user.id] = users_skill[target_user.id].to_i + 6 #帖子被二级会员顶+6分 add praise_tread
|
users_skill[target_user.id] = users_skill[target_user.id].to_i + 6 #帖子被二级会员顶+6分 add praise_tread
|
||||||
unless project.nil?
|
unless project.nil?
|
||||||
|
if target_user.member_of?(project)
|
||||||
user_grade = UserGrade.find_by_user_id_and_project_id(target_user.id, project.id)
|
user_grade = UserGrade.find_by_user_id_and_project_id(target_user.id, project.id)
|
||||||
if user_grade.nil?
|
if user_grade.nil?
|
||||||
user_grade = UserGrade.create(:user_id =>target_user.id, :project_id => project.id)
|
user_grade = UserGrade.create(:user_id =>target_user.id, :project_id => project.id)
|
||||||
end
|
end
|
||||||
grades[user_grade.id] = grades[user_grade.id].to_i + 6
|
grades[user_grade.id] = grades[user_grade.id].to_i + 6
|
||||||
end
|
end
|
||||||
|
|
||||||
|
end
|
||||||
elsif level == 3
|
elsif level == 3
|
||||||
users_skill[target_user.id] = users_skill[target_user.id].to_i + 8 #帖子被三级会员顶+8分 add praise_tread
|
users_skill[target_user.id] = users_skill[target_user.id].to_i + 8 #帖子被三级会员顶+8分 add praise_tread
|
||||||
unless project.nil?
|
unless project.nil?
|
||||||
|
if target_user.member_of?(project)
|
||||||
user_grade = UserGrade.find_by_user_id_and_project_id(target_user.id, project.id)
|
user_grade = UserGrade.find_by_user_id_and_project_id(target_user.id, project.id)
|
||||||
if user_grade.nil?
|
if user_grade.nil?
|
||||||
user_grade = UserGrade.create(:user_id =>target_user.id, :project_id => project.id)
|
user_grade = UserGrade.create(:user_id =>target_user.id, :project_id => project.id)
|
||||||
end
|
end
|
||||||
grades[user_grade.id] = grades[user_grade.id].to_i + 8
|
grades[user_grade.id] = grades[user_grade.id].to_i + 8
|
||||||
end
|
end
|
||||||
|
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -201,12 +234,15 @@ namespace :user_score do
|
||||||
users_active[changeset.user.id] = users_active[changeset.user.id].to_i + 4
|
users_active[changeset.user.id] = users_active[changeset.user.id].to_i + 4
|
||||||
project = changeset.project
|
project = changeset.project
|
||||||
unless project.nil?
|
unless project.nil?
|
||||||
|
if changeset.user.member_of?(project)
|
||||||
user_grade = UserGrade.find_by_user_id_and_project_id(changeset.user.id, project.id)
|
user_grade = UserGrade.find_by_user_id_and_project_id(changeset.user.id, project.id)
|
||||||
if user_grade.nil?
|
if user_grade.nil?
|
||||||
user_grade = UserGrade.create(:user_id =>changeset.user.id, :project_id => project.id)
|
user_grade = UserGrade.create(:user_id =>changeset.user.id, :project_id => project.id)
|
||||||
end
|
end
|
||||||
grades[user_grade.id] = grades[user_grade.id].to_i + 4
|
grades[user_grade.id] = grades[user_grade.id].to_i + 4
|
||||||
end
|
end
|
||||||
|
|
||||||
|
end
|
||||||
end
|
end
|
||||||
puts ":push_code calculate Completed. active users count: #{users_active.count}"
|
puts ":push_code calculate Completed. active users count: #{users_active.count}"
|
||||||
#提交文档
|
#提交文档
|
||||||
|
@ -217,12 +253,15 @@ namespace :user_score do
|
||||||
users_active[document.user.id] = users_active[document.user.id].to_i + 4
|
users_active[document.user.id] = users_active[document.user.id].to_i + 4
|
||||||
project = document.project
|
project = document.project
|
||||||
unless project.nil?
|
unless project.nil?
|
||||||
|
if document.user.member_of?(project)
|
||||||
user_grade = UserGrade.find_by_user_id_and_project_id(document.user.id, project.id)
|
user_grade = UserGrade.find_by_user_id_and_project_id(document.user.id, project.id)
|
||||||
if user_grade.nil?
|
if user_grade.nil?
|
||||||
user_grade = UserGrade.create(:user_id =>document.user.id, :project_id => project.id)
|
user_grade = UserGrade.create(:user_id =>document.user.id, :project_id => project.id)
|
||||||
end
|
end
|
||||||
grades[user_grade.id] = grades[user_grade.id].to_i + 4
|
grades[user_grade.id] = grades[user_grade.id].to_i + 4
|
||||||
end
|
end
|
||||||
|
|
||||||
|
end
|
||||||
end
|
end
|
||||||
puts ":push_document calculate Completed. active users count: #{users_active.count}"
|
puts ":push_document calculate Completed. active users count: #{users_active.count}"
|
||||||
#提交附件
|
#提交附件
|
||||||
|
@ -238,12 +277,15 @@ namespace :user_score do
|
||||||
if attachment.container.class.to_s == "Project"
|
if attachment.container.class.to_s == "Project"
|
||||||
project = attachment.project
|
project = attachment.project
|
||||||
unless project.nil?
|
unless project.nil?
|
||||||
|
if attachment.author.member_of?(project)
|
||||||
user_grade = UserGrade.find_by_user_id_and_project_id(attachment.author.id, project.id)
|
user_grade = UserGrade.find_by_user_id_and_project_id(attachment.author.id, project.id)
|
||||||
if user_grade.nil?
|
if user_grade.nil?
|
||||||
user_grade = UserGrade.create(:user_id =>attachment.author.id, :project_id => project.id)
|
user_grade = UserGrade.create(:user_id =>attachment.author.id, :project_id => project.id)
|
||||||
end
|
end
|
||||||
grades[user_grade.id] = grades[user_grade.id].to_i + 4
|
grades[user_grade.id] = grades[user_grade.id].to_i + 4
|
||||||
end
|
end
|
||||||
|
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# end
|
# end
|
||||||
|
@ -255,6 +297,7 @@ namespace :user_score do
|
||||||
users_active[j.user.id] = users_active[j.user.id].to_i + 2
|
users_active[j.user.id] = users_active[j.user.id].to_i + 2
|
||||||
project = j.project
|
project = j.project
|
||||||
unless project.nil?
|
unless project.nil?
|
||||||
|
if j.user.member_of?(project)
|
||||||
user_grade = UserGrade.find_by_user_id_and_project_id(j.user.id, project.id)
|
user_grade = UserGrade.find_by_user_id_and_project_id(j.user.id, project.id)
|
||||||
if user_grade.nil?
|
if user_grade.nil?
|
||||||
user_grade = UserGrade.create(:user_id =>j.user.id, :project_id => project.id)
|
user_grade = UserGrade.create(:user_id =>j.user.id, :project_id => project.id)
|
||||||
|
@ -262,18 +305,22 @@ namespace :user_score do
|
||||||
grades[user_grade.id] = grades[user_grade.id].to_i + 4
|
grades[user_grade.id] = grades[user_grade.id].to_i + 4
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
puts ":update_issue_ratio calculate Completed. active users count: #{users_active.count}"
|
puts ":update_issue_ratio calculate Completed. active users count: #{users_active.count}"
|
||||||
#发布缺陷
|
#发布缺陷
|
||||||
Issue.includes(:author).all.each do |issue|
|
Issue.includes(:author).all.each do |issue|
|
||||||
users_active[issue.author.id] = users_active[issue.author.id].to_i + 4
|
users_active[issue.author.id] = users_active[issue.author.id].to_i + 4
|
||||||
project = issue.project
|
project = issue.project
|
||||||
unless project.nil?
|
unless project.nil?
|
||||||
|
if issue.author.member_of?(project)
|
||||||
user_grade = UserGrade.find_by_user_id_and_project_id(issue.author.id, project.id)
|
user_grade = UserGrade.find_by_user_id_and_project_id(issue.author.id, project.id)
|
||||||
if user_grade.nil?
|
if user_grade.nil?
|
||||||
user_grade = UserGrade.create(:user_id =>issue.author.id, :project_id => project.id)
|
user_grade = UserGrade.create(:user_id =>issue.author.id, :project_id => project.id)
|
||||||
end
|
end
|
||||||
grades[user_grade.id] = grades[user_grade.id].to_i + 4
|
grades[user_grade.id] = grades[user_grade.id].to_i + 4
|
||||||
end
|
end
|
||||||
|
|
||||||
|
end
|
||||||
end
|
end
|
||||||
puts ":post_issue calculate Completed. active users count: #{users_active.count}"
|
puts ":post_issue calculate Completed. active users count: #{users_active.count}"
|
||||||
|
|
||||||
|
|
|
@ -1853,7 +1853,7 @@ a.remove-upload:hover {text-decoration:none !important;}
|
||||||
|
|
||||||
/*gcm upload file count and deleteall*/
|
/*gcm upload file count and deleteall*/
|
||||||
#upload_file_count #count {color:red; font-size:1.5em;}
|
#upload_file_count #count {color:red; font-size:1.5em;}
|
||||||
span.add_attachment .remove_all {background:none;background: url(../images/delete.png) no-repeat 1px 50%; width:1px; display:inline-block;position:absolute;right:10%;text-decoration:none;}
|
span.add_attachment .remove_all {background:none;background: url(../images/delete.png) no-repeat 1px 50%; width:1px; display:inline-block;right:10%;text-decoration:none;}
|
||||||
|
|
||||||
|
|
||||||
div.fileover { background-color: lavender; }
|
div.fileover { background-color: lavender; }
|
||||||
|
|
|
@ -1071,6 +1071,16 @@ div.tags_area {
|
||||||
border-bottom: 1px solid #c8d4fd;
|
border-bottom: 1px solid #c8d4fd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ver-zebra #vzebra-attachmenttype, #ver-zebra #vzebra-children {
|
||||||
|
background: #ffffff;
|
||||||
|
border-bottom: 1px solid #c8d4fd;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ver-zebra #vzebra-contenttype, #ver-zebra #vzebra-children {
|
||||||
|
background: #ffffff;
|
||||||
|
border-bottom: 1px solid #c8d4fd;
|
||||||
|
}
|
||||||
|
|
||||||
#ver-zebra #vzebra-comedy, #ver-zebra #vzebra-action {
|
#ver-zebra #vzebra-comedy, #ver-zebra #vzebra-action {
|
||||||
background: #ffffff;
|
background: #ffffff;
|
||||||
border-bottom: 1px solid #d6dfff;
|
border-bottom: 1px solid #d6dfff;
|
||||||
|
|
Loading…
Reference in New Issue