This commit is contained in:
huang 2015-09-06 17:03:48 +08:00
commit b771cc0fe1
21 changed files with 265 additions and 182 deletions

View File

@ -386,14 +386,16 @@ class IssuesController < ApplicationController
end end
def add_journal def add_journal
jour = Journal.new if User.current.logged?
jour.user_id = User.current.id jour = Journal.new
jour.notes = params[:notes] jour.user_id = User.current.id
jour.journalized = @issue jour.notes = params[:notes]
jour.save jour.journalized = @issue
@user_activity_id = params[:user_activity_id] jour.save
respond_to do |format| @user_activity_id = params[:user_activity_id]
format.js respond_to do |format|
format.js
end
end end
end end

View File

@ -101,27 +101,27 @@ class MessagesController < ApplicationController
ids = params[:asset_id].split(',') ids = params[:asset_id].split(',')
update_kindeditor_assets_owner ids,@message.id,OwnerTypeHelper::MESSAGE update_kindeditor_assets_owner ids,@message.id,OwnerTypeHelper::MESSAGE
end end
# 与我相关动态的记录add start # # 与我相关动态的记录add start
if(@board && @board.course) #项目的先不管 # if(@board && @board.course) #项目的先不管
teachers = searchTeacherAndAssistant(@board.course) # teachers = searchTeacherAndAssistant(@board.course)
for teacher in teachers # for teacher in teachers
if(teacher.user_id != User.current.id) # if(teacher.user_id != User.current.id)
notify = ActivityNotify.new() # notify = ActivityNotify.new()
if(@board.course) # if(@board.course)
notify.activity_container_id = @board.course_id # notify.activity_container_id = @board.course_id
notify.activity_container_type = 'Course' # notify.activity_container_type = 'Course'
else # else
notify.activity_container_id = @board.project_id # notify.activity_container_id = @board.project_id
notify.activity_container_type = 'Project' # notify.activity_container_type = 'Project'
end # end
notify.activity_id = @message.id # notify.activity_id = @message.id
notify.activity_type = 'Message' # notify.activity_type = 'Message'
notify.notify_to = teacher.user_id # notify.notify_to = teacher.user_id
notify.is_read = 0 # notify.is_read = 0
notify.save() # notify.save()
end # end
end # end
end # end
# 与我相关动态的记录add end # 与我相关动态的记录add end
call_hook(:controller_messages_new_after_save, { :params => params, :message => @message}) call_hook(:controller_messages_new_after_save, { :params => params, :message => @message})

View File

