From 550d0566304cddd455759fb3e03c550c42e1139e Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 20 Nov 2015 20:55:37 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=9F=90=E4=B8=AA?= =?UTF-8?q?=E9=A2=98=E7=9B=AE=E5=90=8E=E9=A1=BA=E5=BA=8F=E6=8E=92=E5=88=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/exercise_controller.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/exercise_controller.rb b/app/controllers/exercise_controller.rb index c8e5bf27c..cd1f32fa9 100644 --- a/app/controllers/exercise_controller.rb +++ b/app/controllers/exercise_controller.rb @@ -275,12 +275,12 @@ class ExerciseController < ApplicationController @exercise = @exercise_question.exercise if @exercise_question.question_type == 1 - ExerciseQuestion.where("question_number>? and question_type=?",params[:quest_num].to_i, 1).update_all(" question_number = question_number - 1") + ExerciseQuestion.where("question_number #{params[:quest_num].to_i} and question_type == 1").update_all(" question_number = question_number + 1") elsif @exercise_question.question_type == 2 - ExerciseQuestion.where("question_number>? and question_type=?",params[:quest_num].to_i, 2).update_all(" question_number = question_number - 1") + ExerciseQuestion.where("question_number? and question_type=?",params[:quest_num].to_i, 3).update_all(" question_number = question_number - 1") + ExerciseQuestion.where("question_number Date: Fri, 20 Nov 2015 21:14:09 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E7=9A=84=E6=97=B6=E5=80=99=E9=A1=BA=E5=BA=8F=E4=B9=B1=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98=20=E6=B7=BB=E5=8A=A0=E7=9B=B8=E5=BA=94?= =?UTF-8?q?=E7=9A=84=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/exercise_controller.rb | 6 +++--- app/views/exercise/_show_MC.html.erb | 2 +- app/views/exercise/_show_MCQ.html.erb | 2 +- app/views/exercise/_show_single.html.erb | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/controllers/exercise_controller.rb b/app/controllers/exercise_controller.rb index cd1f32fa9..c8e5bf27c 100644 --- a/app/controllers/exercise_controller.rb +++ b/app/controllers/exercise_controller.rb @@ -275,12 +275,12 @@ class ExerciseController < ApplicationController @exercise = @exercise_question.exercise if @exercise_question.question_type == 1 - ExerciseQuestion.where("question_number? and question_type=?",params[:quest_num].to_i, 1).update_all(" question_number = question_number - 1") #@exercise.exercise_questions.where("question_number > #{params[:quest_num].to_i} and question_type == 1").update_all(" question_number = question_number + 1") elsif @exercise_question.question_type == 2 - ExerciseQuestion.where("question_number? and question_type=?",params[:quest_num].to_i, 2).update_all(" question_number = question_number - 1") else - ExerciseQuestion.where("question_number? and question_type=?",params[:quest_num].to_i, 3).update_all(" question_number = question_number - 1") end # @exercise_question_num = params[:quest_num].to_i # @exercise_questions.question_number = params[:quest_num].to_i - 1 diff --git a/app/views/exercise/_show_MC.html.erb b/app/views/exercise/_show_MC.html.erb index b932eac1e..6f3081e5f 100644 --- a/app/views/exercise/_show_MC.html.erb +++ b/app/views/exercise/_show_MC.html.erb @@ -4,7 +4,7 @@ (<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %>) - <%= link_to("", delete_exercise_question_exercise_index_path(:exercise_question => exercise_question.id), + <%= link_to("", delete_exercise_question_exercise_index_path(:exercise_question => exercise_question.id, :quest_num => exercise_question.question_number), method: :delete, :confirm => l(:text_are_you_sure), :remote => true, :class => "ur_icon_de") %> diff --git a/app/views/exercise/_show_MCQ.html.erb b/app/views/exercise/_show_MCQ.html.erb index 2a91afab5..e4bdad3f1 100644 --- a/app/views/exercise/_show_MCQ.html.erb +++ b/app/views/exercise/_show_MCQ.html.erb @@ -3,7 +3,7 @@ <%= exercise_question.question_title %> (<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %>) - <%= link_to("", delete_exercise_question_exercise_index_path(:exercise_question => exercise_question.id), + <%= link_to("", delete_exercise_question_exercise_index_path(:exercise_question => exercise_question.id, :quest_num => exercise_question.question_number), method: :delete, :confirm => l(:text_are_you_sure), :remote => true, :class => "ur_icon_de") %> diff --git a/app/views/exercise/_show_single.html.erb b/app/views/exercise/_show_single.html.erb index 5f36a931e..8223f98fd 100644 --- a/app/views/exercise/_show_single.html.erb +++ b/app/views/exercise/_show_single.html.erb @@ -2,8 +2,8 @@
第<%= exercise_question.question_number%>题.(<%= exercise_question.question_score %>分)
<%= exercise_question.question_title %>
- <%= link_to("", delete_exercise_question_exercise_index_path(:exercise_question => exercise_question.id), - method: :delete, :confirm => l(:text_are_you_sure), :remote => true, :class => "ur_icon_de") %> + <%= link_to("", delete_exercise_question_exercise_index_path(:exercise_question => exercise_question.id, :quest_num => exercise_question.question_number), + method: :delete, :confirm => l(:text_are_you_sure), :remote => true, :class => "ur_icon_de") %>
From 1df8c94b989483d2cefe12dbc42515662f752b96 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 20 Nov 2015 21:49:36 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E5=AD=97=E7=AC=A6?= =?UTF-8?q?=E8=BF=87=E9=95=BF=E4=B8=8D=E8=83=BD=E4=BF=9D=E5=AD=98=E6=88=90?= =?UTF-8?q?=E5=8A=9F=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...opy_course_activities_to_org_activities.rb | 40 ++--- db/schema.rb | 140 ++---------------- 2 files changed, 32 insertions(+), 148 deletions(-) diff --git a/db/migrate/20151118031602_copy_course_activities_to_org_activities.rb b/db/migrate/20151118031602_copy_course_activities_to_org_activities.rb index 08f952afa..2b5d6ba1e 100644 --- a/db/migrate/20151118031602_copy_course_activities_to_org_activities.rb +++ b/db/migrate/20151118031602_copy_course_activities_to_org_activities.rb @@ -1,25 +1,25 @@ class CopyCourseActivitiesToOrgActivities < ActiveRecord::Migration def up - count = CourseActivity.all.count/30 + 1 - for i in 1 ... count do - transaction do - CourseActivity.page(i).per(30).each do |course_act| - if course_act.course_act_type == 'Message' && !course_act.course_act.parent_id.nil? - org_activity = OrgActivity.where("org_act_type = 'Message' and org_act_id = #{course_act.course_act.parent.id}").first - org_activity.created_at = course_act.created_at - org_activity.save - else - OrgActivity.create(:user_id => course_act.user_id, - :org_act_id => course_act.course_act_id, - :org_act_type => course_act.course_act_type, - :container_id => course_act.course_id, - :container_type => 'Course', - :created_at => course_act.created_at, - :updated_at => course_act.updated_at) - end - end - end - end + # count = CourseActivity.all.count/30 + 1 + # for i in 1 ... count do + # transaction do + # CourseActivity.page(i).per(30).each do |course_act| + # if course_act.course_act_type == 'Message' && !course_act.course_act.parent_id.nil? + # org_activity = OrgActivity.where("org_act_type = 'Message' and org_act_id = #{course_act.course_act.parent.id}").first + # org_activity.created_at = course_act.created_at + # org_activity.save + # else + # OrgActivity.create(:user_id => course_act.user_id, + # :org_act_id => course_act.course_act_id, + # :org_act_type => course_act.course_act_type, + # :container_id => course_act.course_id, + # :container_type => 'Course', + # :created_at => course_act.created_at, + # :updated_at => course_act.updated_at) + # end + # end + # end + # end end def down diff --git a/db/schema.rb b/db/schema.rb index 27b52780d..95f79b84b 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 => 20151120021958) do +ActiveRecord::Schema.define(:version => 20151120134208) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -241,58 +241,6 @@ ActiveRecord::Schema.define(:version => 20151120021958) 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 @@ -425,8 +373,8 @@ ActiveRecord::Schema.define(:version => 20151120021958) do t.string "code" t.integer "time" t.string "extra" - 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 "location" t.string "term" t.string "string" @@ -436,14 +384,14 @@ ActiveRecord::Schema.define(:version => 20151120021958) do t.string "class_period" t.integer "school_id" t.text "description" - t.integer "status", :default => 1 - t.integer "attachmenttype", :default => 2 + t.integer "status", :default => 1 + t.integer "attachmenttype", :default => 2 t.integer "lft" t.integer "rgt" - t.integer "is_public", :limit => 1, :default => 1 - t.integer "inherit_members", :limit => 1, :default => 1 - t.integer "open_student", :default => 0 - t.integer "outline", :default => 0 + t.integer "is_public", :limit => 1, :default => 1 + t.integer "inherit_members", :limit => 1, :default => 1 + t.integer "open_student", :default => 0 + t.integer "outline", :default => 0 t.integer "publish_resource", :default => 0 end @@ -573,7 +521,6 @@ ActiveRecord::Schema.define(:version => 20151120021958) do add_index "enumerations", ["id", "type"], :name => "index_enumerations_on_id_and_type" add_index "enumerations", ["project_id"], :name => "index_enumerations_on_project_id" -<<<<<<< .mine create_table "exercise_answers", :force => true do |t| t.integer "user_id" t.integer "exercise_question_id" @@ -592,7 +539,7 @@ ActiveRecord::Schema.define(:version => 20151120021958) do end create_table "exercise_questions", :force => true do |t| - t.string "question_title" + t.text "question_title" t.integer "question_type" t.integer "question_number" t.integer "exercise_id" @@ -621,7 +568,7 @@ ActiveRecord::Schema.define(:version => 20151120021958) do end create_table "exercises", :force => true do |t| - t.string "exercise_name" + t.text "exercise_name" t.text "exercise_description" t.integer "course_id" t.integer "exercise_status" @@ -634,68 +581,6 @@ ActiveRecord::Schema.define(:version => 20151120021958) do t.integer "show_result" end -======= - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ->>>>>>> .theirs create_table "first_pages", :force => true do |t| t.string "web_title" t.string "title" @@ -1180,7 +1065,7 @@ ActiveRecord::Schema.define(:version => 20151120021958) do end create_table "org_document_comments", :force => true do |t| - t.string "title" + t.text "title" t.text "content" t.integer "organization_id" t.integer "creator_id" @@ -1200,7 +1085,6 @@ ActiveRecord::Schema.define(:version => 20151120021958) do create_table "org_members", :force => true do |t| t.integer "user_id" t.integer "organization_id" - t.string "role" t.datetime "created_at", :null => false t.datetime "updated_at", :null => false end