From 09d79ae4e0b1b2ec25d175b4f2a8c4f3d73c80ba Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Fri, 27 Jun 2014 10:10:30 +0800
Subject: [PATCH 01/24] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BD=9C=E4=B8=9A?=
=?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=BB=98=E8=AE=A4=E6=97=A5=E6=9C=9F=E4=B8=BA?=
=?UTF-8?q?=E5=BD=93=E5=89=8D=E6=97=B6=E9=97=B4=E7=9A=84=E4=B8=8B=E4=B8=80?=
=?UTF-8?q?=E5=A4=A9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/courses/_homework_form.html.erb | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/app/views/courses/_homework_form.html.erb b/app/views/courses/_homework_form.html.erb
index b30785e1b..6e49fcdea 100644
--- a/app/views/courses/_homework_form.html.erb
+++ b/app/views/courses/_homework_form.html.erb
@@ -25,11 +25,12 @@
<%= f.text_field :name, :required => true, :size => 60, :style => "width:490px;", :maxlength => Bid::NAME_LENGTH_LIMIT %>
<%= f.text_area :description, :rows => 8, :class => 'wiki-edit', :style => "font-size:small;width:490px;margin-left:10px;", :maxlength => Bid::DESCRIPTION_LENGTH_LIMIT %>
-
-<%= f.text_field :deadline, :required => true, :size => 60, :style => "width:150px;" %><%= calendar_for('bid_deadline')%>
+<% time = (Time.now + 3600 * 24).strftime('%Y-%m-%d') %>
+
<%= f.text_field(:deadline, :required => true, :size => 60, :style => "width:150px;",:value => "#{time}") %><%= calendar_for('bid_deadline')%>
<%= f.select :is_evaluation, is_evaluation_option %>
From 3f8f1411079f86e25422e27198f5654f794d4843 Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Fri, 27 Jun 2014 15:35:55 +0800
Subject: [PATCH 02/24] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20=E5=88=9B=E5=BB=BA?=
=?UTF-8?q?=E4=BD=9C=E4=B8=9A=E6=97=B6=EF=BC=8C=E7=94=B1=E4=BA=8E=E8=BE=93?=
=?UTF-8?q?=E5=85=A5=E5=8F=82=E6=95=B0=E9=94=99=E8=AF=AF=E5=AF=BC=E8=87=B4?=
=?UTF-8?q?=E4=BF=9D=E5=AD=98=E5=A4=B1=E8=B4=A5=E5=90=8E=EF=BC=8C=E5=86=8D?=
=?UTF-8?q?=E6=AC=A1=E8=BE=93=E5=85=A5=E9=94=99=E8=AF=AF=E5=8F=82=E6=95=B0?=
=?UTF-8?q?=E4=BC=9A=E6=8A=A5=E9=94=99=E3=80=82=E5=A6=82=E5=86=8D=E6=AC=A1?=
=?UTF-8?q?=E8=BE=93=E5=85=A5=E5=8F=82=E6=95=B0=E6=AD=A3=E7=A1=AE=EF=BC=8C?=
=?UTF-8?q?=E4=BC=9A=E8=BF=9B=E5=85=A5=E4=B8=80=E4=B8=AA=E7=A9=BA=E7=99=BD?=
=?UTF-8?q?=E9=A1=B5=E9=9D=A2=20=E7=9A=84BUG?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/bids_controller.rb | 4 ++++
app/controllers/courses_controller.rb | 16 +++-------------
app/views/bids/_bid_homework_show.html.erb | 19 +++++++++++--------
app/views/courses/_course_form.html.erb | 13 ++++++++-----
app/views/courses/new_homework.html.erb | 3 +--
5 files changed, 27 insertions(+), 28 deletions(-)
diff --git a/app/controllers/bids_controller.rb b/app/controllers/bids_controller.rb
index 87879f242..ba1a2b817 100644
--- a/app/controllers/bids_controller.rb
+++ b/app/controllers/bids_controller.rb
@@ -805,6 +805,10 @@ class BidsController < ApplicationController
@homework = @bid
@course = Course.find_by_id(params[:course_id])
@course_id = @course.id
+ #respond_to do |format|
+ # format.html { redirect_to new_homework_course_path(params[:course_id]),:layout => 'base_courses'}
+ # format.api { render_validation_errors(@bid) }
+ #end
render file: 'courses/new_homework', layout: 'base_courses'
end
end
diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb
index c0d7c1e25..3a81d36d4 100644
--- a/app/controllers/courses_controller.rb
+++ b/app/controllers/courses_controller.rb
@@ -489,19 +489,9 @@ class CoursesController < ApplicationController
# 新建作业
def new_homework
- if (User.current.logged? &&
- (User.current.admin? ||
- (
- !Member.where('user_id = ? and course_id = ?', User.current.id, @course.id).first.nil? &&
- (
- Member.where('user_id = ? and course_id = ?', User.current.id, @course.id).first.roles &&
- ( Role.where(id: [3, 4, 7, 9]).size > 0 )
- )
- )
- )
- )
- @homework = Bid.new
- @homework.safe_attributes = params[:bid]
+ @homework = Bid.new
+ @homework.safe_attributes = params[:bid]
+ if (User.current.logged? && User.current.member_of_course?(Course.find params[:id] ))
render :layout => 'base_courses'
else
render_404
diff --git a/app/views/bids/_bid_homework_show.html.erb b/app/views/bids/_bid_homework_show.html.erb
index 179e2d58f..6f0b35ae9 100644
--- a/app/views/bids/_bid_homework_show.html.erb
+++ b/app/views/bids/_bid_homework_show.html.erb
@@ -70,8 +70,8 @@
- <% if bid.reward_type.nil? or bid.reward_type == 1 %> <%= l(:label_bids_reward_method) %><%= l(:label_call_bonus) %> <%= l(:label_RMB_sign) %>
- <%= bid.budget%> <% elsif bid.reward_type == 2 %> <%= l(:label_bids_reward_method) %><%= bid.budget%>
+ <% if bid.reward_type.nil? or bid.reward_type == 1 %> <%= l(:label_bids_reward_method) %><%= l(:label_call_bonus) %> <%= l(:label_RMB_sign) %>
+ <%= bid.budget%> <% elsif bid.reward_type == 2 %> <%= l(:label_bids_reward_method) %><%= bid.budget%>
<% else %>
<% end %>
@@ -83,9 +83,12 @@
- <%= l(:label_create_time) %> : <%=format_time bid.created_on %> <%= l(:field_deadline) %> : <%=bid.deadline %>
-
-
+
+
+ <%= l(:label_create_time) %> : <%=format_time bid.created_on %> <%= l(:field_deadline) %> : <%=bid.deadline %>
+
+
+
@@ -94,7 +97,7 @@
<% end %>
\ No newline at end of file
diff --git a/app/views/courses/_course_form.html.erb b/app/views/courses/_course_form.html.erb
index d223bbad6..ddcad7b9b 100644
--- a/app/views/courses/_course_form.html.erb
+++ b/app/views/courses/_course_form.html.erb
@@ -94,7 +94,8 @@
2014
2015
2016
- 2017 ".html_safe %>
+ 2017 ".html_safe %>
+
<% elsif @course.time == 2009 %>
<%= l(:label_term) %> *
@@ -237,7 +238,8 @@
2017 ".html_safe %>
<% end %>
- <% end %>
+ <% end %>
+
<% unless @course.nil? %>
<% if @course.term == l(:label_spring) %>
@@ -277,7 +279,8 @@
<% end %>
- <% end %>
+ <% end %>
+
@@ -292,12 +295,12 @@
-
+
<%=l(:label_new_course_password)%> *
<%= l(:text_command) %>
<% end %>
-
+
<%=l(:label_new_course_description)%>
diff --git a/app/views/courses/new_homework.html.erb b/app/views/courses/new_homework.html.erb
index e1fd553b0..335ce910e 100644
--- a/app/views/courses/new_homework.html.erb
+++ b/app/views/courses/new_homework.html.erb
@@ -1,6 +1,5 @@
<%=l(:label_course_new_homework)%>
-
-<%= labelled_form_for @homework, :url => {:controller => 'bids', :action => 'create_homework'} do |f| %>
+<%= labelled_form_for @homework, :url => {:controller => 'bids', :action => 'create_homework',:course_id => "#{params[:id] || params[:course_id]}"} do |f| %>
<%= render :partial => 'homework_form', :locals => { :f => f } %>
<%= submit_tag l(:button_create), :class => "enterprise" %>
From f6d9bfc91d46e787b3f95415369e91e21c977e49 Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Mon, 30 Jun 2014 11:15:52 +0800
Subject: [PATCH 03/24] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=96=B0=E5=BB=BA?=
=?UTF-8?q?=E4=BD=9C=E4=B8=9A=E6=97=B6=E4=BC=A0=E9=80=92=E5=8F=82=E6=95=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/courses/new_homework.html.erb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/views/courses/new_homework.html.erb b/app/views/courses/new_homework.html.erb
index ec25cef0f..b3fff9e5f 100644
--- a/app/views/courses/new_homework.html.erb
+++ b/app/views/courses/new_homework.html.erb
@@ -1,6 +1,6 @@
<%=l(:label_course_new_homework)%>
-<%= labelled_form_for @homework, :url => {:controller => 'bids', :action => 'create_homework',:course_id=>@course.id} do |f| %>
+<%= labelled_form_for @homework, :url => {:controller => 'bids', :action => 'create_homework',:course_id => "#{params[:id] || params[:course_id]}"} do |f| %>
<%= render :partial => 'homework_form', :locals => { :f => f } %>
<%= submit_tag l(:button_create), :class => "enterprise" %>
From 9a8c5ebecc1affc657368ca5bd64f26d77713d3b Mon Sep 17 00:00:00 2001
From: z9hang
Date: Mon, 30 Jun 2014 16:19:28 +0800
Subject: [PATCH 04/24] =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E5=BE=97=E5=88=86?=
=?UTF-8?q?=E8=A7=84=E5=88=99=E6=98=BE=E7=A4=BA=20=E7=95=99=E8=A8=80?=
=?UTF-8?q?=E5=9B=9E=E5=A4=8D=E6=9C=AA=E5=8A=A0=E5=88=86bug=E4=BF=AE?=
=?UTF-8?q?=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/models/journals_for_message.rb | 6 +-
.../users/_activity_new_score_index.html.erb | 8 +++
.../users/_influence_new_score_index.html.erb | 6 ++
.../users/_project_new_score_index.html.erb | 2 +
app/views/users/_show_new_score.html.erb | 10 +--
.../users/activity_new_score_index.js.erb | 1 +
.../users/influence_new_score_index.js.erb | 1 +
.../users/project_new_score_index.js.erb | 1 +
db/schema.rb | 61 +++++++++++++++++--
9 files changed, 84 insertions(+), 12 deletions(-)
create mode 100644 app/views/users/_activity_new_score_index.html.erb
create mode 100644 app/views/users/_influence_new_score_index.html.erb
create mode 100644 app/views/users/_project_new_score_index.html.erb
create mode 100644 app/views/users/activity_new_score_index.js.erb
create mode 100644 app/views/users/influence_new_score_index.js.erb
create mode 100644 app/views/users/project_new_score_index.js.erb
diff --git a/app/models/journals_for_message.rb b/app/models/journals_for_message.rb
index 58880919e..997bb6f62 100644
--- a/app/models/journals_for_message.rb
+++ b/app/models/journals_for_message.rb
@@ -15,9 +15,9 @@ class JournalsForMessage < ActiveRecord::Base
"m_reply_id" # 回复某留言的留言id(a留言回复了b留言,这是b留言的id)
acts_as_tree :foreign_key => 'm_parent_id', :counter_cache => :m_reply_count, :order => "#{JournalsForMessage.table_name}.created_on ASC"
- belongs_to :project,
- :foreign_key => 'jour_id',
- :conditions => "#{self.table_name}.jour_type = 'Project' "
+ belongs_to :project
+ #:foreign_key => 'jour_id',
+ #:conditions => "#{self.table_name}.jour_type = 'Project' "
belongs_to :course,
:foreign_key => 'jour_id',
:conditions => "#{self.table_name}.jour_type = 'Course' "
diff --git a/app/views/users/_activity_new_score_index.html.erb b/app/views/users/_activity_new_score_index.html.erb
new file mode 100644
index 000000000..0ceb8f157
--- /dev/null
+++ b/app/views/users/_activity_new_score_index.html.erb
@@ -0,0 +1,8 @@
+技术得分:
+ 踩别人的帖子 -2
+ 帖子被一级会员顶 +4
+ 帖子被二级会员顶 +6
+ 帖子被三级会员顶 +8
+ 帖子被一级会员踩 -2
+ 帖子被二级会员踩 -4
+ 帖子被三级会员踩 -6
\ No newline at end of file
diff --git a/app/views/users/_influence_new_score_index.html.erb b/app/views/users/_influence_new_score_index.html.erb
new file mode 100644
index 000000000..9985d26cd
--- /dev/null
+++ b/app/views/users/_influence_new_score_index.html.erb
@@ -0,0 +1,6 @@
+项目贡献得分:
+ 提交代码 +4
+ 提交文档 +4
+ 提交附件 +4
+ 更新缺陷完成度 +2
+ 发布缺陷 +4
\ No newline at end of file
diff --git a/app/views/users/_project_new_score_index.html.erb b/app/views/users/_project_new_score_index.html.erb
new file mode 100644
index 000000000..45e0b0600
--- /dev/null
+++ b/app/views/users/_project_new_score_index.html.erb
@@ -0,0 +1,2 @@
+影响力得分:
+ 被关注人数 +2/人
diff --git a/app/views/users/_show_new_score.html.erb b/app/views/users/_show_new_score.html.erb
index 3fd5f1050..c5f15694e 100644
--- a/app/views/users/_show_new_score.html.erb
+++ b/app/views/users/_show_new_score.html.erb
@@ -48,23 +48,23 @@
- <%= l(:label_user_score) %> :
+ <%= link_to l(:label_user_score) , {:controller => 'users', :action => 'score_new_index', :remote => true} %> :
<%= format("%.2f" , @user.user_score_attr.total_score).to_f %>
- <%= l(:label_user_score_of_collaboration) %> :
+ <%= link_to l(:label_user_score_of_collaboration), {:controller => 'users',:action => 'topic_new_score_index', :remote => true} %> :
<%= format("%.2f" , @user.user_score_attr.collaboration.nil? ? 0:@user.user_score_attr.collaboration).to_f %>
- <%= l(:label_user_score_of_influence) %> :
+ <%= link_to l(:label_user_score_of_influence), {:controller => 'users',:action => 'project_new_score_index', :remote => true} %> :
<%= format("%.2f" , @user.user_score_attr.influence.nil? ? 0:@user.user_score_attr.influence).to_f %>
- <%= l(:label_user_score_of_skill) %> :
+ <%= link_to l(:label_user_score_of_skill), {:controller => 'users',:action => 'activity_new_score_index', :remote => true} %> :
<%= format("%.2f" , @user.user_score_attr.skill.nil? ? 0:@user.user_score_attr.skill).to_f %>
- <%= l(:label_user_score_of_active) %> :
+ <%= link_to l(:label_user_score_of_active), {:controller => 'users',:action => 'influence_new_score_index', :remote => true} %> :
<%= format("%.2f" , @user.user_score_attr.active.nil? ? 0:@user.user_score_attr.active).to_f %>
diff --git a/app/views/users/activity_new_score_index.js.erb b/app/views/users/activity_new_score_index.js.erb
new file mode 100644
index 000000000..246d9161f
--- /dev/null
+++ b/app/views/users/activity_new_score_index.js.erb
@@ -0,0 +1 @@
+$('#show_score_detail').html('<%= escape_javascript(render :partial => 'users/activity_new_score_index', :locals => {:index =>0 }) %>');
\ No newline at end of file
diff --git a/app/views/users/influence_new_score_index.js.erb b/app/views/users/influence_new_score_index.js.erb
new file mode 100644
index 000000000..9a9514372
--- /dev/null
+++ b/app/views/users/influence_new_score_index.js.erb
@@ -0,0 +1 @@
+$('#show_score_detail').html('<%= escape_javascript(render :partial => 'users/influence_new_score_index', :locals => {:index =>0 }) %>');
\ No newline at end of file
diff --git a/app/views/users/project_new_score_index.js.erb b/app/views/users/project_new_score_index.js.erb
new file mode 100644
index 000000000..493bd7fd0
--- /dev/null
+++ b/app/views/users/project_new_score_index.js.erb
@@ -0,0 +1 @@
+$('#show_score_detail').html('<%= escape_javascript(render :partial => 'users/project_new_score_index', :locals => {:index =>0 }) %>');
\ No newline at end of file
diff --git a/db/schema.rb b/db/schema.rb
index 027460e1f..cc3d68cba 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20140617013146) do
+ActiveRecord::Schema.define(:version => 20140626012511) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
@@ -175,6 +175,58 @@ ActiveRecord::Schema.define(:version => 20140617013146) do
add_index "changesets_issues", ["changeset_id", "issue_id"], :name => "changesets_issues_ids", :unique => true
+ create_table "code_review_assignments", :force => true do |t|
+ t.integer "issue_id"
+ t.integer "change_id"
+ t.integer "attachment_id"
+ t.string "file_path"
+ t.string "rev"
+ t.string "rev_to"
+ t.string "action_type"
+ t.integer "changeset_id"
+ end
+
+ create_table "code_review_project_settings", :force => true do |t|
+ t.integer "project_id"
+ t.integer "tracker_id"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ t.integer "updated_by"
+ t.boolean "hide_code_review_tab", :default => false
+ t.integer "auto_relation", :default => 1
+ t.integer "assignment_tracker_id"
+ t.text "auto_assign"
+ t.integer "lock_version", :default => 0, :null => false
+ t.boolean "tracker_in_review_dialog", :default => false
+ end
+
+ create_table "code_review_user_settings", :force => true do |t|
+ t.integer "user_id", :default => 0, :null => false
+ t.integer "mail_notification", :default => 0, :null => false
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ end
+
+ create_table "code_reviews", :force => true do |t|
+ t.integer "project_id"
+ t.integer "change_id"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ t.integer "line"
+ t.integer "updated_by_id"
+ t.integer "lock_version", :default => 0, :null => false
+ t.integer "status_changed_from"
+ t.integer "status_changed_to"
+ t.integer "issue_id"
+ t.string "action_type"
+ t.string "file_path"
+ t.string "rev"
+ t.string "rev_to"
+ t.integer "attachment_id"
+ t.integer "file_count", :default => 0, :null => false
+ t.boolean "diff_all"
+ end
+
create_table "comments", :force => true do |t|
t.string "commented_type", :limit => 30, :default => "", :null => false
t.integer "commented_id", :default => 0, :null => false
@@ -374,12 +426,13 @@ ActiveRecord::Schema.define(:version => 20140617013146) do
create_table "homework_attaches", :force => true do |t|
t.integer "bid_id"
t.integer "user_id"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
t.string "reward"
t.string "name"
t.string "description"
t.integer "state"
+ t.integer "project_id", :default => 0
end
create_table "homework_for_courses", :force => true do |t|
@@ -740,7 +793,7 @@ ActiveRecord::Schema.define(:version => 20140617013146) do
end
create_table "relative_memos", :force => true do |t|
- t.integer "osp_id", :null => false
+ t.integer "osp_id"
t.integer "parent_id"
t.string "subject", :null => false
t.text "content", :null => false
From e863c3035285c74ca0221fa6c94af0762b65b0b5 Mon Sep 17 00:00:00 2001
From: nwb
Date: Mon, 30 Jun 2014 17:26:11 +0800
Subject: [PATCH 05/24] =?UTF-8?q?=E9=83=A8=E5=88=86BUG=E4=BF=AE=E6=AD=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/application_controller.rb | 6 +++---
app/views/courses/finishcourse.js.erb | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index af6fbd632..e6efca1e8 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -94,7 +94,7 @@ class ApplicationController < ActionController::Base
Setting.check_cache
# Find the current user
User.current = find_current_user
- logger.info(" Current user: " + (User.current.logged? ? "#{User.current.login} (id=#{User.current.id})" : "anonymous")) if logger
+ #logger.info(" Current user: " + (User.current.logged? ? "#{User.current.login} (id=#{User.current.id})" : "anonymous")) if logger
end
# Returns the current user or nil if no user is logged in
@@ -300,7 +300,7 @@ class ApplicationController < ActionController::Base
render_404
end
- #course_idproject
+ #���course_id��project
def find_project_by_course_id
@bid = Bid.find params[:course_id]
@project = @bid.courses[0]
@@ -354,7 +354,7 @@ class ApplicationController < ActionController::Base
end
#added by nwb
- #ȡγ
+ #��ȡ�γ�
def find_course
@course= Course.find(params[:id])
rescue ActiveRecord::RecordNotFound
diff --git a/app/views/courses/finishcourse.js.erb b/app/views/courses/finishcourse.js.erb
index e67426953..75c2b774d 100644
--- a/app/views/courses/finishcourse.js.erb
+++ b/app/views/courses/finishcourse.js.erb
@@ -4,7 +4,7 @@ console.debug('课程修改成功:结束时间改为<%=Course.find_by_extra(@c
<% end %>
$('#content-title-top-div').html("<%= j(render partial: 'users/my_course_ex', :locals => {:memberships => @memberships,:user=>@user,
:memberships_doing=>@memberships_doing,:memberships_done=>@memberships_done} )%>")
-//$('#finish_course_ <%=@course.id%>').replaceWith("<%= j(render partial: 'courses/set_course_time', :locals => {:course => @course} )%>")
+$('#finish_course_<%=@course.id%>').replaceWith("<%= j(render partial: 'courses/set_course_time', :locals => {:course => @course} )%>")
<% else %>
alert('权限不足,设置失败,请在论坛提交问题,等待管理员处理。');
<% end %>
From d03718e30f0d3ae7915f0e4320c4887c2b4e0640 Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Mon, 30 Jun 2014 17:44:29 +0800
Subject: [PATCH 06/24] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=96=B0=E8=AF=84?=
=?UTF-8?q?=E5=88=86=E8=A7=84=E5=88=99=E4=B8=8B=E6=8C=89=E5=88=86=E6=95=B0?=
=?UTF-8?q?=E6=8E=92=E5=BA=8F=E4=B8=8D=E6=AD=A3=E7=A1=AE=E7=9A=84=E9=97=AE?=
=?UTF-8?q?=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/bids_controller.rb | 7 +++-
db/schema.rb | 59 ++++++++++++++++++++++++++++--
2 files changed, 62 insertions(+), 4 deletions(-)
diff --git a/app/controllers/bids_controller.rb b/app/controllers/bids_controller.rb
index ba1a2b817..5d4d8cffd 100644
--- a/app/controllers/bids_controller.rb
+++ b/app/controllers/bids_controller.rb
@@ -496,7 +496,12 @@ class BidsController < ApplicationController
@homework = HomeworkAttach.new
#@homework_list = @bid.homeworks
#增加作业按评分排序,
- @homework_list = @bid.homeworks.eager_load(:rate_averages, :user, :attachments).order('seems_rateable_cached_ratings.avg DESC').order("#{HomeworkAttach.table_name}.created_at ASC")
+ #@homework_list = @bid.homeworks.eager_load(:rate_averages, :user, :attachments).order('seems_rateable_cached_ratings.avg DESC').order("#{HomeworkAttach.table_name}.created_at ASC")
+ @homework_list = HomeworkAttach.find_by_sql("SELECT homework_attaches.*,
+ (SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id = 659) AS t_score,
+ (SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id <> 659) AS s_score
+ FROM homework_attaches WHERE bid_id = #{@bid.id} ORDER BY
+ (CASE WHEN t_score IS NULL THEN 0 ELSE t_score * 0.6 END + CASE WHEN s_score IS NULL THEN 0 ELSE s_score * 0.4 END) DESC,created_at DESC",:include => [:attachments,:user,:rate_averages])
if params[:student_id].present?
@temp = []
@homework_list.each do |pro|
diff --git a/db/schema.rb b/db/schema.rb
index 027460e1f..2d7e2ba18 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20140617013146) do
+ActiveRecord::Schema.define(:version => 20140618155324) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
@@ -175,6 +175,58 @@ ActiveRecord::Schema.define(:version => 20140617013146) do
add_index "changesets_issues", ["changeset_id", "issue_id"], :name => "changesets_issues_ids", :unique => true
+ create_table "code_review_assignments", :force => true do |t|
+ t.integer "issue_id"
+ t.integer "change_id"
+ t.integer "attachment_id"
+ t.string "file_path"
+ t.string "rev"
+ t.string "rev_to"
+ t.string "action_type"
+ t.integer "changeset_id"
+ end
+
+ create_table "code_review_project_settings", :force => true do |t|
+ t.integer "project_id"
+ t.integer "tracker_id"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ t.integer "updated_by"
+ t.boolean "hide_code_review_tab", :default => false
+ t.integer "auto_relation", :default => 1
+ t.integer "assignment_tracker_id"
+ t.text "auto_assign"
+ t.integer "lock_version", :default => 0, :null => false
+ t.boolean "tracker_in_review_dialog", :default => false
+ end
+
+ create_table "code_review_user_settings", :force => true do |t|
+ t.integer "user_id", :default => 0, :null => false
+ t.integer "mail_notification", :default => 0, :null => false
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ end
+
+ create_table "code_reviews", :force => true do |t|
+ t.integer "project_id"
+ t.integer "change_id"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ t.integer "line"
+ t.integer "updated_by_id"
+ t.integer "lock_version", :default => 0, :null => false
+ t.integer "status_changed_from"
+ t.integer "status_changed_to"
+ t.integer "issue_id"
+ t.string "action_type"
+ t.string "file_path"
+ t.string "rev"
+ t.string "rev_to"
+ t.integer "attachment_id"
+ t.integer "file_count", :default => 0, :null => false
+ t.boolean "diff_all"
+ end
+
create_table "comments", :force => true do |t|
t.string "commented_type", :limit => 30, :default => "", :null => false
t.integer "commented_id", :default => 0, :null => false
@@ -374,12 +426,13 @@ ActiveRecord::Schema.define(:version => 20140617013146) do
create_table "homework_attaches", :force => true do |t|
t.integer "bid_id"
t.integer "user_id"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
t.string "reward"
t.string "name"
t.string "description"
t.integer "state"
+ t.integer "project_id", :default => 0
end
create_table "homework_for_courses", :force => true do |t|
From 671eaa8d45e1f2135ff47ac0f23d651a2caee7b2 Mon Sep 17 00:00:00 2001
From: nwb
Date: Mon, 30 Jun 2014 17:49:55 +0800
Subject: [PATCH 07/24] =?UTF-8?q?=E6=B5=8B=E8=AF=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/models/attachment.rb | 1 +
1 file changed, 1 insertion(+)
diff --git a/app/models/attachment.rb b/app/models/attachment.rb
index 94f8f7c95..53b2e9871 100644
--- a/app/models/attachment.rb
+++ b/app/models/attachment.rb
@@ -179,6 +179,7 @@ class Attachment < ActiveRecord::Base
File.join(self.class.storage_path, disk_directory.to_s, disk_filename.to_s)
end
+ #标题
def title
title = filename.to_s
if description.present?
From 98d2c144aef45dee95b8177e0a8ea2c115dc1e2b Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Mon, 30 Jun 2014 17:52:01 +0800
Subject: [PATCH 08/24] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=97=B6=E9=97=B4?=
=?UTF-8?q?=E6=8E=92=E5=BA=8F=E4=B8=BA=E5=8D=87=E5=BA=8F=E6=8E=92=E5=BA=8F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/bids_controller.rb | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/controllers/bids_controller.rb b/app/controllers/bids_controller.rb
index 5d4d8cffd..1318f9f57 100644
--- a/app/controllers/bids_controller.rb
+++ b/app/controllers/bids_controller.rb
@@ -497,11 +497,11 @@ class BidsController < ApplicationController
#@homework_list = @bid.homeworks
#增加作业按评分排序,
#@homework_list = @bid.homeworks.eager_load(:rate_averages, :user, :attachments).order('seems_rateable_cached_ratings.avg DESC').order("#{HomeworkAttach.table_name}.created_at ASC")
- @homework_list = HomeworkAttach.find_by_sql("SELECT homework_attaches.*,
+ @homework_list = HomeworkAttach.eager_load(:attachments,:user,:rate_averages).find_by_sql("SELECT homework_attaches.*,
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id = 659) AS t_score,
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id <> 659) AS s_score
FROM homework_attaches WHERE bid_id = #{@bid.id} ORDER BY
- (CASE WHEN t_score IS NULL THEN 0 ELSE t_score * 0.6 END + CASE WHEN s_score IS NULL THEN 0 ELSE s_score * 0.4 END) DESC,created_at DESC",:include => [:attachments,:user,:rate_averages])
+ (CASE WHEN t_score IS NULL THEN 0 ELSE t_score * 0.6 END + CASE WHEN s_score IS NULL THEN 0 ELSE s_score * 0.4 END) DESC,created_at ASC")
if params[:student_id].present?
@temp = []
@homework_list.each do |pro|
From 4906bad7d2fc4882a3b78f59ba02e47be7a34b97 Mon Sep 17 00:00:00 2001
From: z9hang
Date: Tue, 1 Jul 2014 09:15:53 +0800
Subject: [PATCH 09/24] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E8=BF=9B=E9=A1=B9?=
=?UTF-8?q?=E7=9B=AE=E6=8A=A5=E9=94=99=E5=BC=82=E5=B8=B8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/models/journals_for_message.rb | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/app/models/journals_for_message.rb b/app/models/journals_for_message.rb
index 997bb6f62..f2b69da81 100644
--- a/app/models/journals_for_message.rb
+++ b/app/models/journals_for_message.rb
@@ -15,9 +15,9 @@ class JournalsForMessage < ActiveRecord::Base
"m_reply_id" # 回复某留言的留言id(a留言回复了b留言,这是b留言的id)
acts_as_tree :foreign_key => 'm_parent_id', :counter_cache => :m_reply_count, :order => "#{JournalsForMessage.table_name}.created_on ASC"
- belongs_to :project
- #:foreign_key => 'jour_id',
- #:conditions => "#{self.table_name}.jour_type = 'Project' "
+ belongs_to :project,
+ :foreign_key => 'jour_id',
+ :conditions => "#{self.table_name}.jour_type = 'Project' "
belongs_to :course,
:foreign_key => 'jour_id',
:conditions => "#{self.table_name}.jour_type = 'Course' "
From bb86ef4612475417be1c5c4db152d3e3d53e5515 Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Tue, 1 Jul 2014 09:23:49 +0800
Subject: [PATCH 10/24] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=8E=B7=E5=8F=96?=
=?UTF-8?q?=E4=BD=9C=E4=B8=9A=E5=88=97=E8=A1=A8=E6=97=B6=E8=AF=BE=E7=A8=8B?=
=?UTF-8?q?=E8=80=81=E5=B8=88=E5=8F=82=E6=95=B0=E8=8E=B7=E5=8F=96=E4=B8=8D?=
=?UTF-8?q?=E6=AD=A3=E7=A1=AE=E7=9A=84=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/bids_controller.rb | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/controllers/bids_controller.rb b/app/controllers/bids_controller.rb
index 1318f9f57..5f20d2cef 100644
--- a/app/controllers/bids_controller.rb
+++ b/app/controllers/bids_controller.rb
@@ -498,8 +498,8 @@ class BidsController < ApplicationController
#增加作业按评分排序,
#@homework_list = @bid.homeworks.eager_load(:rate_averages, :user, :attachments).order('seems_rateable_cached_ratings.avg DESC').order("#{HomeworkAttach.table_name}.created_at ASC")
@homework_list = HomeworkAttach.eager_load(:attachments,:user,:rate_averages).find_by_sql("SELECT homework_attaches.*,
- (SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id = 659) AS t_score,
- (SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id <> 659) AS s_score
+ (SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id = #{@bid.courses.first.teacher.id}) AS t_score,
+ (SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id <> #{@bid.courses.first.teacher.id}) AS s_score
FROM homework_attaches WHERE bid_id = #{@bid.id} ORDER BY
(CASE WHEN t_score IS NULL THEN 0 ELSE t_score * 0.6 END + CASE WHEN s_score IS NULL THEN 0 ELSE s_score * 0.4 END) DESC,created_at ASC")
if params[:student_id].present?
From 0bcc0beaf1b5d6517b5666c1ea7b9aa135ed6f67 Mon Sep 17 00:00:00 2001
From: z9hang
Date: Tue, 1 Jul 2014 10:31:44 +0800
Subject: [PATCH 11/24] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=95=99=E8=A8=80?=
=?UTF-8?q?=E8=AE=A1=E5=88=86?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/models/journals_for_message.rb | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/app/models/journals_for_message.rb b/app/models/journals_for_message.rb
index f2b69da81..9551ff28b 100644
--- a/app/models/journals_for_message.rb
+++ b/app/models/journals_for_message.rb
@@ -117,6 +117,15 @@ class JournalsForMessage < ActiveRecord::Base
update_all("m_reply_count = #{count.to_i}", ["id = ?", journals_for_messages.m_parent_id])
end
+ #如果是在项目中留言则返回该项目否则返回nil - zjc
+ def project
+ if self.jour_type == 'Project'
+ Project.find(self.jour_id)
+ else
+ nil
+ end
+ end
+
# 更新用户分数 -by zjc
def be_user_score
#新建了留言回复
From a7fa444f9e48bc3ba1757b5243722198e4d9fc37 Mon Sep 17 00:00:00 2001
From: z9hang
Date: Tue, 1 Jul 2014 15:19:08 +0800
Subject: [PATCH 12/24] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E9=A1=B9=E7=9B=AE?=
=?UTF-8?q?=E4=B8=AA=E4=BA=BA=E5=BE=97=E5=88=86=E9=97=AE=E9=A2=98=EF=BC=9A?=
=?UTF-8?q?=E7=BB=9F=E8=AE=A1=E6=97=B6=E5=8F=AA=E8=AE=A1=E7=AE=97=E9=A1=B9?=
=?UTF-8?q?=E7=9B=AE=E6=88=90=E5=91=98=EF=BC=8Cuser=5Fgrade=E8=A1=A8user?=
=?UTF-8?q?=5Fid=E5=92=8Cproject=5Fid=E8=81=94=E5=90=88=E4=B8=8D=E9=87=8D?=
=?UTF-8?q?=E5=A4=8D=E9=AA=8C=E8=AF=81=EF=BC=8Cuser=5Fgrade=E5=88=86?=
=?UTF-8?q?=E6=95=B0=E9=83=A8=E4=BD=8D=E8=B4=9F=E9=AA=8C=E8=AF=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/members_controller.rb | 2 +-
app/models/user_grade.rb | 33 +++++
lib/tasks/userscore.rake | 175 ++++++++++++++++----------
3 files changed, 145 insertions(+), 65 deletions(-)
diff --git a/app/controllers/members_controller.rb b/app/controllers/members_controller.rb
index 76be02409..5ddebe707 100644
--- a/app/controllers/members_controller.rb
+++ b/app/controllers/members_controller.rb
@@ -122,7 +122,7 @@ class MembersController < ApplicationController
user_ids = attrs.delete(:user_ids)
user_ids.each do |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")
course_info << CourseInfo.new(:user_id => user_id, :course_id => @course.id)
end
diff --git a/app/models/user_grade.rb b/app/models/user_grade.rb
index ea951eadd..074aa516a 100644
--- a/app/models/user_grade.rb
+++ b/app/models/user_grade.rb
@@ -2,4 +2,37 @@ class UserGrade < ActiveRecord::Base
# attr_accessible :title, :body
attr_accessible :user_id, :project_id, :grade
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
diff --git a/lib/tasks/userscore.rake b/lib/tasks/userscore.rake
index ab6e38abe..27fae5363 100644
--- a/lib/tasks/userscore.rake
+++ b/lib/tasks/userscore.rake
@@ -17,11 +17,14 @@ namespace :user_score do
users[m.author.id] = users[m.author.id].to_i + 2
project = m.project
unless project.nil?
- user_grade = UserGrade.find_by_user_id_and_project_id(m.author.id, project.id)
- if user_grade.nil?
- user_grade = UserGrade.create(:user_id => m.author.id, :project_id => project.id)
+ if m.author.member_of?(project)
+ user_grade = UserGrade.find_by_user_id_and_project_id(m.author.id, project.id)
+ if user_grade.nil?
+ user_grade = UserGrade.create(:user_id => m.author.id, :project_id => project.id)
+ end
+ grades[user_grade.id] = grades[user_grade.id].to_i + 2
end
- grades[user_grade.id] = grades[user_grade.id].to_i + 2
+
end
end
@@ -32,11 +35,14 @@ namespace :user_score do
users[j.user.id] = users[j.user.id].to_i + 1
project = j.project
unless project.nil?
- user_grade = UserGrade.find_by_user_id_and_project_id(j.user.id, project.id)
- if user_grade.nil?
- user_grade = UserGrade.create(:user_id => j.user.id, :project_id => project.id)
+ if j.user.member_of?(project)
+ user_grade = UserGrade.find_by_user_id_and_project_id(j.user.id, project.id)
+ if user_grade.nil?
+ user_grade = UserGrade.create(:user_id => j.user.id, :project_id => project.id)
+ end
+ grades[user_grade.id] = grades[user_grade.id].to_i + 1
end
- grades[user_grade.id] = grades[user_grade.id].to_i + 1
+
end
end
puts ":post_issue_message calculate Completed. collaboration users count: #{users.count}"
@@ -46,11 +52,14 @@ namespace :user_score do
users[j.user.id] = users[j.user.id].to_i + 1
project = j.project
unless project.nil?
- user_grade = UserGrade.find_by_user_id_and_project_id(j.user.id, project.id)
- if user_grade.nil?
- user_grade = UserGrade.create(:user_id => j.user.id, :project_id => project.id)
+ if j.user.member_of?(project)
+ user_grade = UserGrade.find_by_user_id_and_project_id(j.user.id, project.id)
+ if user_grade.nil?
+ user_grade = UserGrade.create(:user_id => j.user.id, :project_id => project.id)
+ end
+ grades[user_grade.id] = grades[user_grade.id].to_i + 1
end
- grades[user_grade.id] = grades[user_grade.id].to_i + 1
+
end
end
@@ -67,11 +76,14 @@ namespace :user_score do
users[m.author.id] = users[m.author.id].to_i + 1
project = m.project
unless project.nil?
- user_grade = UserGrade.find_by_user_id_and_project_id(m.author.id, project.id)
- if user_grade.nil?
- user_grade = UserGrade.create(:user_id =>m.author.id, :project_id => project.id)
+ if m.author.member_of?(project)
+ user_grade = UserGrade.find_by_user_id_and_project_id(m.author.id, project.id)
+ if user_grade.nil?
+ user_grade = UserGrade.create(:user_id =>m.author.id, :project_id => project.id)
+ end
+ grades[user_grade.id] = grades[user_grade.id].to_i + 1
end
- grades[user_grade.id] = grades[user_grade.id].to_i + 1
+
end
end
puts ":reply_posting calculate Completed. collaboration users count: #{users.count}"
@@ -116,38 +128,50 @@ namespace :user_score do
#踩帖
users_skill[pt.user.id] = users_skill[pt.user.id].to_i - 2 #踩别人帖-2分
unless project.nil?
- user_grade = UserGrade.find_by_user_id_and_project_id(pt.user.id, project.id)
- if user_grade.nil?
- user_grade = UserGrade.create(:user_id =>pt.user.id, :project_id => project.id)
+ if pt.user.member_of?(project)
+ user_grade = UserGrade.find_by_user_id_and_project_id(pt.user.id, project.id)
+ if user_grade.nil?
+ user_grade = UserGrade.create(:user_id =>pt.user.id, :project_id => project.id)
+ end
+ grades[user_grade.id] = grades[user_grade.id].to_i - 2
end
- grades[user_grade.id] = grades[user_grade.id].to_i - 2
+
end
if level == 1
users_skill[target_user.id] = users_skill[target_user.id].to_i - 2 #帖子被一级会员踩-2分 add praise_tread
unless project.nil?
- user_grade = UserGrade.find_by_user_id_and_project_id(target_user.id, project.id)
- if user_grade.nil?
- user_grade = UserGrade.create(:user_id =>target_user.id, :project_id => project.id)
+ if target_user.member_of?(project)
+ user_grade = UserGrade.find_by_user_id_and_project_id(target_user.id, project.id)
+ if user_grade.nil?
+ user_grade = UserGrade.create(:user_id =>target_user.id, :project_id => project.id)
+ end
+ grades[user_grade.id] = grades[user_grade.id].to_i - 2
end
- grades[user_grade.id] = grades[user_grade.id].to_i - 2
+
end
elsif level == 2
users_skill[target_user.id] = users_skill[target_user.id].to_i - 4 #帖子被二级会员踩-4分 add praise_tread
unless project.nil?
- user_grade = UserGrade.find_by_user_id_and_project_id(target_user.id, project.id)
- if user_grade.nil?
- user_grade = UserGrade.create(:user_id =>target_user.id, :project_id => project.id)
+ if target_user.member_of?(project)
+ user_grade = UserGrade.find_by_user_id_and_project_id(target_user.id, project.id)
+ if user_grade.nil?
+ user_grade = UserGrade.create(:user_id =>target_user.id, :project_id => project.id)
+ end
+ grades[user_grade.id] = grades[user_grade.id].to_i - 4
end
- grades[user_grade.id] = grades[user_grade.id].to_i - 4
+
end
elsif level == 3
users_skill[target_user.id] = users_skill[target_user.id].to_i - 6 #帖子被三级会员踩-6分 add praise_tread
unless project.nil?
- user_grade = UserGrade.find_by_user_id_and_project_id(target_user.id, project.id)
- if user_grade.nil?
- user_grade = UserGrade.create(:user_id =>target_user.id, :project_id => project.id)
+ if target_user.member_of?(project)
+ user_grade = UserGrade.find_by_user_id_and_project_id(target_user.id, project.id)
+ if user_grade.nil?
+ user_grade = UserGrade.create(:user_id =>target_user.id, :project_id => project.id)
+ end
+ grades[user_grade.id] = grades[user_grade.id].to_i - 6
end
- grades[user_grade.id] = grades[user_grade.id].to_i - 6
+
end
end
elsif pt.praise_or_tread == 1
@@ -155,29 +179,38 @@ namespace :user_score do
if level == 1
users_skill[target_user.id] = users_skill[target_user.id].to_i + 4 #帖子被一级会员顶+4分 add praise_tread
unless project.nil?
- user_grade = UserGrade.find_by_user_id_and_project_id(target_user.id, project.id)
- if user_grade.nil?
- user_grade = UserGrade.create(:user_id =>target_user.id, :project_id => project.id)
+ if target_user.member_of?(project)
+ user_grade = UserGrade.find_by_user_id_and_project_id(target_user.id, project.id)
+ if user_grade.nil?
+ user_grade = UserGrade.create(:user_id =>target_user.id, :project_id => project.id)
+ end
+ grades[user_grade.id] = grades[user_grade.id].to_i + 4
end
- grades[user_grade.id] = grades[user_grade.id].to_i + 4
+
end
elsif level == 2
users_skill[target_user.id] = users_skill[target_user.id].to_i + 6 #帖子被二级会员顶+6分 add praise_tread
unless project.nil?
- user_grade = UserGrade.find_by_user_id_and_project_id(target_user.id, project.id)
- if user_grade.nil?
- user_grade = UserGrade.create(:user_id =>target_user.id, :project_id => project.id)
+ if target_user.member_of?(project)
+ user_grade = UserGrade.find_by_user_id_and_project_id(target_user.id, project.id)
+ if user_grade.nil?
+ user_grade = UserGrade.create(:user_id =>target_user.id, :project_id => project.id)
+ end
+ grades[user_grade.id] = grades[user_grade.id].to_i + 6
end
- grades[user_grade.id] = grades[user_grade.id].to_i + 6
+
end
elsif level == 3
users_skill[target_user.id] = users_skill[target_user.id].to_i + 8 #帖子被三级会员顶+8分 add praise_tread
unless project.nil?
- user_grade = UserGrade.find_by_user_id_and_project_id(target_user.id, project.id)
- if user_grade.nil?
- user_grade = UserGrade.create(:user_id =>target_user.id, :project_id => project.id)
+ if target_user.member_of?(project)
+ user_grade = UserGrade.find_by_user_id_and_project_id(target_user.id, project.id)
+ if user_grade.nil?
+ user_grade = UserGrade.create(:user_id =>target_user.id, :project_id => project.id)
+ end
+ grades[user_grade.id] = grades[user_grade.id].to_i + 8
end
- grades[user_grade.id] = grades[user_grade.id].to_i + 8
+
end
end
end
@@ -201,11 +234,14 @@ namespace :user_score do
users_active[changeset.user.id] = users_active[changeset.user.id].to_i + 4
project = changeset.project
unless project.nil?
- user_grade = UserGrade.find_by_user_id_and_project_id(changeset.user.id, project.id)
- if user_grade.nil?
- user_grade = UserGrade.create(:user_id =>changeset.user.id, :project_id => project.id)
+ if changeset.user.member_of?(project)
+ user_grade = UserGrade.find_by_user_id_and_project_id(changeset.user.id, project.id)
+ if user_grade.nil?
+ user_grade = UserGrade.create(:user_id =>changeset.user.id, :project_id => project.id)
+ end
+ grades[user_grade.id] = grades[user_grade.id].to_i + 4
end
- grades[user_grade.id] = grades[user_grade.id].to_i + 4
+
end
end
puts ":push_code calculate Completed. active users count: #{users_active.count}"
@@ -217,11 +253,14 @@ namespace :user_score do
users_active[document.user.id] = users_active[document.user.id].to_i + 4
project = document.project
unless project.nil?
- user_grade = UserGrade.find_by_user_id_and_project_id(document.user.id, project.id)
- if user_grade.nil?
- user_grade = UserGrade.create(:user_id =>document.user.id, :project_id => project.id)
+ if document.user.member_of?(project)
+ user_grade = UserGrade.find_by_user_id_and_project_id(document.user.id, project.id)
+ if user_grade.nil?
+ user_grade = UserGrade.create(:user_id =>document.user.id, :project_id => project.id)
+ end
+ grades[user_grade.id] = grades[user_grade.id].to_i + 4
end
- grades[user_grade.id] = grades[user_grade.id].to_i + 4
+
end
end
puts ":push_document calculate Completed. active users count: #{users_active.count}"
@@ -238,11 +277,14 @@ namespace :user_score do
if attachment.container.class.to_s == "Project"
project = attachment.project
unless project.nil?
- user_grade = UserGrade.find_by_user_id_and_project_id(attachment.author.id, project.id)
- if user_grade.nil?
- user_grade = UserGrade.create(:user_id =>attachment.author.id, :project_id => project.id)
+ if attachment.author.member_of?(project)
+ user_grade = UserGrade.find_by_user_id_and_project_id(attachment.author.id, project.id)
+ if user_grade.nil?
+ user_grade = UserGrade.create(:user_id =>attachment.author.id, :project_id => project.id)
+ end
+ grades[user_grade.id] = grades[user_grade.id].to_i + 4
end
- grades[user_grade.id] = grades[user_grade.id].to_i + 4
+
end
end
@@ -255,11 +297,13 @@ namespace :user_score do
users_active[j.user.id] = users_active[j.user.id].to_i + 2
project = j.project
unless project.nil?
- user_grade = UserGrade.find_by_user_id_and_project_id(j.user.id, project.id)
- if user_grade.nil?
- user_grade = UserGrade.create(:user_id =>j.user.id, :project_id => project.id)
+ if j.user.member_of?(project)
+ user_grade = UserGrade.find_by_user_id_and_project_id(j.user.id, project.id)
+ if user_grade.nil?
+ user_grade = UserGrade.create(:user_id =>j.user.id, :project_id => project.id)
+ end
+ grades[user_grade.id] = grades[user_grade.id].to_i + 4
end
- grades[user_grade.id] = grades[user_grade.id].to_i + 4
end
end
puts ":update_issue_ratio calculate Completed. active users count: #{users_active.count}"
@@ -268,11 +312,14 @@ namespace :user_score do
users_active[issue.author.id] = users_active[issue.author.id].to_i + 4
project = issue.project
unless project.nil?
- user_grade = UserGrade.find_by_user_id_and_project_id(issue.author.id, project.id)
- if user_grade.nil?
- user_grade = UserGrade.create(:user_id =>issue.author.id, :project_id => project.id)
+ if issue.author.member_of?(project)
+ user_grade = UserGrade.find_by_user_id_and_project_id(issue.author.id, project.id)
+ if user_grade.nil?
+ user_grade = UserGrade.create(:user_id =>issue.author.id, :project_id => project.id)
+ end
+ grades[user_grade.id] = grades[user_grade.id].to_i + 4
end
- grades[user_grade.id] = grades[user_grade.id].to_i + 4
+
end
end
puts ":post_issue calculate Completed. active users count: #{users_active.count}"
From 993ac23a3693e93a78bd45fbe12b49527b4e5010 Mon Sep 17 00:00:00 2001
From: nwb
Date: Tue, 1 Jul 2014 15:29:16 +0800
Subject: [PATCH 13/24] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E5=90=84=E6=95=B0?=
=?UTF-8?q?=E6=8D=AE=E8=BF=81=E7=A7=BB=E6=97=B6=E4=B8=8D=E5=86=8D=E5=81=9A?=
=?UTF-8?q?=E9=AA=8C=E8=AF=81=EF=BC=8C=E4=BB=A5=E5=85=BC=E5=AE=B9=E8=80=81?=
=?UTF-8?q?=E6=95=B0=E6=8D=AE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
...0140603033359_add_boards_type_to_boards.rb | 2 +-
.../20140603042015_stored_course_procedure.rb | 4 +-
...3081801_add_courseid_to_enabled_modules.rb | 3 +-
...140604011630_add_courseid_to_to_members.rb | 2 +-
...name_project_id_to_homework_for_courses.rb | 2 +-
.../20140605025300_create_course_infos.rb | 2 +-
.../20140605025303_migrate_course_tags.rb | 2 +-
.../20140606027403_migrate_course_journals.rb | 2 +-
db/migrate/20140606028512_add_course_roles.rb | 2 +-
.../20140611161801_add_courseid_to_news.rb | 2 +-
...18020535_remove_data_to_homework_attach.rb | 2 +-
.../20140618105213_migrate_course_students.rb | 2 +-
...20140618155324_migrate_course_file_type.rb | 2 +-
.../20140626012511_modify_student_roles.rb | 2 +-
db/schema.rb | 64 ++-----------------
15 files changed, 21 insertions(+), 74 deletions(-)
diff --git a/db/migrate/20140603033359_add_boards_type_to_boards.rb b/db/migrate/20140603033359_add_boards_type_to_boards.rb
index fcef8b117..85b3723f9 100644
--- a/db/migrate/20140603033359_add_boards_type_to_boards.rb
+++ b/db/migrate/20140603033359_add_boards_type_to_boards.rb
@@ -11,7 +11,7 @@ class AddBoardsTypeToBoards < ActiveRecord::Migration
if project && project.project_type == 1
board.course_id = project.course_extra.id
board.project_id = -1
- board.save
+ board.save(:validate => false)
end
end
diff --git a/db/migrate/20140603042015_stored_course_procedure.rb b/db/migrate/20140603042015_stored_course_procedure.rb
index 5dd6bc383..40cb87e2e 100644
--- a/db/migrate/20140603042015_stored_course_procedure.rb
+++ b/db/migrate/20140603042015_stored_course_procedure.rb
@@ -14,7 +14,7 @@ class StoredCourseProcedure < ActiveRecord::Migration
course.attachmenttype = 2
#course.lft = project.lft
#course.rgt = project.rgt
- course.save
+ course.save(:validate => false)
# 更新状态表
projectstatus = ProjectStatus.find_by_project_id(project.id)
@@ -25,7 +25,7 @@ class StoredCourseProcedure < ActiveRecord::Migration
courseStatus.watchers_count = projectstatus.watchers_count
courseStatus.grade = projectstatus.grade
courseStatus.course_ac_para = projectstatus.course_ac_para
- courseStatus.save
+ courseStatus.save(:validate => false)
end
end
end
diff --git a/db/migrate/20140603081801_add_courseid_to_enabled_modules.rb b/db/migrate/20140603081801_add_courseid_to_enabled_modules.rb
index be4fe7e6f..61484481f 100644
--- a/db/migrate/20140603081801_add_courseid_to_enabled_modules.rb
+++ b/db/migrate/20140603081801_add_courseid_to_enabled_modules.rb
@@ -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(project_id: -1)
+
EnabledModule.all.each do |enablemodule|
project = Project.find_by_id(enablemodule.project_id)
if project && project.project_type == 1
enablemodule.course_id = project.course_extra.id
enablemodule.project_id = -1
- enablemodule.save
+ enablemodule.save(:validate => false)
end
end
end
diff --git a/db/migrate/20140604011630_add_courseid_to_to_members.rb b/db/migrate/20140604011630_add_courseid_to_to_members.rb
index 583e3a2d1..1fb547d68 100644
--- a/db/migrate/20140604011630_add_courseid_to_to_members.rb
+++ b/db/migrate/20140604011630_add_courseid_to_to_members.rb
@@ -15,7 +15,7 @@ class AddCourseidToToMembers < ActiveRecord::Migration
if project && project.project_type == 1
member.course_id = project.course_extra.id
member.project_id = -1
- member.save
+ member.save(:validate => false)
end
end
end
diff --git a/db/migrate/20140604071624_rename_project_id_to_homework_for_courses.rb b/db/migrate/20140604071624_rename_project_id_to_homework_for_courses.rb
index 613f141cf..e9cf6ee19 100644
--- a/db/migrate/20140604071624_rename_project_id_to_homework_for_courses.rb
+++ b/db/migrate/20140604071624_rename_project_id_to_homework_for_courses.rb
@@ -7,7 +7,7 @@ class RenameProjectIdToHomeworkForCourses < ActiveRecord::Migration
project = Project.find_by_id(work.course_id)
if project && project.project_type == 1
work.course_id = project.course_extra.id
- work.save
+ work.save(:validate => false)
end
end
end
diff --git a/db/migrate/20140605025300_create_course_infos.rb b/db/migrate/20140605025300_create_course_infos.rb
index b1947f3d3..daf9f9537 100644
--- a/db/migrate/20140605025300_create_course_infos.rb
+++ b/db/migrate/20140605025300_create_course_infos.rb
@@ -16,7 +16,7 @@ class CreateCourseInfos < ActiveRecord::Migration
courseinfo = CourseInfos.new
courseinfo.course_id = course.id
courseinfo.user_id = projinfo.user_id
- courseinfo.save
+ courseinfo.save(:validate => false)
end
end
end
diff --git a/db/migrate/20140605025303_migrate_course_tags.rb b/db/migrate/20140605025303_migrate_course_tags.rb
index 6e95839ea..83926ae8e 100644
--- a/db/migrate/20140605025303_migrate_course_tags.rb
+++ b/db/migrate/20140605025303_migrate_course_tags.rb
@@ -7,7 +7,7 @@ class MigrateCourseTags < ActiveRecord::Migration
if project && project.project_type == 1
tagging.taggable_type= 'Course'
tagging.taggable_id = project.course_extra.id
- tagging.save
+ tagging.save(:validate => false)
end
end
end
diff --git a/db/migrate/20140606027403_migrate_course_journals.rb b/db/migrate/20140606027403_migrate_course_journals.rb
index 4a13ef38d..b601483ae 100644
--- a/db/migrate/20140606027403_migrate_course_journals.rb
+++ b/db/migrate/20140606027403_migrate_course_journals.rb
@@ -6,7 +6,7 @@ class MigrateCourseJournals < ActiveRecord::Migration
if project && project.project_type == 1
journal.jour_type = 'Course'
journal.jour_id = project.course_extra.id
- journal.save
+ journal.save(:validate => false)
end
# 将自动设置的更新日期还原
sql = ActiveRecord::Base.connection()
diff --git a/db/migrate/20140606028512_add_course_roles.rb b/db/migrate/20140606028512_add_course_roles.rb
index 7b84b92ac..3435dd25f 100644
--- a/db/migrate/20140606028512_add_course_roles.rb
+++ b/db/migrate/20140606028512_add_course_roles.rb
@@ -47,7 +47,7 @@ class AddCourseRoles < ActiveRecord::Migration
role.permissions.append(:view_course_files )
role.permissions.append(:view_course_journals_for_messages )
role.permissions.append(:view_course_messages )
- role.save
+ role.save(:validate => false)
end
end
diff --git a/db/migrate/20140611161801_add_courseid_to_news.rb b/db/migrate/20140611161801_add_courseid_to_news.rb
index 5ca62a6a7..b1a349387 100644
--- a/db/migrate/20140611161801_add_courseid_to_news.rb
+++ b/db/migrate/20140611161801_add_courseid_to_news.rb
@@ -12,7 +12,7 @@ class AddCourseidToNews < ActiveRecord::Migration
if project && project.project_type == 1
news.course_id = project.course_extra.id
news.project_id = -1
- news.save
+ news.save(:validate => false)
end
end
diff --git a/db/migrate/20140618020535_remove_data_to_homework_attach.rb b/db/migrate/20140618020535_remove_data_to_homework_attach.rb
index 16a1b4911..9067e406b 100644
--- a/db/migrate/20140618020535_remove_data_to_homework_attach.rb
+++ b/db/migrate/20140618020535_remove_data_to_homework_attach.rb
@@ -11,7 +11,7 @@ class RemoveDataToHomeworkAttach < ActiveRecord::Migration
homework.description = biding.description
homework.user_id = biding.user_id
homework.state = 0
- homework.save
+ homework.save(:validate => false)
end
end
diff --git a/db/migrate/20140618105213_migrate_course_students.rb b/db/migrate/20140618105213_migrate_course_students.rb
index ef037682a..9eb43e4b6 100644
--- a/db/migrate/20140618105213_migrate_course_students.rb
+++ b/db/migrate/20140618105213_migrate_course_students.rb
@@ -5,7 +5,7 @@ class MigrateCourseStudents < ActiveRecord::Migration
project = Project.find_by_id(student.course_id)
if project && project.course_extra
student.course_id = project.course_extra.id
- student.save
+ student.save(:validate => false)
end
end
end
diff --git a/db/migrate/20140618155324_migrate_course_file_type.rb b/db/migrate/20140618155324_migrate_course_file_type.rb
index 6cbf3b878..a91b14618 100644
--- a/db/migrate/20140618155324_migrate_course_file_type.rb
+++ b/db/migrate/20140618155324_migrate_course_file_type.rb
@@ -4,7 +4,7 @@ class MigrateCourseFileType < ActiveRecord::Migration
Attachment.all.each do |attach|
if attach.container_type == "Course" && attach.attachtype == 1
attach.attachtype = 4
- attach.save
+ attach.save(:validate => false)
end
end
end
diff --git a/db/migrate/20140626012511_modify_student_roles.rb b/db/migrate/20140626012511_modify_student_roles.rb
index 1db0a734b..182748718 100644
--- a/db/migrate/20140626012511_modify_student_roles.rb
+++ b/db/migrate/20140626012511_modify_student_roles.rb
@@ -6,7 +6,7 @@ class ModifyStudentRoles < ActiveRecord::Migration
role = Role.find_by_name('学生')
if role
role.permissions.append(:add_messages)
- role.save
+ role.save(:validate => false)
end
end
diff --git a/db/schema.rb b/db/schema.rb
index cc3d68cba..67ea26a29 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -175,58 +175,6 @@ ActiveRecord::Schema.define(:version => 20140626012511) do
add_index "changesets_issues", ["changeset_id", "issue_id"], :name => "changesets_issues_ids", :unique => true
- create_table "code_review_assignments", :force => true do |t|
- t.integer "issue_id"
- t.integer "change_id"
- t.integer "attachment_id"
- t.string "file_path"
- t.string "rev"
- t.string "rev_to"
- t.string "action_type"
- t.integer "changeset_id"
- end
-
- create_table "code_review_project_settings", :force => true do |t|
- t.integer "project_id"
- t.integer "tracker_id"
- t.datetime "created_at"
- t.datetime "updated_at"
- t.integer "updated_by"
- t.boolean "hide_code_review_tab", :default => false
- t.integer "auto_relation", :default => 1
- t.integer "assignment_tracker_id"
- t.text "auto_assign"
- t.integer "lock_version", :default => 0, :null => false
- t.boolean "tracker_in_review_dialog", :default => false
- end
-
- create_table "code_review_user_settings", :force => true do |t|
- t.integer "user_id", :default => 0, :null => false
- t.integer "mail_notification", :default => 0, :null => false
- t.datetime "created_at"
- t.datetime "updated_at"
- end
-
- create_table "code_reviews", :force => true do |t|
- t.integer "project_id"
- t.integer "change_id"
- t.datetime "created_at"
- t.datetime "updated_at"
- t.integer "line"
- t.integer "updated_by_id"
- t.integer "lock_version", :default => 0, :null => false
- t.integer "status_changed_from"
- t.integer "status_changed_to"
- t.integer "issue_id"
- t.string "action_type"
- t.string "file_path"
- t.string "rev"
- t.string "rev_to"
- t.integer "attachment_id"
- t.integer "file_count", :default => 0, :null => false
- t.boolean "diff_all"
- end
-
create_table "comments", :force => true do |t|
t.string "commented_type", :limit => 30, :default => "", :null => false
t.integer "commented_id", :default => 0, :null => false
@@ -1041,13 +989,11 @@ ActiveRecord::Schema.define(:version => 20140626012511) do
end
create_table "user_scores", :force => true do |t|
- t.integer "user_id", :null => false
- t.integer "collaboration"
- t.integer "influence"
- t.integer "skill"
- t.integer "active"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
+ t.integer "user_id"
+ t.integer "collaboration"
+ t.integer "influence"
+ t.integer "skill"
+ t.integer "activity"
end
create_table "user_statuses", :force => true do |t|
From cf00942261c8392c08ae15d7e4b1baa9fff4b658 Mon Sep 17 00:00:00 2001
From: nwb
Date: Tue, 1 Jul 2014 16:19:42 +0800
Subject: [PATCH 14/24] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E8=BF=81=E7=A7=BB?=
=?UTF-8?q?=E6=96=87=E4=BB=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../20140603042015_stored_course_procedure.rb | 16 ++++--
db/schema.rb | 52 +++++++++++++++++++
2 files changed, 63 insertions(+), 5 deletions(-)
diff --git a/db/migrate/20140603042015_stored_course_procedure.rb b/db/migrate/20140603042015_stored_course_procedure.rb
index 40cb87e2e..2f5faf5c7 100644
--- a/db/migrate/20140603042015_stored_course_procedure.rb
+++ b/db/migrate/20140603042015_stored_course_procedure.rb
@@ -8,13 +8,19 @@ class StoredCourseProcedure < ActiveRecord::Migration
if project.project_type == 1
course = Course.find_by_extra(project.identifier)
if course
- course.name = project.name
- course.description = project.description
- course.status = project.status
- course.attachmenttype = 2
+ sql = "update courses set name='" + project.name.to_s + "',description='"
+ sql += project.description.to_s + "',status=" + project.status.to_s
+ sql += ",attachmenttype=2 where id=" +course.id.to_s
+ execute(sql)
+
+ # 以下方式保存,描述等经常不能成功
+ #course.name = project.name
+ #course.description = project.description
+ #course.status = project.status
+ #course.attachmenttype = 2
#course.lft = project.lft
#course.rgt = project.rgt
- course.save(:validate => false)
+ #course.save(:validate => false)
# 更新状态表
projectstatus = ProjectStatus.find_by_project_id(project.id)
diff --git a/db/schema.rb b/db/schema.rb
index 67ea26a29..9962892da 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -175,6 +175,58 @@ ActiveRecord::Schema.define(:version => 20140626012511) do
add_index "changesets_issues", ["changeset_id", "issue_id"], :name => "changesets_issues_ids", :unique => true
+ create_table "code_review_assignments", :force => true do |t|
+ t.integer "issue_id"
+ t.integer "change_id"
+ t.integer "attachment_id"
+ t.string "file_path"
+ t.string "rev"
+ t.string "rev_to"
+ t.string "action_type"
+ t.integer "changeset_id"
+ end
+
+ create_table "code_review_project_settings", :force => true do |t|
+ t.integer "project_id"
+ t.integer "tracker_id"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ t.integer "updated_by"
+ t.boolean "hide_code_review_tab", :default => false
+ t.integer "auto_relation", :default => 1
+ t.integer "assignment_tracker_id"
+ t.text "auto_assign"
+ t.integer "lock_version", :default => 0, :null => false
+ t.boolean "tracker_in_review_dialog", :default => false
+ end
+
+ create_table "code_review_user_settings", :force => true do |t|
+ t.integer "user_id", :default => 0, :null => false
+ t.integer "mail_notification", :default => 0, :null => false
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ end
+
+ create_table "code_reviews", :force => true do |t|
+ t.integer "project_id"
+ t.integer "change_id"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ t.integer "line"
+ t.integer "updated_by_id"
+ t.integer "lock_version", :default => 0, :null => false
+ t.integer "status_changed_from"
+ t.integer "status_changed_to"
+ t.integer "issue_id"
+ t.string "action_type"
+ t.string "file_path"
+ t.string "rev"
+ t.string "rev_to"
+ t.integer "attachment_id"
+ t.integer "file_count", :default => 0, :null => false
+ t.boolean "diff_all"
+ end
+
create_table "comments", :force => true do |t|
t.string "commented_type", :limit => 30, :default => "", :null => false
t.integer "commented_id", :default => 0, :null => false
From 2e38f668993a780578fc63c7ca845fafb16c4282 Mon Sep 17 00:00:00 2001
From: z9hang
Date: Tue, 1 Jul 2014 16:31:40 +0800
Subject: [PATCH 15/24] =?UTF-8?q?=E6=90=9C=E7=B4=A2=E7=94=A8=E6=88=B7?=
=?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=BA=E6=8C=89=E6=98=B5=E7=A7=B0=E6=90=9C?=
=?UTF-8?q?=E7=B4=A2?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/models/user.rb | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/app/models/user.rb b/app/models/user.rb
index 30d86f5df..2ae3083d8 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -202,7 +202,8 @@ class User < Principal
where(nil)
else
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
}
From e94ed86eadccc738da9905474b68e262d9943d1d Mon Sep 17 00:00:00 2001
From: nwb
Date: Tue, 1 Jul 2014 16:56:23 +0800
Subject: [PATCH 16/24] =?UTF-8?q?=E9=83=A8=E5=88=86BUG=E4=BF=AE=E6=AD=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/messages/_form.html.erb | 2 +-
app/views/users/_my_joinedcourse.html.erb | 2 +-
db/schema.rb | 12 +++++++-----
3 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/app/views/messages/_form.html.erb b/app/views/messages/_form.html.erb
index 931b472c7..6324cec36 100644
--- a/app/views/messages/_form.html.erb
+++ b/app/views/messages/_form.html.erb
@@ -3,7 +3,7 @@
-
<%= l(:field_subject) %>
+
<%= l(:field_subject) %> *
<%= f.text_field :subject,:size => 60, :style => "width: 99%;", :id => "message_subject" %>
diff --git a/app/views/users/_my_joinedcourse.html.erb b/app/views/users/_my_joinedcourse.html.erb
index 484380778..315204e7a 100644
--- a/app/views/users/_my_joinedcourse.html.erb
+++ b/app/views/users/_my_joinedcourse.html.erb
@@ -13,7 +13,7 @@
<% else %>
-
+
<%= debug(params) if Rails.env.development? %>
From e1d9d6ab45dabfe78c7997b22ba4d8802736812d Mon Sep 17 00:00:00 2001
From: yanxd
Date: Tue, 1 Jul 2014 16:01:42 +0800
Subject: [PATCH 20/24] =?UTF-8?q?tag=E6=9F=A5=E8=AF=A2=E5=B4=A9=E6=BA=83?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/tags_controller.rb | 16 ++++++++--------
...140701075839_add_tag_type_index_to_tagging.rb | 5 +++++
2 files changed, 13 insertions(+), 8 deletions(-)
create mode 100644 db/migrate/20140701075839_add_tag_type_index_to_tagging.rb
diff --git a/app/controllers/tags_controller.rb b/app/controllers/tags_controller.rb
index 4c0d91884..0216d529d 100644
--- a/app/controllers/tags_controller.rb
+++ b/app/controllers/tags_controller.rb
@@ -256,14 +256,14 @@ class TagsController < ApplicationController
# 获取有某类对象的tag总数
def get_tags_size
- @issues_tags_num = Issue.tag_counts.size
- @projects_tags_num = Project.tag_counts.size
- @users_tags_num = User.tag_counts.size
- @bids_tags_num = Bid.tag_counts.size
- forum_tags_num = Forum.tag_counts.size
- attachment_tags_num = Attachment.tag_counts.size
- @open_source_projects_num = OpenSourceProject.tag_counts.size
- @contests_tags_num = Contest.tag_counts.size
+ @issues_tags_num = ActsAsTaggableOn::Tagging.where(taggable_type:"Issue").count
+ @projects_tags_num = ActsAsTaggableOn::Tagging.where(taggable_type:"Project").count
+ @users_tags_num = ActsAsTaggableOn::Tagging.where(taggable_type:"User").count
+ @bids_tags_num = ActsAsTaggableOn::Tagging.where(taggable_type:"Bid").count
+ forum_tags_num = ActsAsTaggableOn::Tagging.where(taggable_type:"Forum").count
+ attachment_tags_num = ActsAsTaggableOn::Tagging.where(taggable_type:"Attachment").count
+ @open_source_projects_num = ActsAsTaggableOn::Tagging.where(taggable_type:"OpenSourceProject").count
+ @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
end
diff --git a/db/migrate/20140701075839_add_tag_type_index_to_tagging.rb b/db/migrate/20140701075839_add_tag_type_index_to_tagging.rb
new file mode 100644
index 000000000..11a5b4ef9
--- /dev/null
+++ b/db/migrate/20140701075839_add_tag_type_index_to_tagging.rb
@@ -0,0 +1,5 @@
+class AddTagTypeIndexToTagging < ActiveRecord::Migration
+ def change
+ add_index :taggings, :taggable_type
+ end
+end
From 2b855badf9ae15ea9b5e8c07987d2f5bf662dd19 Mon Sep 17 00:00:00 2001
From: nwb
Date: Wed, 2 Jul 2014 09:11:45 +0800
Subject: [PATCH 21/24] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E8=AF=BE=E7=A8=8B?=
=?UTF-8?q?=E8=B5=84=E6=BA=90=E5=BA=93=E5=85=B3=E8=81=94=E5=B7=B2=E6=9C=89?=
=?UTF-8?q?=E8=B5=84=E6=BA=90=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/attachments_controller.rb | 29 +++++++++++++++++++
.../add_exist_file_to_course.js.erb | 17 +++++++++++
app/views/files/_course_file.html.erb | 2 +-
config/routes.rb | 1 +
4 files changed, 48 insertions(+), 1 deletion(-)
create mode 100644 app/views/attachments/add_exist_file_to_course.js.erb
diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb
index 5dbb4f2bb..af96d9c68 100644
--- a/app/controllers/attachments_controller.rb
+++ b/app/controllers/attachments_controller.rb
@@ -197,6 +197,35 @@ class AttachmentsController < ApplicationController
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
def find_project
@attachment = Attachment.find(params[:id])
diff --git a/app/views/attachments/add_exist_file_to_course.js.erb b/app/views/attachments/add_exist_file_to_course.js.erb
new file mode 100644
index 000000000..58e5690ef
--- /dev/null
+++ b/app/views/attachments/add_exist_file_to_course.js.erb
@@ -0,0 +1,17 @@
+<% if @save_flag %>
+ window.location.reload();
+<% else %>
+ // alert('添加文件失败:\n<%=@save_message[0]%>');
+ $('#ajax-modal').html('添加文件失败 <%=@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 %>
diff --git a/app/views/files/_course_file.html.erb b/app/views/files/_course_file.html.erb
index c6f872d61..d9913539f 100644
--- a/app/views/files/_course_file.html.erb
+++ b/app/views/files/_course_file.html.erb
@@ -40,7 +40,7 @@
<%= text_field_tag(:attach_search) %>
<%#= submit_tag("Search") %>
<% end -%>
- <%= form_tag attach_relation_path(:format => 'js'),
+ <%= form_tag course_attach_relation_path(:format => 'js'),
method: :post,
remote: true,
id: "relation_file_form",
diff --git a/config/routes.rb b/config/routes.rb
index ad493bce8..2e11d9b43 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -510,6 +510,7 @@ RedmineApp::Application.routes.draw do
get 'attachments/autocomplete'
match 'attachments/autocomplete', :to => 'attachments#autocomplete', via: [:post]
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+/
resources :attachments, :only => [:show, :destroy] do
collection do
From 54a2fb8a9cfcde34beb0b40dee07da02ae9af1b6 Mon Sep 17 00:00:00 2001
From: z9hang
Date: Wed, 2 Jul 2014 11:32:49 +0800
Subject: [PATCH 22/24] =?UTF-8?q?=E4=B8=BB=E9=A1=B5=E9=A1=B9=E7=9B=AE?=
=?UTF-8?q?=E5=BE=97=E5=88=86=E4=B8=8E=E9=A1=B9=E7=9B=AE=E9=A1=B5=E9=9D=A2?=
=?UTF-8?q?=E7=9A=84=E9=A1=B9=E7=9B=AE=E5=BE=97=E5=88=86=E4=BF=9D=E6=8C=81?=
=?UTF-8?q?=E4=B8=80=E8=87=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/helpers/welcome_helper.rb | 1 +
app/views/welcome/index.html.erb | 28 +++++++++++++++++++++++++++-
config/locales/zh.yml | 1 +
3 files changed, 29 insertions(+), 1 deletion(-)
diff --git a/app/helpers/welcome_helper.rb b/app/helpers/welcome_helper.rb
index 35fd6ee08..048933e40 100644
--- a/app/helpers/welcome_helper.rb
+++ b/app/helpers/welcome_helper.rb
@@ -235,6 +235,7 @@ module WelcomeHelper
def show_grade project
grade = 0
begin
+ #ActiveRecord::Base.connection.execute("CALL sp_project_status_cursor();")#执行存储过程速度慢
grade = project.project_status.grade if project && project.project_status
rescue Exception => e
logger.error "Logger.Error [WelcomeHelper] ===> #{e}"
diff --git a/app/views/welcome/index.html.erb b/app/views/welcome/index.html.erb
index 16a4cbf21..345f47739 100644
--- a/app/views/welcome/index.html.erb
+++ b/app/views/welcome/index.html.erb
@@ -68,7 +68,33 @@
><%=project.description.truncate(50, omission: '...')%>
- <%= 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; ",
:title => "项目得分,综合考虑了项目的各项活动,反映了该项目的活跃程度",
:class => "tooltip",
diff --git a/config/locales/zh.yml b/config/locales/zh.yml
index eacd5ac41..9b622531a 100644
--- a/config/locales/zh.yml
+++ b/config/locales/zh.yml
@@ -500,6 +500,7 @@ zh:
label_project_new: 新建项目
label_project_new_description: '项目可以是软件开发项目,也可以是协作研究项目。'
label_project_plural: 项目列表
+ label_project_score: 项目评分
label_x_projects:
zero: 无项目
one: 1 个项目
From e8705bccb1cb6490c22905e8593060999220cf9d Mon Sep 17 00:00:00 2001
From: nwb
Date: Wed, 2 Jul 2014 14:58:52 +0800
Subject: [PATCH 23/24] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=96=87=E4=BB=B6?=
=?UTF-8?q?=E4=B8=8A=E4=BC=A0=E7=95=8C=E9=9D=A2=E6=A0=B7=E5=BC=8F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/attachments_controller.rb | 8 +-
app/helpers/attachments_helper.rb | 39 ++++++++-
app/models/attachment.rb | 100 ++++++++++++++++++++++
app/views/attachments/autocomplete.js.erb | 5 ++
app/views/files/_new.html.erb | 25 ++++--
public/stylesheets/application.css | 2 +-
public/stylesheets/nyan.css | 10 +++
7 files changed, 175 insertions(+), 14 deletions(-)
diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb
index af96d9c68..c234eb17b 100644
--- a/app/controllers/attachments_controller.rb
+++ b/app/controllers/attachments_controller.rb
@@ -161,7 +161,13 @@ class AttachmentsController < ApplicationController
end
def autocomplete
- @project = Project.find_by_id(params[:project_id])
+ # modify by nwb
+ if 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|
format.js
end
diff --git a/app/helpers/attachments_helper.rb b/app/helpers/attachments_helper.rb
index aa6a5f7f5..3e61b2a44 100644
--- a/app/helpers/attachments_helper.rb
+++ b/app/helpers/attachments_helper.rb
@@ -115,7 +115,7 @@ module AttachmentsHelper
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(: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')
@@ -133,6 +133,35 @@ module AttachmentsHelper
# return searched_attach.to_json
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)
s = ''
attachs.each do |attach|
@@ -144,18 +173,22 @@ module AttachmentsHelper
def private_filter resultSet
result = resultSet.to_a.dup
+ # modify by nwb
+ #添加对课程资源文件的判断
resultSet.map { |res|
if(res.container.nil? ||
(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) ||
- 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)
end
}
result
end
+
include Redmine::Pagination
def paginateHelper obj, pre_size=10
@obj_count = obj.count
diff --git a/app/models/attachment.rb b/app/models/attachment.rb
index 53b2e9871..116e2de9a 100644
--- a/app/models/attachment.rb
+++ b/app/models/attachment.rb
@@ -68,6 +68,106 @@ class Attachment < ActiveRecord::Base
before_save :be_user_score # user_score
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
def copy(attributes=nil)
copy = self.class.new
diff --git a/app/views/attachments/autocomplete.js.erb b/app/views/attachments/autocomplete.js.erb
index 784128ea1..404ad9a61 100644
--- a/app/views/attachments/autocomplete.js.erb
+++ b/app/views/attachments/autocomplete.js.erb
@@ -1,2 +1,7 @@
$('#relation_file_form').show();
+<% if @project%>
$('#relation_file').html('<%=render_attachments_for_new_project(@project, nil)%>');
+<% elsif @course%>
+$('#relation_file').html('<%=render_attachments_for_new_course(@course, nil)%>');
+<% end%>
+
diff --git a/app/views/files/_new.html.erb b/app/views/files/_new.html.erb
index af65bbcf4..bd66d93be 100644
--- a/app/views/files/_new.html.erb
+++ b/app/views/files/_new.html.erb
@@ -13,18 +13,25 @@
<%= select_tag "version_id", content_tag('option', '') +
options_from_collection_for_select(versions, "id", "name"), {style: 'width:100px'} %>
+ <% if attachmenttypes.any? %>
+ <%= l(:attachment_type) %>
+
+ <%= select_tag "attachment_type",
+ options_from_collection_for_select(attachmenttypes, "id",
+ "typeName", 2), {style: 'width:100px'} %>
+
+ <% end %>
<% else %>
-
+
+ <% if attachmenttypes.any? %>
+ <%= l(:attachment_type) %>
+ <%= select_tag "attachment_type",
+ options_from_collection_for_select(attachmenttypes, "id",
+ "typeName", 2), {style: 'width:100px'} %>
+ <% end %>
+
<% end %>
- <% if attachmenttypes.any? %>
- <%= l(:attachment_type) %>
-
- <%= select_tag "attachment_type",
- options_from_collection_for_select(attachmenttypes, "id",
- "typeName", 2), {style: 'width:100px'} %>
-
- <% end %>
diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css
index 1a690a4cd..89ee39ada 100644
--- a/public/stylesheets/application.css
+++ b/public/stylesheets/application.css
@@ -1853,7 +1853,7 @@ a.remove-upload:hover {text-decoration:none !important;}
/*gcm upload file count and deleteall*/
#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; }
diff --git a/public/stylesheets/nyan.css b/public/stylesheets/nyan.css
index b041f43a1..30496a061 100644
--- a/public/stylesheets/nyan.css
+++ b/public/stylesheets/nyan.css
@@ -1071,6 +1071,16 @@ div.tags_area {
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 {
background: #ffffff;
border-bottom: 1px solid #d6dfff;
From 6f5d6c382b9258cc459391336d9e5bd72358cc32 Mon Sep 17 00:00:00 2001
From: z9hang
Date: Wed, 2 Jul 2014 17:06:34 +0800
Subject: [PATCH 24/24] =?UTF-8?q?=E7=BB=99=E7=94=A8=E6=88=B7=E7=95=99?=
=?UTF-8?q?=E8=A8=80=E7=9A=84=E5=9B=9E=E5=A4=8D=E8=8B=A5=E4=B8=BA=E6=9F=A5?=
=?UTF-8?q?=E7=9C=8B=E8=AE=A1=E5=85=A5=E6=96=B0=E7=95=99=E8=A8=80=E6=95=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/users_controller.rb | 6 +++++-
app/controllers/words_controller.rb | 3 ++-
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index f78112c21..144e86f4f 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -52,6 +52,7 @@ class UsersController < ApplicationController
helper :custom_fields
include CustomFieldsHelper
include AvatarHelper
+ include WordsHelper
# added by liuping 关注
@@ -235,7 +236,10 @@ class UsersController < ApplicationController
def user_newfeedback
@jours = @user.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC')
@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
@feedback_count = @jours.count
@feedback_pages = Paginator.new @feedback_count, @limit, params['page']
diff --git a/app/controllers/words_controller.rb b/app/controllers/words_controller.rb
index 52a7f585a..a4f53c100 100644
--- a/app/controllers/words_controller.rb
+++ b/app/controllers/words_controller.rb
@@ -56,7 +56,8 @@ class WordsController < ApplicationController
reply_user_id = params[:reference_user_id]
reply_id = params[:reference_message_id] # 暂时不实现
content = params[:user_notes]
- options = {:user_id => author_id,
+ options = {:user_id => author_id,
+ :status => true,
:m_parent_id => parent_id,
:m_reply_id => reply_id,
:reply_id => reply_user_id,