@ -296,12 +296,16 @@ class UsersController < ApplicationController
#用户作业列表 #用户作业列表
def user_homeworks def user_homeworks
@page = params[:page] ? params[:page].to_i + 1 : 0 if User.current == @user
user_course_ids = "(" + @user.courses.visible.map{|course| course.id}.join(",") + ")" @page = params[:page] ? params[:page].to_i + 1 : 0
@homework_commons = HomeworkCommon.where("course_id in #{user_course_ids}").order("created_at desc").limit(10).offset(@page * 10) user_course_ids = "(" + @user.courses.visible.map{|course| course.id}.join(",") + ")"
respond_to do |format| @homework_commons = HomeworkCommon.where("course_id in #{user_course_ids}").order("created_at desc").limit(10).offset(@page * 10)
format.js respond_to do |format|
format.html {render :layout => 'new_base_user'} format.js
format.html {render :layout => 'new_base_user'}
end
else
render_403
end end
end end
@ -345,16 +349,20 @@ class UsersController < ApplicationController
end end
def new_user_commit_homework def new_user_commit_homework
@user = User.current if User.current.logged?
@homework = HomeworkCommon.find(params[:homework_id]) @user = User.current
@is_test = params[:is_test] == 'true' @homework = HomeworkCommon.find(params[:homework_id])
@student_work = @homework.student_works.where(user_id: User.current.id).first @is_test = params[:is_test] == 'true'
if @student_work.nil? @student_work = @homework.student_works.where(user_id: User.current.id).first
@student_work = StudentWork.new if @student_work.nil?
end @student_work = StudentWork.new
respond_to do |format| end
format.js respond_to do |format|
format.html {render :layout => 'new_base_user'} format.js
format.html {render :layout => 'new_base_user'}
end
else
render_403
end end
end end
@ -364,53 +372,57 @@ class UsersController < ApplicationController
end end
def user_new_homework def user_new_homework
if params[:homework_common] if User.current.logged?
homework = HomeworkCommon.new if params[:homework_common]
homework.name = params[:homework_common][:name] homework = HomeworkCommon.new
homework.description = params[:homework_common][:description] homework.name = params[:homework_common][:name]
homework.end_time = params[:homework_common][:end_time] || Time.now homework.description = params[:homework_common][:description]
homework.publish_time = Time.now homework.end_time = params[:homework_common][:end_time] || Time.now
homework.homework_type = params[:homework_type].to_i || 1 homework.publish_time = Time.now
homework.late_penalty = 2 homework.homework_type = params[:homework_type].to_i || 1
homework.user_id = User.current.id homework.late_penalty = 2
homework.course_id = params[:course_id] homework.user_id = User.current.id
homework.course_id = params[:course_id]
homework.save_attachments(params[:attachments]) homework.save_attachments(params[:attachments])
render_attachment_warning_if_needed(homework) render_attachment_warning_if_needed(homework)
#匿评作业相关属性 #匿评作业相关属性
if homework.homework_type == 1 if homework.homework_type == 1
homework_detail_manual = HomeworkDetailManual.new homework_detail_manual = HomeworkDetailManual.new
homework_detail_manual.ta_proportion = params[:ta_proportion] || 0.6 homework_detail_manual.ta_proportion = params[:ta_proportion] || 0.6
homework_detail_manual.comment_status = 1 homework_detail_manual.comment_status = 1
homework_detail_manual.evaluation_start = Time.now homework_detail_manual.evaluation_start = Time.now
homework_detail_manual.evaluation_end = Time.now homework_detail_manual.evaluation_end = Time.now
homework_detail_manual.evaluation_num = params[:evaluation_num] || 3 homework_detail_manual.evaluation_num = params[:evaluation_num] || 3
homework_detail_manual.absence_penalty = 2 homework_detail_manual.absence_penalty = 2
homework.homework_detail_manual = homework_detail_manual homework.homework_detail_manual = homework_detail_manual
else else
homework_detail_programing = HomeworkDetailPrograming.new homework_detail_programing = HomeworkDetailPrograming.new
homework.homework_detail_programing = homework_detail_programing homework.homework_detail_programing = homework_detail_programing
homework_detail_programing.ta_proportion = params[:ta_proportion] || 0.6 homework_detail_programing.ta_proportion = params[:ta_proportion] || 0.6
homework_detail_programing.language = params[:program][:language].to_i homework_detail_programing.language = params[:program][:language].to_i
inputs = params[:program][:input] inputs = params[:program][:input]
if Array === inputs if Array === inputs
inputs.each_with_index do |val, i| inputs.each_with_index do |val, i|
homework.homework_tests << HomeworkTest.new( homework.homework_tests << HomeworkTest.new(
input: val, input: val,
output: params[:program][:output][i] output: params[:program][:output][i]
) )
end
end end
end
end
if homework.save end
homework_detail_manual.save if homework_detail_manual
homework_detail_programing.save if homework_detail_programing if homework.save
redirect_to user_homeworks_user_path(User.current.id) homework_detail_manual.save if homework_detail_manual
homework_detail_programing.save if homework_detail_programing
redirect_to user_homeworks_user_path(User.current.id)
end
end end
else
render_403
end end
end end
@ -507,6 +519,7 @@ class UsersController < ApplicationController
att_copy = atta.copy att_copy = atta.copy
att_copy.container_id = nil att_copy.container_id = nil
att_copy.container_type = nil att_copy.container_type = nil
att_copy.author_id = User.current.id
att_copy.copy_from = atta.id att_copy.copy_from = atta.id
att_copy.save att_copy.save
@attachments << att_copy @attachments << att_copy
@ -771,7 +784,7 @@ class UsersController < ApplicationController
@page = params[:page] ? params[:page].to_i + 1 : 0 @page = params[:page] ? params[:page].to_i + 1 : 0
user_project_ids = @user.projects.visible.empty? ? "(-1)" : "(" + @user.projects.visible.map{|project| project.id}.join(",") + ")" user_project_ids = @user.projects.visible.empty? ? "(-1)" : "(" + @user.projects.visible.map{|project| project.id}.join(",") + ")"
user_course_ids = @user.courses.visible.empty? ? "(-1)" : "(" + @user.courses.visible.map{|course| course.id}.join(",") + ")" user_course_ids = @user.courses.visible.empty? ? "(-1)" : "(" + @user.courses.visible.map{|course| course.id}.join(",") + ")"
course_types = "('Message','News','HomeworkCommon','poll')" course_types = "('Message','News','HomeworkCommon','Poll')"
project_types = "('Message','Issue')" project_types = "('Message','Issue')"
if params[:type].present? if params[:type].present?
case params[:type] case params[:type]

View File

