From 1855adb0371710ddbbecc752ec3c79284bd6cf03 Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 11 Sep 2015 11:40:07 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E6=9C=AA=E7=99=BB=E5=BD=95=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E4=B8=8D=E8=83=BD=E8=AE=BF=E9=97=AE=E6=96=B0=E5=BB=BA?= =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/courses_controller.rb | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index db972941e..a7f1589a6 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -468,13 +468,17 @@ class CoursesController < ApplicationController end def new - @course_type = params[:course_type] ||= params[:course] - @issue_custom_fields = IssueCustomField.sorted.all - @trackers = Tracker.sorted.all - @course = Course.new - @course.safe_attributes = params[:course] - # month = Time.now.month - render :layout => 'new_base' + if User.current.login? + @course_type = params[:course_type] ||= params[:course] + @issue_custom_fields = IssueCustomField.sorted.all + @trackers = Tracker.sorted.all + @course = Course.new + @course.safe_attributes = params[:course] + # month = Time.now.month + render :layout => 'new_base' + else + redirect_to signin_url + end end def desc_sort_course_by_avtivity(activity_count, courses) From 2da3454bc50ad0462b7454a95064822ac121195e Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 11 Sep 2015 11:41:31 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E6=9A=82=E6=97=B6=E5=B1=8F=E8=94=BD?= =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E5=A4=8D=E5=88=B6=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/base_courses.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/layouts/base_courses.html.erb b/app/views/layouts/base_courses.html.erb index 7841ead91..d6d5581e6 100644 --- a/app/views/layouts/base_courses.html.erb +++ b/app/views/layouts/base_courses.html.erb @@ -77,7 +77,7 @@ <% if is_teacher%> <%= link_to "#{l(:button_configure)}".html_safe, {:controller => 'courses', :action => 'settings', :id => @course}, :class => "pr_join_a" %> <%= set_course_time @course%> - <%= link_to "#{l(:button_copy)}".html_safe, copy_course_course_path(@course.id), :class => "pr_join_a" %> + <%#= link_to "#{l(:button_copy)}".html_safe, copy_course_course_path(@course.id), :class => "pr_join_a" %> <% else%>
<%= join_in_course_header(@course, User.current) %>
<% end%> From 585818fe7a9f234af16b0d3622b1d26fb1d502c6 Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 11 Sep 2015 16:42:24 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E8=AE=A8=E8=AE=BA=E5=8C=BA=E5=8A=A8?= =?UTF-8?q?=E6=80=81=E9=87=8D=E5=A4=8D=E5=87=BA=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/course_activity.rb | 20 ++++++++++------ app/models/forge_activity.rb | 19 +++++++++++----- db/schema.rb | 43 ++++++++++++++--------------------- 3 files changed, 43 insertions(+), 39 deletions(-) diff --git a/app/models/course_activity.rb b/app/models/course_activity.rb index 103796a72..4e74142ad 100644 --- a/app/models/course_activity.rb +++ b/app/models/course_activity.rb @@ -14,13 +14,19 @@ class CourseActivity < ActiveRecord::Base if user_activity user_activity.save else - user_activity = UserActivity.new - user_activity.act_id = self.course_act_id - user_activity.act_type = self.course_act_type - user_activity.container_type = "Course" - user_activity.container_id = self.course_id - user_activity.user_id = self.user_id - user_activity.save + if self.course_act_type == 'Message' && !self.course_act.parent_id.nil? + user_activity = UserActivity.where("act_type = 'Message' and act_id = #{self.course_act.parent.id}").first + user_activity.created_at = self.created_at + user_activity.save + else + user_activity = UserActivity.new + user_activity.act_id = self.course_act_id + user_activity.act_type = self.course_act_type + user_activity.container_type = "Course" + user_activity.container_id = self.course_id + user_activity.user_id = self.user_id + user_activity.save + end end end diff --git a/app/models/forge_activity.rb b/app/models/forge_activity.rb index 9bc10bebf..c4f13c6d0 100644 --- a/app/models/forge_activity.rb +++ b/app/models/forge_activity.rb @@ -29,12 +29,19 @@ class ForgeActivity < ActiveRecord::Base if user_activity user_activity.save else - user_activity = UserActivity.new - user_activity.act_id = self.forge_act_id - user_activity.act_type = self.forge_act_type - user_activity.container_type = "Project" - user_activity.container_id = self.project_id - user_activity.save + if self.forge_act_type == 'Message' && !self.forge_act.parent_id.nil? + user_activity = UserActivity.where("act_type = 'Message' and act_id = #{self.forge_act.parent.id}").first + user_activity.created_at = self.created_at + user_activity.save + else + user_activity = UserActivity.new + user_activity.act_id = self.forge_act_id + user_activity.act_type = self.forge_act_type + user_activity.container_type = "Project" + user_activity.container_id = self.project_id + user_activity.user_id = self.user_id + user_activity.save + end end end diff --git a/db/schema.rb b/db/schema.rb index 008e13129..9f81c43cf 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 => 20150911031029) do +ActiveRecord::Schema.define(:version => 20150911064528) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -476,13 +476,6 @@ ActiveRecord::Schema.define(:version => 20150911031029) do add_index "delayed_jobs", ["priority", "run_at"], :name => "delayed_jobs_priority" - create_table "discuss_demos", :force => true do |t| - t.string "title" - t.text "body" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - create_table "documents", :force => true do |t| t.integer "project_id", :default => 0, :null => false t.integer "category_id", :default => 0, :null => false @@ -497,26 +490,23 @@ ActiveRecord::Schema.define(:version => 20150911031029) do add_index "documents", ["created_on"], :name => "index_documents_on_created_on" add_index "documents", ["project_id"], :name => "documents_project_id" - create_table "dts", :primary_key => "Num", :force => true do |t| - t.string "Defect", :limit => 50 - t.string "Category", :limit => 50 - t.string "File" - t.string "Method" - t.string "Module", :limit => 20 - t.string "Variable", :limit => 50 - t.integer "StartLine" - t.integer "IPLine" - t.string "IPLineCode", :limit => 200 - t.string "Judge", :limit => 15 - t.integer "Review", :limit => 1 + create_table "dts", :force => true do |t| + t.string "IPLineCode" t.string "Description" - t.text "PreConditions", :limit => 2147483647 - t.text "TraceInfo", :limit => 2147483647 - t.text "Code", :limit => 2147483647 + t.string "Num" + t.string "Variable" + t.string "TraceInfo" + t.string "Method" + t.string "File" + t.string "IPLine" + t.string "Review" + t.string "Category" + t.string "Defect" + t.string "PreConditions" + t.string "StartLine" t.integer "project_id" - t.datetime "created_at" - t.datetime "updated_at" - t.integer "id", :null => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false end create_table "enabled_modules", :force => true do |t| @@ -916,6 +906,7 @@ ActiveRecord::Schema.define(:version => 20150911031029) do t.datetime "created_on" t.integer "comments_count", :default => 0, :null => false t.integer "course_id" + t.datetime "updated_on" end add_index "news", ["author_id"], :name => "index_news_on_author_id"