Merge branch 'develop' of http://repository.trustie.net/xianbo/trustie2 into develop

This commit is contained in:
huang 2015-09-06 11:55:59 +08:00
commit a30ee2cb10
14 changed files with 69 additions and 45 deletions

View File

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

View File

@ -423,7 +423,7 @@ module UserScoreHelper
#更新分数
def update_score(option_number)
option_number.total_score = collaboration(option_number) + influence(option_number) + skill(option_number)
option_number.total_score = collaboration(option_number) + influence(option_number) + skill(option_number) + active(option_number)
if option_number.total_score < 0
option_number.total_score = 0
end
@ -433,7 +433,7 @@ module UserScoreHelper
#协同得分
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
#影响力得分
def influence(option_number)
@ -444,9 +444,9 @@ 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
end
#项目贡献得分
#def 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
#end
def 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
end
#更新发帖数
def update_memo_number(user,type,project=nil)

View File

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

View File

@ -492,8 +492,8 @@ class Query < ActiveRecord::Base
def project_statement
project_clauses = []
unless project.descendants.blank?
if project && !project.descendants.active.empty?
# unless project.descendants.blank?
if project && project.descendants && project.descendants.active && !project.descendants.active.empty?
ids = [project.id]
if has_filter?("subproject_id")
case operator_for("subproject_id")
@ -513,7 +513,7 @@ class Query < ActiveRecord::Base
elsif project
project_clauses << "#{Project.table_name}.id = %d" % project.id
end
end
# end
project_clauses.any? ? project_clauses.join(' AND ') : nil
end

View File

@ -22,7 +22,7 @@
<div class="homepagePostDeadline">截止时间:<%= activity.end_time.to_s %></div>
</div>
<div class="homepagePostIntro break_word upload_img" id="activity_description_<%= user_activity_id%>">
作业描述:<%= activity.description.html_safe %>
<%= activity.description.html_safe %>
</div>
<div class="homepagePostSetting" style="visibility: hidden" id="act-<%=user_activity_id %>">
<ul>

View File

@ -25,7 +25,7 @@
</div>
<div class="homepagePostIntro break_word upload_img" id="activity_description_<%= user_activity_id%>">帖子描述:
<div class="homepagePostIntro break_word upload_img" id="activity_description_<%= user_activity_id%>">
<% if activity.parent_id.nil? %>
<%= activity.content.to_s.html_safe%>
<% else %>

View File

@ -19,7 +19,6 @@
发布时间:<%= format_time(activity.created_on) %>
</div>
<div class="homepagePostIntro break_word upload_img" id="activity_description_<%= user_activity_id %>">
通知描述:
<%= activity.description.html_safe %>
</div>
</div>

View File

@ -28,7 +28,7 @@
<div class="homepagePostDate">
发布时间:<%= format_time(activity.published_at) %>
</div>
<div class="homepagePostIntro break_word upload_img" id="activity_description_<%= user_activity_id%>">问卷描述:<%=activity.polls_description.html_safe.to_s%></div>
<div class="homepagePostIntro break_word upload_img" id="activity_description_<%= user_activity_id%>"><%=activity.polls_description.html_safe.to_s%></div>
<div class="homepagePostSetting" id="act-<%= user_activity_id %>" style="visibility: hidden">
<ul>
<li class="homepagePostSettingIcon">

View File

@ -33,7 +33,7 @@
<%=format_time(activity.created_on) %>
</div>
</div>
<div class="homepagePostIntro break_word upload_img" id="activity_description_<%= user_activity_id %>">缺陷描述:
<div class="homepagePostIntro break_word upload_img" id="activity_description_<%= user_activity_id %>">
<% if activity.description? %>
<%= textAreailizable activity, :description, :attachments => activity.attachments %>
<% end %>

View File

@ -26,7 +26,7 @@
<div class="homepagePostDate">
时间:<%= format_time(activity.created_on) %>
</div>
<div class="homepagePostIntro break_word upload_img" id="activity_description_<%= user_activity_id%>">帖子描述:
<div class="homepagePostIntro break_word upload_img" id="activity_description_<%= user_activity_id%>">
<% if activity.parent_id.nil? %>
<%= activity.content.to_s.html_safe%>
<% else %>

View File

@ -9,7 +9,7 @@
span.ke-icon-emoticons:hover{background-position:-79px -671px;width:50px;height:26px;}
div.ke-toolbar .ke-outline{border:none;}
.ke-inline-block{display: none;}
.ke-container{height: 40px !important;}
.ke-container{height: 30px !important;}
</style>
<% user_activities.each do |user_activity|
if user_activities %>

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

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

View File

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