@ -27,7 +27,7 @@ module UserScoreHelper
issue_c = issue_c + Journal.where("user_id = ?", user.id).count issue_c = issue_c + Journal.where("user_id = ?", user.id).count
############################ ############################
memos = Memo.where('author_id = ? AND parent_id IS NOT NULL', user.id) memos = Memo.where('author_id = ? AND parent_id IS NOT NULL', user.id)
memos.each do |m| memos.each do |m|
if Memo.find(m.parent_id).author.id != user.id if Memo.find(m.parent_id).author.id != user.id
issue_c = issue_c + 1 issue_c = issue_c + 1
@ -35,18 +35,18 @@ module UserScoreHelper
issue_c = issue_c - 1 issue_c = issue_c - 1
end end
end end
pmemos = Memo.where('author_id = ? AND parent_id IS NULL', user.id) pmemos = Memo.where('author_id = ? AND parent_id IS NULL', user.id)
pmemos.each do |pm| pmemos.each do |pm|
issue_c = issue_c + pm.replies_count issue_c = issue_c + pm.replies_count
end end
############################ ############################
issue_c = issue_c + JournalsForMessage.where('user_id = ? AND reply_id IS NOT NULL AND reply_id <> ?', user.id, user.id).count + JournalsForMessage.where('reply_id = ? AND user_id <> ?', user.id, user.id).count issue_c = issue_c + JournalsForMessage.where('user_id = ? AND reply_id IS NOT NULL AND reply_id <> ?', user.id, user.id).count + JournalsForMessage.where('reply_id = ? AND user_id <> ?', user.id, user.id).count
return issue_c return issue_c
end end
@ -58,14 +58,14 @@ module UserScoreHelper
def calculate_skill_count(user) def calculate_skill_count(user)
praise_count_l0 = 0 praise_count_l0 = 0
praise_count_l1 = 0 praise_count_l1 = 0
praise_count_l2 = 0 praise_count_l2 = 0
tread_count_l0 = 0 tread_count_l0 = 0
tread_count_l1 = 0 tread_count_l1 = 0
tread_count_l2 = 0 tread_count_l2 = 0
issues = Issue.where('author_id = ?', user.id) issues = Issue.where('author_id = ?', user.id)
issues.each do |i| issues.each do |i|
pts = PraiseTread.where('praise_tread_object_id = ?', i.id) pts = PraiseTread.where('praise_tread_object_id = ?', i.id)
pts.each do |p| pts.each do |p|
@ -75,7 +75,7 @@ module UserScoreHelper
if p.praise_or_tread == 1 if p.praise_or_tread == 1
praise_count_l0 = praise_count_l0 + 1 praise_count_l0 = praise_count_l0 + 1
else else
tread_count_l0 = tread_count_l0 + 1 tread_count_l0 = tread_count_l0 + 1
end end
end end
if templevel.to_i == 1 if templevel.to_i == 1
@ -97,7 +97,7 @@ module UserScoreHelper
bids = Bid.where('author_id = ?', user.id) bids = Bid.where('author_id = ?', user.id)
bids.each do |b| bids.each do |b|
ptcs = PraiseTread.where('praise_tread_object_id = ?', b.id) ptcs = PraiseTread.where('praise_tread_object_id = ?', b.id)
@ -108,7 +108,7 @@ module UserScoreHelper
if p.praise_or_tread == 1 if p.praise_or_tread == 1
praise_count_l0 = praise_count_l0 + 1 praise_count_l0 = praise_count_l0 + 1
else else
tread_count_l0 = tread_count_l0 + 1 tread_count_l0 = tread_count_l0 + 1
end end
end end
if templevel.to_i == 1 if templevel.to_i == 1
@ -127,7 +127,7 @@ module UserScoreHelper
end end
end end
end end
contests = Contest.where('author_id = ?', user.id) contests = Contest.where('author_id = ?', user.id)
contests.each do |c| contests.each do |c|
ptcs = PraiseTread.where('praise_tread_object_id = ?', c.id) ptcs = PraiseTread.where('praise_tread_object_id = ?', c.id)
@ -138,7 +138,7 @@ module UserScoreHelper
if p.praise_or_tread == 1 if p.praise_or_tread == 1
praise_count_l0 = praise_count_l0 + 1 praise_count_l0 = praise_count_l0 + 1
else else
tread_count_l0 = tread_count_l0 + 1 tread_count_l0 = tread_count_l0 + 1
end end
end end
if templevel.to_i == 1 if templevel.to_i == 1
@ -154,12 +154,12 @@ module UserScoreHelper
else else
tread_count_l2 + tread_count_l2 + 1 tread_count_l2 + tread_count_l2 + 1
end end
end end
end end
end end
# case level # case level
# when 0 skill_score = praise_count - 0.5 * tread_count # when 0 skill_score = praise_count - 0.5 * tread_count
# when 1 skill_score = 2 * praise_count - 1.5 * tread_count # when 1 skill_score = 2 * praise_count - 1.5 * tread_count
@ -170,9 +170,9 @@ module UserScoreHelper
skill_score = 2 * praise_count_l0.to_f + 3 * praise_count_l1.to_f + 4 * praise_count_l2.to_f skill_score = 2 * praise_count_l0.to_f + 3 * praise_count_l1.to_f + 4 * praise_count_l2.to_f
- 1 * tread_count_l0.to_f - 1.5 * tread_count_l1.to_f - 2 * tread_count_l2.to_f - 1 * tread_count_l0.to_f - 1.5 * tread_count_l1.to_f - 2 * tread_count_l2.to_f
tread_user_count = PraiseTread.where('praise_or_tread = ? AND user_id = ?', 0, user.id).count tread_user_count = PraiseTread.where('praise_or_tread = ? AND user_id = ?', 0, user.id).count
skill_score = skill_score.to_f - tread_user_count.to_f skill_score = skill_score.to_f - tread_user_count.to_f
@ -182,17 +182,17 @@ module UserScoreHelper
return skill_score return skill_score
end end
def calculate_level(user) def calculate_level(user)
commit_count = user.changesets.count commit_count = user.changesets.count
max_praise_num = 0 max_praise_num = 0
issues = Issue.where('author_id = ?', user.id) issues = Issue.where('author_id = ?', user.id)
issues.each do |i| issues.each do |i|
ptcs = PraiseTreadCache.where('object_id = ?', i.id) ptcs = PraiseTreadCache.where('object_id = ?', i.id)
ptcs.each do |p| ptcs.each do |p|
@ -201,7 +201,7 @@ module UserScoreHelper
end end
end end
end end
bids = Bid.where('author_id = ?', user.id) bids = Bid.where('author_id = ?', user.id)
bids.each do |b| bids.each do |b|
ptcs = PraiseTreadCache.where('object_id = ?', b.id) ptcs = PraiseTreadCache.where('object_id = ?', b.id)
@ -211,7 +211,7 @@ module UserScoreHelper
end end
end end
end end
contests = Contest.where('author_id = ?', user.id) contests = Contest.where('author_id = ?', user.id)
contests.each do |c| contests.each do |c|
ptcs = PraiseTreadCache.where('object_id = ?', c.id) ptcs = PraiseTreadCache.where('object_id = ?', c.id)
@ -219,12 +219,12 @@ module UserScoreHelper
if p.praise_num.to_i > max_praise_num.to_i if p.praise_num.to_i > max_praise_num.to_i
max_praise_num = p.praise_num max_praise_num = p.praise_num
end end
end end
end end
best_answer_num = 0 best_answer_num = 0
isManager = 0 isManager = 0
members = Member.where('user_id = ?', user.id) members = Member.where('user_id = ?', user.id)
members.each do |m| members.each do |m|
@ -238,21 +238,21 @@ module UserScoreHelper
end end
level = 0 level = 0
if max_praise_num > 4 if max_praise_num > 4
level = 1 level = 1
end end
if commit_count > 0 and commit_count < 101 if commit_count > 0 and commit_count < 101
level = 1 level = 1
end end
if commit_count > 100 or isManager == 1 if commit_count > 100 or isManager == 1
level = 2 level = 2
end end
return level return level
end end
def calculate_activity_count(user) def calculate_activity_count(user)
@ -282,23 +282,23 @@ module UserScoreHelper
def calculate_issue(user) def calculate_issue(user)
commit_count = user.changesets.count commit_count = user.changesets.count
issue_details_count = 0 issue_details_count = 0
issues = Issue.where('assigned_to_id = ?', user.id) issues = Issue.where('assigned_to_id = ?', user.id)
change_count = 0 change_count = 0
issues.each do |issue| issues.each do |issue|
js = issue.journals js = issue.journals
js.each do |j| js.each do |j|
change_count = change_count + j.details.where("prop_key = ?", "done_ratio").count change_count = change_count + j.details.where("prop_key = ?", "done_ratio").count
end end
issue_details_count = change_count + issue_details_count issue_details_count = change_count + issue_details_count
end end
return (commit_count + issue_details_count) return (commit_count + issue_details_count)
end end
@ -306,9 +306,9 @@ module UserScoreHelper
attachments = Attachment.where("container_type IS NOT NULL AND container_type <> 'Issue' AND author_id = ?", user.id).count attachments = Attachment.where("container_type IS NOT NULL AND container_type <> 'Issue' AND author_id = ?", user.id).count
return attachments return attachments
end end
def calculate_user_score(user) def calculate_user_score(user)
collaboration = calculate_collaboration_count(user) collaboration = calculate_collaboration_count(user)
influence = calculate_influence_count(user) influence = calculate_influence_count(user)
@ -322,7 +322,7 @@ module UserScoreHelper
UserScore.new(:collaboration => collaboration, :influence => influence, :skill => skill, UserScore.new(:collaboration => collaboration, :influence => influence, :skill => skill,
:activity => activity, :file => file, :issue => issue, :level => level) :activity => activity, :file => file, :issue => issue, :level => level)
end end
def update_user_score(user) def update_user_score(user)
collaboration = calculate_collaboration_count(user) collaboration = calculate_collaboration_count(user)
influence = calculate_influence_count(user) influence = calculate_influence_count(user)
@ -331,7 +331,7 @@ module UserScoreHelper
issue = calculate_issue(user) issue = calculate_issue(user)
##activity = calculate_activity_count(user) ##activity = calculate_activity_count(user)
level = calculate_level(user) level = calculate_level(user)
user.user_score.update_attributes(:collaboration => collaboration, :influence => influence, :skill => skill, user.user_score.update_attributes(:collaboration => collaboration, :influence => influence, :skill => skill,
:activity => activity, :file => file, :issue => issue, :level => level) :activity => activity, :file => file, :issue => issue, :level => level)
@ -423,7 +423,7 @@ module UserScoreHelper
#更新分数 #更新分数
def update_score(option_number) def update_score(option_number)
option_number.total_score = collaboration(option_number) + influence(option_number) + skill(option_number) + active(option_number) option_number.total_score = collaboration(option_number) + influence(option_number) + skill(option_number) + project_active(option_number)
if option_number.total_score < 0 if option_number.total_score < 0
option_number.total_score = 0 option_number.total_score = 0
end end
@ -433,7 +433,7 @@ module UserScoreHelper
#协同得分 #协同得分
def collaboration(option_number) def collaboration(option_number)
option_number.messages_for_issues + option_number.issues_status + option_number.replay_for_message + option_number.replay_for_memo option_number.memo * 2 + option_number.messages_for_issues + option_number.issues_status + option_number.replay_for_message + option_number.replay_for_memo
end end
#影响力得分 #影响力得分
def influence(option_number) def influence(option_number)
@ -444,8 +444,8 @@ module UserScoreHelper
option_number.praise_by_one * 4 + option_number.praise_by_two * 6 + option_number.praise_by_three * 8 - option_number.tread * 2 - option_number.tread_by_one * 2 - option_number.tread_by_two * 4 - option_number.tread_by_three * 6 option_number.praise_by_one * 4 + option_number.praise_by_two * 6 + option_number.praise_by_three * 8 - option_number.tread * 2 - option_number.tread_by_one * 2 - option_number.tread_by_two * 4 - option_number.tread_by_three * 6
end end
#项目贡献得分 #项目贡献得分
def active(option_number) def project_active(option_number)
option_number.changeset * 4 + option_number.document * 4 + option_number.attachment * 4 + option_number.issue_done_ratio * 2 + option_number.post_issue * 4 + option_number.memo * 2 option_number.changeset * 4 + option_number.document * 4 + option_number.attachment * 4 + option_number.issue_done_ratio * 2 + option_number.post_issue * 4
end end
#更新发帖数 #更新发帖数

View File

@ -15,6 +15,8 @@ class CourseMessage < ActiveRecord::Base
after_create :add_user_message after_create :add_user_message
def add_user_message def add_user_message
self.message_alls << MessageAll.new(:user_id => self.user_id) if MessageAll.where("message_type = '#{self.class.to_s}' and message_id = '#{self.id}'").first.nil?
self.message_alls << MessageAll.new(:user_id => self.user_id)
end
end end
end end

View File

@ -22,6 +22,8 @@ class ForgeMessage < ActiveRecord::Base
after_create :add_user_message after_create :add_user_message
def add_user_message def add_user_message
self.message_alls << MessageAll.new(:user_id => self.user_id) if MessageAll.where("message_type = '#{self.class.to_s}' and message_id = '#{self.id}'").first.nil?
self.message_alls << MessageAll.new(:user_id => self.user_id)
end
end end
end end

View File

@ -12,6 +12,8 @@ class MemoMessage < ActiveRecord::Base
after_create :add_user_message after_create :add_user_message
def add_user_message def add_user_message
self.message_alls << MessageAll.new(:user_id => self.user_id) if MessageAll.where("message_type = '#{self.class.to_s}' and message_id = '#{self.id}'").first.nil?
self.message_alls << MessageAll.new(:user_id => self.user_id)
end
end end
end end

View File

@ -121,7 +121,7 @@ class News < ActiveRecord::Base
# Description 公用表中也要记录 # Description 公用表中也要记录
def act_as_forge_activity def act_as_forge_activity
# 如果是project为空那么是课程相关的不需要保存 # 如果是project为空那么是课程相关的不需要保存
if !self.project.nil? if self.project
self.forge_acts << ForgeActivity.new(:user_id => self.author_id, self.forge_acts << ForgeActivity.new(:user_id => self.author_id,
:project_id => self.project.id) :project_id => self.project.id)
end end

View File

@ -492,28 +492,29 @@ class Query < ActiveRecord::Base
def project_statement def project_statement
project_clauses = [] project_clauses = []
unless project.descendants.blank? # unless project.descendants.blank?
if project && !project.descendants.active.empty? # if project && project.descendants && project.descendants.active && !project.descendants.active.empty?
ids = [project.id] # ids = [project.id]
if has_filter?("subproject_id") # if has_filter?("subproject_id")
case operator_for("subproject_id") # case operator_for("subproject_id")
when '=' # when '='
# include the selected subprojects # # include the selected subprojects
ids += values_for("subproject_id").each(&:to_i) # ids += values_for("subproject_id").each(&:to_i)
when '!*' # when '!*'
# main project only # # main project only
else # else
# all subprojects # # all subprojects
ids += project.descendants.collect(&:id) # ids += project.descendants.collect(&:id)
end # end
elsif Setting.display_subprojects_issues? # elsif Setting.display_subprojects_issues?
ids += project.descendants.collect(&:id) # ids += project.descendants.collect(&:id)
end # end
project_clauses << "#{Project.table_name}.id IN (%s)" % ids.join(',') # project_clauses << "#{Project.table_name}.id IN (%s)" % ids.join(',')
elsif project # elsif project
if project
project_clauses << "#{Project.table_name}.id = %d" % project.id project_clauses << "#{Project.table_name}.id = %d" % project.id
end
end end
# end
project_clauses.any? ? project_clauses.join(' AND ') : nil project_clauses.any? ? project_clauses.join(' AND ') : nil
end end

View File

@ -11,6 +11,8 @@ class UserFeedbackMessage < ActiveRecord::Base
after_save :add_user_message after_save :add_user_message
def add_user_message def add_user_message
self.message_alls << MessageAll.new(:user_id => self.user_id) if MessageAll.where("message_type = '#{self.class.to_s}' and message_id = '#{self.id}'").first.nil?
self.message_alls << MessageAll.new(:user_id => self.user_id)
end
end end
end end

View File

@ -19,12 +19,23 @@
<%= call_hook :view_layouts_base_html_head %> <%= call_hook :view_layouts_base_html_head %>
<!-- page specific tags --> <!-- page specific tags -->
<%= yield :header_tags -%> <%= yield :header_tags -%>
<%= stylesheet_link_tag 'base','header', :media => 'all'%>
</head> </head>
<body class="<%=h body_css_classes %>"> <body class="<%=h body_css_classes %>">
<div class="cl"></div>
<div class="navContainer mb10">
<% if User.current.logged? %>
<%= render :partial => 'layouts/logined_header',:locals=>{:name=>@name,:type=>@type} %>
<% else%>
<%= render :partial => 'layouts/unlogin_header',:locals=>{:name=>@name,:type=>@type} %>
<% end%>
</div>
<div class="cl"></div>
<div id="wrapper"> <div id="wrapper">
<div id="wrapper2"> <div id="wrapper2">
<div id="wrapper3"> <div id="wrapper3">
<%= render :partial => 'layouts/base_header'%>
<div id="main" class=""> <div id="main" class="">
<div id="sidebar"> <div id="sidebar">
@ -38,7 +49,6 @@
<%= call_hook :view_layouts_base_content %> <%= call_hook :view_layouts_base_content %>
<div style="clear:both;"></div> <div style="clear:both;"></div>
</div> </div>
<%= render :partial => 'layouts/base_footer'%>
</div> </div>
</div> </div>
@ -47,6 +57,11 @@
</div> </div>
</div> </div>
<div class="cl"></div>
<%= render :partial => 'layouts/footer' %>
<div class="cl"></div>
<%= call_hook :view_layouts_base_body_bottom %> <%= call_hook :view_layouts_base_body_bottom %>
</body> </body>
</html> </html>

View File

@ -1,5 +1,6 @@
<% has_commit = has_commit_poll?(activity.id ,User.current)%> <% has_commit = has_commit_poll?(activity.id ,User.current)%>
<% poll_name = activity.polls_name.empty? ? l(:label_poll_new) : activity.polls_name%> <% poll_name = activity.polls_name.empty? ? l(:label_poll_new) : activity.polls_name%>
<% if has_commit || activity.user_id == User.current %>
<div class="resources mt10"> <div class="resources mt10">
<div class="homepagePostBrief"> <div class="homepagePostBrief">
<div class="homepagePostPortrait"> <div class="homepagePostPortrait">
@ -43,4 +44,5 @@
</div> </div>
<div class="cl"></div> <div class="cl"></div>
</div> </div>
</div> </div>
<% end %>

View File

@ -5,4 +5,4 @@
<div>&nbsp;&nbsp;&nbsp; <%= l('userscore.active.update_issues')%> * 2 = <%= option_num.issue_done_ratio %> * 2 = <%= option_num.issue_done_ratio * 2 %></div> <div>&nbsp;&nbsp;&nbsp; <%= l('userscore.active.update_issues')%> * 2 = <%= option_num.issue_done_ratio %> * 2 = <%= option_num.issue_done_ratio * 2 %></div>
<div>&nbsp;&nbsp;&nbsp; <%= l('userscore.active.release_issues')%> * 4 = <%= option_num.post_issue %> * 4 = <%= option_num.post_issue * 4 %></div> <div>&nbsp;&nbsp;&nbsp; <%= l('userscore.active.release_issues')%> * 4 = <%= option_num.post_issue %> * 4 = <%= option_num.post_issue * 4 %></div>
<div>&nbsp;&nbsp;&nbsp; <%= l('userscore.active.release_messages')%> * 1 = <%= option_num.memo %> * 2 = <%= option_num.memo * 2 %></div> <div>&nbsp;&nbsp;&nbsp; <%= l('userscore.active.release_messages')%> * 1 = <%= option_num.memo %> * 2 = <%= option_num.memo * 2 %></div>
<div>&nbsp;&nbsp;&nbsp; <%= l(:label_user_score_of_active)%> = <%= option_num.changeset * 4 %> + <%= option_num.document * 4 %> + <%= option_num.attachment * 4 %> + <%= option_num.issue_done_ratio * 2 %> + <%= option_num.post_issue * 4 %> + <%= option_num.memo * 2 %> = <%= active(option_num) %> </div> <div>&nbsp;&nbsp;&nbsp; <%= l(:label_user_score_of_active)%> = <%= option_num.changeset * 4 %> + <%= option_num.document * 4 %> + <%= option_num.attachment * 4 %> + <%= option_num.issue_done_ratio * 2 %> + <%= option_num.post_issue * 4 %> + <%= option_num.memo * 2 %> = <%= project_active(option_num) %> </div>

View File

@ -5,8 +5,8 @@
<%= l(:label_user_score_of_skill)%> + <%= l(:label_user_score_of_active) %></div> <%= l(:label_user_score_of_skill)%> + <%= l(:label_user_score_of_active) %></div>
<!-- <div>&nbsp;&nbsp;&nbsp;+ <%#= l(:label_user_score_of_influence) %></div> --> <!-- <div>&nbsp;&nbsp;&nbsp;+ <%#= l(:label_user_score_of_influence) %></div> -->
<div> = <%= format("%.2f" ,collaboration(option_num)).to_i %> + <%= format("%.2f" , influence(option_num) ).to_i %> <div> = <%= format("%.2f" ,collaboration(option_num)).to_i %> + <%= format("%.2f" , influence(option_num) ).to_i %>
+ <%= "(" if skill(option_num) < 0 %> <%= format("%.2f" , skill(option_num)).to_i %> <%= ")" if skill(option_num) < 0 %> + <%= format("%.2f" , active(option_num)).to_i %></div> + <%= "(" if skill(option_num) < 0 %> <%= format("%.2f" , skill(option_num)).to_i %> <%= ")" if skill(option_num) < 0 %> + <%= format("%.2f" ,project_active(option_num)).to_i %></div>
<% if (format("%.2f" ,collaboration(option_num)).to_i + format("%.2f" , influence(option_num) ).to_i + format("%.2f" , skill(option_num)).to_i + format("%.2f" , active(option_num)).to_i) < 0 %> <% if (format("%.2f" ,collaboration(option_num)).to_i + format("%.2f" , influence(option_num) ).to_i + format("%.2f" , skill(option_num)).to_i + format("%.2f" , project_active(option_num)).to_i) < 0 %>
<div><%= l(:label_score_less_than_zero) %></div> <div><%= l(:label_score_less_than_zero) %></div>
<% else %> <% else %>
<div> = <%= format("%.2f" ,option_num.total_score).to_i %></div> <div> = <%= format("%.2f" ,option_num.total_score).to_i %></div>

View File

@ -68,7 +68,7 @@
</li> </li>
<li> <li>
<%= link_to l(:label_user_score_of_active), "javascript:void(0)", :onclick => "show_div('influence_new_score_index')" %> <%= link_to l(:label_user_score_of_active), "javascript:void(0)", :onclick => "show_div('influence_new_score_index')" %>
<%= format("%.2f" , active(option_num)).to_i %> <%= format("%.2f" , project_active(option_num)).to_i %>
</li> </li>
</ul> </ul>

View File

@ -23,7 +23,7 @@
target.show(); target.show();
}else{ }else{
btn.data('init',0); btn.data('init',0);
btn.html('点击展开更多回复('+btn.data('count')+')'); btn.html('展开更多('+btn.data('count')+')');
target.hide(); target.hide();
target.eq(0).show(); target.eq(0).show();
target.eq(1).show(); target.eq(1).show();

View File

@ -1,3 +1,5 @@
$("#resources_list").html('<%= escape_javascript( render :partial => 'resources_list' ,:locals=>{ :attachments => @attachments})%>'); $("#resources_list").html('<%= escape_javascript( render :partial => 'resources_list' ,:locals=>{ :attachments => @attachments})%>');
$("#pages").html('<%= pagination_links_full @atta_pages, @atta_count, :per_page_links => false, :remote => @is_remote, :flag => true %>'); $("#pages").html('<%= pagination_links_full @atta_pages, @atta_count, :per_page_links => false, :remote => @is_remote, :flag => true %>');
$("#res_all_count").html(<%= @atta_count%>); $("#res_all_count").html(<%= @atta_count%>);
$("#res_count").html(0);
$("#checkboxAll").attr('checked',false);

View File

@ -0,0 +1,25 @@
class ForgeActivituesDate < ActiveRecord::Migration
def up
forge_count = ForgeActivity.all.count / 30 + 2
transaction do
for i in 1 ... forge_count do i
ForgeActivity.page(i).per(30).each do |activity|
unless activity.forge_act_type == "ProjectCreateInfo"
if activity.forge_act
unless activity.forge_act.project
# puts activity.id
activity.destroy
end
else
# puts activity.id.to_s + "----"
activity.destroy
end
end
end
end
end
end
def down
end
end

View File

@ -0,0 +1,15 @@
class DeleteAnonymousJour < ActiveRecord::Migration
def up
jour_count = Journal.all.count / 30 + 2
transaction do
for i in 1 ... jour_count do i
Journal.page(i).per(30).each do |jour|
jour.destroy if jour.user_id == 2
end
end
end
end
def down
end
end

View File

@ -11,7 +11,7 @@
# #
# It's strongly recommended to check this file into your version control system. # It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20150829070453) do ActiveRecord::Schema.define(:version => 20150906083453) do
create_table "activities", :force => true do |t| create_table "activities", :force => true do |t|
t.integer "act_id", :null => false t.integer "act_id", :null => false
@ -1296,11 +1296,11 @@ ActiveRecord::Schema.define(:version => 20150829070453) do
create_table "student_work_tests", :force => true do |t| create_table "student_work_tests", :force => true do |t|
t.integer "student_work_id" t.integer "student_work_id"
t.integer "homework_test_id" t.datetime "created_at", :null => false
t.integer "result" t.datetime "updated_at", :null => false
t.datetime "created_at", :null => false t.integer "status", :default => 9
t.datetime "updated_at", :null => false t.text "results"
t.text "error_msg" t.text "src"
end end
create_table "student_works", :force => true do |t| create_table "student_works", :force => true do |t|
@ -1317,6 +1317,7 @@ ActiveRecord::Schema.define(:version => 20150829070453) do
t.datetime "updated_at", :null => false t.datetime "updated_at", :null => false
t.integer "late_penalty", :default => 0 t.integer "late_penalty", :default => 0
t.integer "absence_penalty", :default => 0 t.integer "absence_penalty", :default => 0
t.integer "system_score"
end end
create_table "student_works_evaluation_distributions", :force => true do |t| create_table "student_works_evaluation_distributions", :force => true do |t|
@ -1534,7 +1535,6 @@ ActiveRecord::Schema.define(:version => 20150829070453) do
t.string "identity_url" t.string "identity_url"
t.string "mail_notification", :default => "", :null => false t.string "mail_notification", :default => "", :null => false
t.string "salt", :limit => 64 t.string "salt", :limit => 64
t.integer "gid"
end end
add_index "users", ["auth_source_id"], :name => "index_users_on_auth_source_id" add_index "users", ["auth_source_id"], :name => "index_users_on_auth_source_id"

View File

@ -210,7 +210,7 @@ span[id^=valid_user] {
p.jRatingInfos { p.jRatingInfos {
position: absolute; position: absolute;
z-index: 9999; z-index: 9999;
background: transparent url('bg_jRatingInfos.png') no-repeat; /*background: transparent url('bg_jRatingInfos.png') no-repeat;*/
color: #CACACA; color: #CACACA;
display: none; display: none;
width: 91px; width: 91px;