From 5a153637b7629e37f89b407279d92d1b09671b17 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Fri, 13 Nov 2015 11:43:44 +0800 Subject: [PATCH 001/143] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=9C=A8=E7=BA=BF?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E8=BF=81=E7=A7=BB=E9=97=AE=E5=8D=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/migrate/20151113025341_exercise.rb | 18 ++++++++++++++++++ db/migrate/20151113025459_exercise_question.rb | 14 ++++++++++++++ db/migrate/20151113025524_exercise_choices.rb | 14 ++++++++++++++ .../20151113025549_exercise_standard_answer.rb | 14 ++++++++++++++ db/migrate/20151113025721_exercise_answer.rb | 15 +++++++++++++++ db/migrate/20151113025751_user_exercise.rb | 14 ++++++++++++++ 6 files changed, 89 insertions(+) create mode 100644 db/migrate/20151113025341_exercise.rb create mode 100644 db/migrate/20151113025459_exercise_question.rb create mode 100644 db/migrate/20151113025524_exercise_choices.rb create mode 100644 db/migrate/20151113025549_exercise_standard_answer.rb create mode 100644 db/migrate/20151113025721_exercise_answer.rb create mode 100644 db/migrate/20151113025751_user_exercise.rb diff --git a/db/migrate/20151113025341_exercise.rb b/db/migrate/20151113025341_exercise.rb new file mode 100644 index 000000000..8fdcf0a9e --- /dev/null +++ b/db/migrate/20151113025341_exercise.rb @@ -0,0 +1,18 @@ +class Exercise < ActiveRecord::Migration + def up + create_table :exercise do |t| + t.string :exercise_name + t.text :exercise_description + t.integer :course_id + t.integer :exercise_status + t.integer :user_id + t.datetime :start_at + t.datetime :end_at + t.timestamps + end + end + + def down + drop_table :exercise + end +end diff --git a/db/migrate/20151113025459_exercise_question.rb b/db/migrate/20151113025459_exercise_question.rb new file mode 100644 index 000000000..3ab084f13 --- /dev/null +++ b/db/migrate/20151113025459_exercise_question.rb @@ -0,0 +1,14 @@ +class ExerciseQuestion < ActiveRecord::Migration + def up + create_table :exercise_question do |t| + t.string :question_title + t.integer :question_type + t.integer :exercise_id + t.timestamps + end + end + + def down + drop_table :exercise_question + end +end diff --git a/db/migrate/20151113025524_exercise_choices.rb b/db/migrate/20151113025524_exercise_choices.rb new file mode 100644 index 000000000..782cb5f7d --- /dev/null +++ b/db/migrate/20151113025524_exercise_choices.rb @@ -0,0 +1,14 @@ +class ExerciseChoices < ActiveRecord::Migration + def up + create_table :exercise_choices do |t| + t.integer :exercise_question_id + t.text :choice_text + t.integer :choice_position + t.timestamps + end + end + + def down + drop_table :exercise_choices + end +end diff --git a/db/migrate/20151113025549_exercise_standard_answer.rb b/db/migrate/20151113025549_exercise_standard_answer.rb new file mode 100644 index 000000000..17e59eaf8 --- /dev/null +++ b/db/migrate/20151113025549_exercise_standard_answer.rb @@ -0,0 +1,14 @@ +class ExerciseStandardAnswer < ActiveRecord::Migration + def up + create_table :exercise_standard_answer do |t| + t.integer :exercise_question_id + t.integer :exercise_choices_id + t.text :answer_text + t.timestamps + end + end + + def down + drop_table :exercise_standard_answer + end +end diff --git a/db/migrate/20151113025721_exercise_answer.rb b/db/migrate/20151113025721_exercise_answer.rb new file mode 100644 index 000000000..0a34c15ea --- /dev/null +++ b/db/migrate/20151113025721_exercise_answer.rb @@ -0,0 +1,15 @@ +class ExerciseAnswer < ActiveRecord::Migration + def up + create_table :exercise_answer do |t| + t.integer :user_id + t.integer :exercise_question_id + t.integer :exercise_choices_id + t.text :answer_text + t.timestamps + end + end + + def down + drop_table :exercise_answer + end +end diff --git a/db/migrate/20151113025751_user_exercise.rb b/db/migrate/20151113025751_user_exercise.rb new file mode 100644 index 000000000..b0a003d1d --- /dev/null +++ b/db/migrate/20151113025751_user_exercise.rb @@ -0,0 +1,14 @@ +class UserExercise < ActiveRecord::Migration + def up + create_table :user_exercise do |t| + t.integer :user_id + t.integer :exercise_id + t.integer :score + t.timestamps + end + end + + def down + drop_table :user_exercise + end +end From bbf087fa67452482f07bae27d4bf75ab0fcccdc2 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Fri, 13 Nov 2015 14:40:14 +0800 Subject: [PATCH 002/143] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=BA=93=E7=9A=84?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BB=A5=E5=8F=8Amodel=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=85=B3=E7=B3=BB=E7=9A=84=E7=A1=AE=E5=AE=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/exercise.rb | 7 +++++++ app/models/exercise_answer.rb | 8 ++++++++ app/models/exercise_choices.rb | 7 +++++++ app/models/exercise_question.rb | 8 ++++++++ app/models/exercise_standard_answer.rb | 7 +++++++ app/models/exercise_user.rb | 6 ++++++ app/models/user.rb | 6 ++++++ db/migrate/20151113025341_exercise.rb | 3 +-- db/migrate/20151113025459_exercise_question.rb | 1 + db/migrate/20151113025751_user_exercise.rb | 5 +++-- 10 files changed, 54 insertions(+), 4 deletions(-) create mode 100644 app/models/exercise.rb create mode 100644 app/models/exercise_answer.rb create mode 100644 app/models/exercise_choices.rb create mode 100644 app/models/exercise_question.rb create mode 100644 app/models/exercise_standard_answer.rb create mode 100644 app/models/exercise_user.rb diff --git a/app/models/exercise.rb b/app/models/exercise.rb new file mode 100644 index 000000000..752441947 --- /dev/null +++ b/app/models/exercise.rb @@ -0,0 +1,7 @@ +class Exercise < ActiveRecord::Base + include Redmine::SafeAttributes + belongs_to :user + has_many :exercise_questions, :dependent => :destroy,:order => "#{ExerciseQuestion.table_name}.question_number" + has_many :exercise_users, :dependent => :destroy + has_many :users, :through => :exercise_users #该文件被哪些用户提交答案过 +end diff --git a/app/models/exercise_answer.rb b/app/models/exercise_answer.rb new file mode 100644 index 000000000..14b60982a --- /dev/null +++ b/app/models/exercise_answer.rb @@ -0,0 +1,8 @@ +class ExerciseAnswer < ActiveRecord::Base + #学生答题 + include Redmine::SafeAttributes + + belongs_to :user + belongs_to :exercise_question + belongs_to :exercise_choices +end diff --git a/app/models/exercise_choices.rb b/app/models/exercise_choices.rb new file mode 100644 index 000000000..8e67a8c0a --- /dev/null +++ b/app/models/exercise_choices.rb @@ -0,0 +1,7 @@ +class ExerciseChoices < ActiveRecord::Base + include Redmine::SafeAttributes + + belongs_to :exercise_question + has_many :exercise_answers, :dependent => :destroy + has_many :exercise_standard_answers, :dependent => :destroy +end diff --git a/app/models/exercise_question.rb b/app/models/exercise_question.rb new file mode 100644 index 000000000..64ec53e4c --- /dev/null +++ b/app/models/exercise_question.rb @@ -0,0 +1,8 @@ +class ExerciseQuestion < ActiveRecord::Base + include Redmine::SafeAttributes + + belongs_to :exercise + has_many :exercise_choiceses, :order => "#{ExerciseChoices.table_name}.choice_position",:dependent => :destroy + has_many :exercise_answers, :dependent => :destroy + has_many :exercise_standard_answers, :dependent => :destroy +end diff --git a/app/models/exercise_standard_answer.rb b/app/models/exercise_standard_answer.rb new file mode 100644 index 000000000..2b67a83a2 --- /dev/null +++ b/app/models/exercise_standard_answer.rb @@ -0,0 +1,7 @@ +class ExerciseStandardAnswer < ActiveRecord::Base + #标准答案 + include Redmine::SafeAttributes + + belongs_to :exercise_question + belongs_to :exercise_choices +end diff --git a/app/models/exercise_user.rb b/app/models/exercise_user.rb new file mode 100644 index 000000000..2d5da5d95 --- /dev/null +++ b/app/models/exercise_user.rb @@ -0,0 +1,6 @@ +class ExerciseUser < ActiveRecord::Base + include Redmine::SafeAttributes + + belongs_to :user + belongs_to :exercise +end diff --git a/app/models/user.rb b/app/models/user.rb index edc29c015..9e470380d 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -81,6 +81,12 @@ class User < Principal has_many :poll, :dependent => :destroy #用户创建的问卷 has_many :answers, :source => :poll, :through => :poll_users, :dependent => :destroy #用户已经完成问答的问卷 # end + #在线测验相关关系 + has_many :exercise_users, :dependent => :destroy #答卷中间表 + has_many :exercise_answers, :dependent => :destroy #针对每个题目学生的答案 + has_many :exercises, :dependent => :destroy #创建的试卷 + has_many :exercises_answers, :source => :exercises, :through => :exercise_users, :dependent => :destroy #用户已经完成问答的试卷 + #end #作业相关关系 has_many :homework_commons, :dependent => :destroy has_many :student_works, :dependent => :destroy diff --git a/db/migrate/20151113025341_exercise.rb b/db/migrate/20151113025341_exercise.rb index 8fdcf0a9e..696f8d953 100644 --- a/db/migrate/20151113025341_exercise.rb +++ b/db/migrate/20151113025341_exercise.rb @@ -6,8 +6,7 @@ class Exercise < ActiveRecord::Migration t.integer :course_id t.integer :exercise_status t.integer :user_id - t.datetime :start_at - t.datetime :end_at + t.integer :time t.timestamps end end diff --git a/db/migrate/20151113025459_exercise_question.rb b/db/migrate/20151113025459_exercise_question.rb index 3ab084f13..5e83504c5 100644 --- a/db/migrate/20151113025459_exercise_question.rb +++ b/db/migrate/20151113025459_exercise_question.rb @@ -3,6 +3,7 @@ class ExerciseQuestion < ActiveRecord::Migration create_table :exercise_question do |t| t.string :question_title t.integer :question_type + t.integer :question_number t.integer :exercise_id t.timestamps end diff --git a/db/migrate/20151113025751_user_exercise.rb b/db/migrate/20151113025751_user_exercise.rb index b0a003d1d..a49053146 100644 --- a/db/migrate/20151113025751_user_exercise.rb +++ b/db/migrate/20151113025751_user_exercise.rb @@ -1,14 +1,15 @@ class UserExercise < ActiveRecord::Migration def up - create_table :user_exercise do |t| + create_table :exercise_user do |t| t.integer :user_id t.integer :exercise_id t.integer :score + t.datetime :start_at t.timestamps end end def down - drop_table :user_exercise + drop_table :exercise_user end end From 466f3c4cc356afccfce09a055c450b132ac77e02 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Fri, 13 Nov 2015 15:47:39 +0800 Subject: [PATCH 003/143] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=BA=93=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E4=BB=A5=E5=8F=8A=E4=B8=80=E5=AF=B9=E4=B8=80=EF=BC=8C?= =?UTF-8?q?=E4=B8=80=E5=AF=B9=E5=A4=9A=EF=BC=8C=E5=A4=9A=E5=AF=B9=E5=A4=9A?= =?UTF-8?q?=E7=AD=89=E5=85=B3=E7=B3=BB=E7=9A=84=E7=A1=AE=E7=AB=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/exercise.rb | 2 +- app/models/exercise_answer.rb | 2 +- ...exercise_choices.rb => exercise_choice.rb} | 2 +- app/models/exercise_question.rb | 2 +- app/models/exercise_standard_answer.rb | 2 +- app/models/user.rb | 6 +- db/migrate/20151113025341_exercise.rb | 2 +- .../20151113025459_exercise_question.rb | 2 +- ...20151113025549_exercise_standard_answer.rb | 4 +- db/migrate/20151113025721_exercise_answer.rb | 4 +- db/migrate/20151113025751_user_exercise.rb | 2 +- db/schema.rb | 56 ++++++++++++++++++- 12 files changed, 70 insertions(+), 16 deletions(-) rename app/models/{exercise_choices.rb => exercise_choice.rb} (81%) diff --git a/app/models/exercise.rb b/app/models/exercise.rb index 752441947..cbf3a6e91 100644 --- a/app/models/exercise.rb +++ b/app/models/exercise.rb @@ -3,5 +3,5 @@ class Exercise < ActiveRecord::Base belongs_to :user has_many :exercise_questions, :dependent => :destroy,:order => "#{ExerciseQuestion.table_name}.question_number" has_many :exercise_users, :dependent => :destroy - has_many :users, :through => :exercise_users #该文件被哪些用户提交答案过 + has_many :users, :through => :exercise_users #该测试被哪些用户提交答案过 end diff --git a/app/models/exercise_answer.rb b/app/models/exercise_answer.rb index 14b60982a..c62f5bcd5 100644 --- a/app/models/exercise_answer.rb +++ b/app/models/exercise_answer.rb @@ -4,5 +4,5 @@ class ExerciseAnswer < ActiveRecord::Base belongs_to :user belongs_to :exercise_question - belongs_to :exercise_choices + belongs_to :exercise_choice end diff --git a/app/models/exercise_choices.rb b/app/models/exercise_choice.rb similarity index 81% rename from app/models/exercise_choices.rb rename to app/models/exercise_choice.rb index 8e67a8c0a..00d611566 100644 --- a/app/models/exercise_choices.rb +++ b/app/models/exercise_choice.rb @@ -1,4 +1,4 @@ -class ExerciseChoices < ActiveRecord::Base +class ExerciseChoice < ActiveRecord::Base include Redmine::SafeAttributes belongs_to :exercise_question diff --git a/app/models/exercise_question.rb b/app/models/exercise_question.rb index 64ec53e4c..5189b0274 100644 --- a/app/models/exercise_question.rb +++ b/app/models/exercise_question.rb @@ -2,7 +2,7 @@ class ExerciseQuestion < ActiveRecord::Base include Redmine::SafeAttributes belongs_to :exercise - has_many :exercise_choiceses, :order => "#{ExerciseChoices.table_name}.choice_position",:dependent => :destroy + has_many :exercise_choices, :order => "#{ExerciseChoice.table_name}.choice_position",:dependent => :destroy has_many :exercise_answers, :dependent => :destroy has_many :exercise_standard_answers, :dependent => :destroy end diff --git a/app/models/exercise_standard_answer.rb b/app/models/exercise_standard_answer.rb index 2b67a83a2..ce3d08fbf 100644 --- a/app/models/exercise_standard_answer.rb +++ b/app/models/exercise_standard_answer.rb @@ -3,5 +3,5 @@ class ExerciseStandardAnswer < ActiveRecord::Base include Redmine::SafeAttributes belongs_to :exercise_question - belongs_to :exercise_choices + belongs_to :exercise_choice end diff --git a/app/models/user.rb b/app/models/user.rb index 9e470380d..d79ae575a 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -82,10 +82,10 @@ class User < Principal has_many :answers, :source => :poll, :through => :poll_users, :dependent => :destroy #用户已经完成问答的问卷 # end #在线测验相关关系 - has_many :exercise_users, :dependent => :destroy #答卷中间表 - has_many :exercise_answers, :dependent => :destroy #针对每个题目学生的答案 + has_many :exercise_user, :dependent => :destroy #答卷中间表 + has_many :exercise_answer, :dependent => :destroy #针对每个题目学生的答案 has_many :exercises, :dependent => :destroy #创建的试卷 - has_many :exercises_answers, :source => :exercises, :through => :exercise_users, :dependent => :destroy #用户已经完成问答的试卷 + has_many :exercises_answers, :source => :exercise, :through => :exercise_user, :dependent => :destroy #用户已经完成问答的试卷 #end #作业相关关系 has_many :homework_commons, :dependent => :destroy diff --git a/db/migrate/20151113025341_exercise.rb b/db/migrate/20151113025341_exercise.rb index 696f8d953..b29bfdb91 100644 --- a/db/migrate/20151113025341_exercise.rb +++ b/db/migrate/20151113025341_exercise.rb @@ -1,6 +1,6 @@ class Exercise < ActiveRecord::Migration def up - create_table :exercise do |t| + create_table :exercises do |t| t.string :exercise_name t.text :exercise_description t.integer :course_id diff --git a/db/migrate/20151113025459_exercise_question.rb b/db/migrate/20151113025459_exercise_question.rb index 5e83504c5..1dd0409f9 100644 --- a/db/migrate/20151113025459_exercise_question.rb +++ b/db/migrate/20151113025459_exercise_question.rb @@ -1,6 +1,6 @@ class ExerciseQuestion < ActiveRecord::Migration def up - create_table :exercise_question do |t| + create_table :exercise_questions do |t| t.string :question_title t.integer :question_type t.integer :question_number diff --git a/db/migrate/20151113025549_exercise_standard_answer.rb b/db/migrate/20151113025549_exercise_standard_answer.rb index 17e59eaf8..8ed1a25be 100644 --- a/db/migrate/20151113025549_exercise_standard_answer.rb +++ b/db/migrate/20151113025549_exercise_standard_answer.rb @@ -1,8 +1,8 @@ class ExerciseStandardAnswer < ActiveRecord::Migration def up - create_table :exercise_standard_answer do |t| + create_table :exercise_standard_answers do |t| t.integer :exercise_question_id - t.integer :exercise_choices_id + t.integer :exercise_choice_id t.text :answer_text t.timestamps end diff --git a/db/migrate/20151113025721_exercise_answer.rb b/db/migrate/20151113025721_exercise_answer.rb index 0a34c15ea..9cc9c5bc7 100644 --- a/db/migrate/20151113025721_exercise_answer.rb +++ b/db/migrate/20151113025721_exercise_answer.rb @@ -1,9 +1,9 @@ class ExerciseAnswer < ActiveRecord::Migration def up - create_table :exercise_answer do |t| + create_table :exercise_answers do |t| t.integer :user_id t.integer :exercise_question_id - t.integer :exercise_choices_id + t.integer :exercise_choice_id t.text :answer_text t.timestamps end diff --git a/db/migrate/20151113025751_user_exercise.rb b/db/migrate/20151113025751_user_exercise.rb index a49053146..d5e521401 100644 --- a/db/migrate/20151113025751_user_exercise.rb +++ b/db/migrate/20151113025751_user_exercise.rb @@ -1,6 +1,6 @@ class UserExercise < ActiveRecord::Migration def up - create_table :exercise_user do |t| + create_table :exercise_users do |t| t.integer :user_id t.integer :exercise_id t.integer :score diff --git a/db/schema.rb b/db/schema.rb index 419b30c3e..418382a64 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 => 20151112072948) do +ActiveRecord::Schema.define(:version => 20151113025751) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -572,6 +572,60 @@ ActiveRecord::Schema.define(:version => 20151112072948) do add_index "enumerations", ["id", "type"], :name => "index_enumerations_on_id_and_type" add_index "enumerations", ["project_id"], :name => "index_enumerations_on_project_id" + create_table "exercise_answers", :force => true do |t| + t.integer "user_id" + t.integer "exercise_question_id" + t.integer "exercise_choices_id" + t.text "answer_text" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "exercise_choices", :force => true do |t| + t.integer "exercise_question_id" + t.text "choice_text" + t.integer "choice_position" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "exercise_questions", :force => true do |t| + t.string "question_title" + t.integer "question_type" + t.integer "question_number" + t.integer "exercise_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "exercise_standard_answers", :force => true do |t| + t.integer "exercise_question_id" + t.integer "exercise_choices_id" + t.text "answer_text" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "exercise_users", :force => true do |t| + t.integer "user_id" + t.integer "exercise_id" + t.integer "score" + t.datetime "start_at" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "exercises", :force => true do |t| + t.string "exercise_name" + t.text "exercise_description" + t.integer "course_id" + t.integer "exercise_status" + t.integer "user_id" + t.integer "time" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + create_table "first_pages", :force => true do |t| t.string "web_title" t.string "title" From 70c5b27a437df83d823f1442fa5e945b7cd2ff56 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Fri, 13 Nov 2015 16:40:39 +0800 Subject: [PATCH 004/143] =?UTF-8?q?=E7=9B=B8=E5=85=B3=E8=B7=AF=E7=94=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/exercise_controller.rb | 39 +++++++++++++++++++++++++ app/helpers/exercise_helper.rb | 3 ++ app/models/course.rb | 1 + app/views/exercise/index.html.erb | 1 + app/views/exercise/new.html.erb | 0 app/views/exercise/show.html.erb | 1 + app/views/layouts/base_courses.html.erb | 5 ++++ config/routes.rb | 9 ++++++ 8 files changed, 59 insertions(+) create mode 100644 app/controllers/exercise_controller.rb create mode 100644 app/helpers/exercise_helper.rb create mode 100644 app/views/exercise/index.html.erb create mode 100644 app/views/exercise/new.html.erb create mode 100644 app/views/exercise/show.html.erb diff --git a/app/controllers/exercise_controller.rb b/app/controllers/exercise_controller.rb new file mode 100644 index 000000000..96a965f79 --- /dev/null +++ b/app/controllers/exercise_controller.rb @@ -0,0 +1,39 @@ +class ExerciseController < ApplicationController + layout "base_courses" + + before_filter :find_course, :only => [:index,:new,:create] + def index + + end + + def show + + end + + def new + + end + + def create + + end + + def edit + + end + + def update + + end + + def destroy + + end + + private + def find_course + @course = Course.find params[:course_id] + rescue Exception => e + render_404 + end +end \ No newline at end of file diff --git a/app/helpers/exercise_helper.rb b/app/helpers/exercise_helper.rb new file mode 100644 index 000000000..7fc7b1421 --- /dev/null +++ b/app/helpers/exercise_helper.rb @@ -0,0 +1,3 @@ +# encoding: utf-8 +module ExerciseHelper +end \ No newline at end of file diff --git a/app/models/course.rb b/app/models/course.rb index 7288c3b3b..913449d22 100644 --- a/app/models/course.rb +++ b/app/models/course.rb @@ -39,6 +39,7 @@ class Course < ActiveRecord::Base has_many :course_activities # 课程消息 has_many :course_messages, :class_name =>'CourseMessage', :as => :course_message, :dependent => :destroy + has_many :exercises, :dependent => :destroy acts_as_taggable acts_as_nested_set :order => 'name', :dependent => :destroy diff --git a/app/views/exercise/index.html.erb b/app/views/exercise/index.html.erb new file mode 100644 index 000000000..52cfcc97f --- /dev/null +++ b/app/views/exercise/index.html.erb @@ -0,0 +1 @@ +111111111111 \ No newline at end of file diff --git a/app/views/exercise/new.html.erb b/app/views/exercise/new.html.erb new file mode 100644 index 000000000..e69de29bb diff --git a/app/views/exercise/show.html.erb b/app/views/exercise/show.html.erb new file mode 100644 index 000000000..b23c1c517 --- /dev/null +++ b/app/views/exercise/show.html.erb @@ -0,0 +1 @@ +111111 \ No newline at end of file diff --git a/app/views/layouts/base_courses.html.erb b/app/views/layouts/base_courses.html.erb index 39de4faeb..ac8727e21 100644 --- a/app/views/layouts/base_courses.html.erb +++ b/app/views/layouts/base_courses.html.erb @@ -157,6 +157,11 @@ <%= link_to "(#{course_poll_count})", poll_index_path(:polls_type => "Course", :polls_group_id => @course.id), :class => "subnav_num c_orange" %> <%= link_to( "+#{l(:label_new_poll)}", new_poll_path(:polls_type => "Course",:polls_group_id => @course.id), :class => 'subnav_green c_white') if is_teacher %> +
diff --git a/config/routes.rb b/config/routes.rb index 6cf872180..9c557c9a5 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -96,6 +96,15 @@ RedmineApp::Application.routes.draw do end end + #show、index、new、create、edit、update、destroy路由自动生成 + resources :exercise do + member do #生成路径为 /exercise/:id/方法名 + end + + collection do #生成路径为 /exercise/方法名 + end + end + resources :homework_common, :except => [:show]do member do get 'start_anonymous_comment' From e6cd104ead1f32ae3d73cec883173328002bd205 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Fri, 13 Nov 2015 17:23:52 +0800 Subject: [PATCH 005/143] =?UTF-8?q?index=E7=95=8C=E9=9D=A2=E4=BB=A5?= =?UTF-8?q?=E5=8F=8A=E8=AF=95=E5=8D=B7=E7=BB=9F=E8=AE=A1=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E8=B7=AF=E7=94=B1=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/exercise_controller.rb | 18 +++++- app/models/exercise.rb | 1 + app/views/exercise/_exercise.html.erb | 61 +++++++++++++++++++++ app/views/exercise/_exercises_list.html.erb | 25 +++++++++ app/views/exercise/index.html.erb | 5 +- config/routes.rb | 2 + 6 files changed, 109 insertions(+), 3 deletions(-) create mode 100644 app/views/exercise/_exercise.html.erb create mode 100644 app/views/exercise/_exercises_list.html.erb diff --git a/app/controllers/exercise_controller.rb b/app/controllers/exercise_controller.rb index 96a965f79..bed3d9061 100644 --- a/app/controllers/exercise_controller.rb +++ b/app/controllers/exercise_controller.rb @@ -3,9 +3,18 @@ class ExerciseController < ApplicationController before_filter :find_course, :only => [:index,:new,:create] def index - + @is_teacher = User.current.allowed_to?(:as_teacher,@course) + if @is_teacher + exercises = @course.exercises + else + exercises = @course.exercises.where(:exercise_status => 1) + end + @exercises = paginateHelper exercises,20 #分页 + respond_to do |format| + format.html + end end - + def show end @@ -30,6 +39,11 @@ class ExerciseController < ApplicationController end + #统计结果 + def statistics_result + + end + private def find_course @course = Course.find params[:course_id] diff --git a/app/models/exercise.rb b/app/models/exercise.rb index cbf3a6e91..e4295971e 100644 --- a/app/models/exercise.rb +++ b/app/models/exercise.rb @@ -1,4 +1,5 @@ class Exercise < ActiveRecord::Base + #exercise_status: 1,新建;2,发布;3,关闭 include Redmine::SafeAttributes belongs_to :user has_many :exercise_questions, :dependent => :destroy,:order => "#{ExerciseQuestion.table_name}.question_number" diff --git a/app/views/exercise/_exercise.html.erb b/app/views/exercise/_exercise.html.erb new file mode 100644 index 000000000..e469c471c --- /dev/null +++ b/app/views/exercise/_exercise.html.erb @@ -0,0 +1,61 @@ +<%# has_commit = has_commit_poll?(poll.id ,User.current)%> +<% exercise_name = exercise.exercise_name.empty? ? l(:label_poll_new) : exercise.exercise_name%> +<% if @is_teacher%> +
  • +
    + <%# if has_commit %> + <%#= link_to poll_name, poll_result_poll_path(poll.id), :class => "polls_title polls_title_w fl c_dblue"%> + <%# else %> + <%#= link_to poll_name, exercise_path(poll.id), :class => "polls_title polls_title_w fl c_dblue" %> + <%# end %> + <%= link_to exercise_name, exercise_path(exercise.id), :class => "polls_title polls_title_w fl c_dblue" %> +
    +
  • + + <% if exercise.exercise_status == 1%> +
  • 统计结果
  • + <% else %> +
  • <%= link_to l(:label_statistical_results), statistics_result_exercise_path(exercise.id), :class => "pollsbtn fl ml10"%>
  • + <% end%> + + <% if exercise.exercise_status == 1 %> +
  • 发布试卷
  • + <% elsif exercise.exercise_status == 2%> +
  • 取消发布
  • + <% else%> +
  • 发布试卷
  • + <% end%> + + <%= link_to(l(:button_delete), exercise,:method => :delete, :confirm => l(:text_are_you_sure), :remote => true, :class => "polls_de fr ml5 mr10") %> + + <% if exercise.exercise_status == 1 %> +
  • <%= link_to l(:button_edit), edit_exercise_path(exercise.id), :class => "polls_de fr ml5"%>
  • + <% else%> +
  • 编辑
  • + <% end%> + + <% if exercise.exercise_status == 2 %> +
  • 关闭
  • + <% else %> +
  • 关闭
  • + <% end%> + + <% if exercise.exercise_status == 1%> +
  • 导出
  • + <% elsif exercise.exercise_status == 2 || exercise.exercise_status == 3 %> +
  • <%= link_to "导出", export_exercise_exercise_path(exercise.id,:format => "xls"), :class => "polls_de fr ml5"%>
  • + <% end%> + + +
  • <%= format_date exercise.created_at.to_date%>
  • +<% else%> + <% if exercise.exercise_status == 2%> + <%# if has_commit%> + + <%#else%> + <%= link_to exercise_name, exercise_path(exercise.id), :class => "polls_title polls_title_st fl c_dblue"%> + <%#end%> + <% end%> +
  • <%= format_date exercise.created_at.to_date%>
  • +<% end%> \ No newline at end of file diff --git a/app/views/exercise/_exercises_list.html.erb b/app/views/exercise/_exercises_list.html.erb new file mode 100644 index 000000000..16fa24b0e --- /dev/null +++ b/app/views/exercise/_exercises_list.html.erb @@ -0,0 +1,25 @@ +
    +

    所有试卷 + (<%= @obj_count%>) +

    + <% if @is_teacher%> + <%#= link_to "导入", other_poll_poll_index_path(:polls_group_id => @course.id), :remote=>true,:class => "newbtn"%> + <%= link_to "新建试卷 ", new_exercise_path(:course_id => @course.id), :class => "newbtn" %> + <% end%> +
    +
    +
    + + <% @exercises.each do |exercise|%> + +
    + <% end%> + + + +
    +
    \ No newline at end of file diff --git a/app/views/exercise/index.html.erb b/app/views/exercise/index.html.erb index 52cfcc97f..1a8d15181 100644 --- a/app/views/exercise/index.html.erb +++ b/app/views/exercise/index.html.erb @@ -1 +1,4 @@ -111111111111 \ No newline at end of file +<%= stylesheet_link_tag 'polls', :media => 'all' %> +
    + <%= render :partial => 'exercises_list'%> +
    \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 9c557c9a5..f1c41f65f 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -99,6 +99,8 @@ RedmineApp::Application.routes.draw do #show、index、new、create、edit、update、destroy路由自动生成 resources :exercise do member do #生成路径为 /exercise/:id/方法名 + get 'statistics_result' + get 'export_exercise' end collection do #生成路径为 /exercise/方法名 From ee8d9d7b4ecef7c35dc6efb9270642c66177fc5a Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 13 Nov 2015 17:47:29 +0800 Subject: [PATCH 006/143] =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/schema.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/db/schema.rb b/db/schema.rb index 418382a64..19bd05677 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -575,7 +575,7 @@ ActiveRecord::Schema.define(:version => 20151113025751) do create_table "exercise_answers", :force => true do |t| t.integer "user_id" t.integer "exercise_question_id" - t.integer "exercise_choices_id" + t.integer "exercise_choice_id" t.text "answer_text" t.datetime "created_at", :null => false t.datetime "updated_at", :null => false @@ -600,7 +600,7 @@ ActiveRecord::Schema.define(:version => 20151113025751) do create_table "exercise_standard_answers", :force => true do |t| t.integer "exercise_question_id" - t.integer "exercise_choices_id" + t.integer "exercise_choice_id" t.text "answer_text" t.datetime "created_at", :null => false t.datetime "updated_at", :null => false From b6d785bda00eab0e786a26278de19c8cc4fee739 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Fri, 13 Nov 2015 19:10:44 +0800 Subject: [PATCH 007/143] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E7=BB=84=E7=BB=87=E6=96=87=E7=AB=A0=E6=A0=B7=E5=BC=8F=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/views/org_document_comments/edit.html.erb | 14 +++++++++----- app/views/organizations/new.html.erb | 2 +- public/images/org_default.jpg | Bin 1897 -> 0 bytes public/images/org_default.png | Bin 0 -> 4471 bytes 4 files changed, 10 insertions(+), 6 deletions(-) delete mode 100644 public/images/org_default.jpg create mode 100644 public/images/org_default.png diff --git a/app/views/org_document_comments/edit.html.erb b/app/views/org_document_comments/edit.html.erb index ffb04a4f9..498ac46a6 100644 --- a/app/views/org_document_comments/edit.html.erb +++ b/app/views/org_document_comments/edit.html.erb @@ -12,18 +12,21 @@ } } -
    +
    编辑文章
    +
    +
    <%= form_tag url_for(:controller => 'org_document_comments',:action => 'update', :id => @org_document.id),:method => 'put', :id => 'new_org_document_form' do |f| %>
    - +
    -
    +
    +
    - <%= kindeditor_tag 'org_document_comment[content]',@org_document.content, :editor_id => 'org_document_description_editor', :height => "150px" %> + <%= kindeditor_tag 'org_document_comment[content]',@org_document.content, :editor_id => 'org1_document_description_editor', :height => "150px" %>
    @@ -40,4 +43,5 @@
    -<% end %> \ No newline at end of file +<% end %> +
    \ No newline at end of file diff --git a/app/views/organizations/new.html.erb b/app/views/organizations/new.html.erb index 08311d51b..1ab3ad933 100644 --- a/app/views/organizations/new.html.erb +++ b/app/views/organizations/new.html.erb @@ -31,7 +31,7 @@
  • - (打钩为公开,不打钩则不公开,若不公开,仅项目成员可见该项目。) + (打钩为公开,不打钩则不公开,若不公开,仅组织成员可见该组织。)
  • diff --git a/public/images/org_default.jpg b/public/images/org_default.jpg deleted file mode 100644 index ad1b4f007d0c6141a10715ce46f447630e3ce376..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1897 zcmbVMdr%W+5WmYoMM0Bb02^w&UPJ^Xm&=PJ8X+Wsq6GvLL9G~)10p6DFNY-9VzFw` zYN=8jTkErfD5%6LP{vk}D)_)^3yRP2i8ETo(V|wdq?ZUjW*q8M%0Kjz(B62CpszgzXO`tatS-8MJ zm{GgliedsG3QUZ$TlI!KoPx9P9Fs+b+&|EWz$T*#nITOOCRjCiuIZyf5>G8moMtG@ zGboHm)FgPKU1>L4%{Zlp?dJIwo6@dAJm5-t?N*}*>@lJ8REXNm3a2Mbg*60;!%~4b z!XU&jSSAx-5~)mvjfX`-OoR&QR~CUulv0^e6bbhWLbH*^Y-Nfzwx5gsQz89H6%-T* z3d90}%t0}QLgB^`i6Ur=2%Ez~>Fp5~8-D;ni`xvO$x4|B3+zVJXA$|73ZWx?k%HNp zknj@tt<^G{-FbPeZBz>WDvY;U+on0JIGTdnhGpR#=lNgU8M=S&T%1EzEs9FS6C*q-h~;j3o&(?5VHP^cH@NRES9> zLa|QxB5%1gMjIm$V;ZqGRv{EikbYm||EU>D2ZOqs>r9%I)9zz+gxVu%ey0ln!Z zpO=)dGiz&hfep<$&O7nXmnQFvZC+RLTk)0CrALpCd%%n!degg(6frLE?P)^~f7-lp z_JXTLWFt{iUz5vSzy{eYw)+$AP|n+z(vt7JCO-9!pZ$1sO=6u6+^Ei)P^NmAxT1nU z28F;m9qS+Lsi~OZKP+evZ)tRGzpsD9>Xo%svJ2K9>l-FDs~4BIZ~gB5r^+Wo#GMyK zBWGq79y(C_MY;4sP>a{n^U8@W2kT^3kAk$HrLBpj-8q&$hNK zKAAMPXj?*DdHb);;{vkpjxf~J&7ECRGWf{WlZnIchuiz)wQn9e+i|}k z&Z8#oLcfssGt%O^RN&ljyIgs1+ry3E-Y&=8!wwp+8Z;}=IIFXOM}J&)Q- zuNJ1QYnTED2B+Qx9**Xa86B+Z&2u)Yw*PSb)K^f~ja5Bet8)G>W`5n(x4d!UL+MV% OokfMWGD?bF=l=tIZIm|v diff --git a/public/images/org_default.png b/public/images/org_default.png new file mode 100644 index 0000000000000000000000000000000000000000..3f3cfc575550c44e2261bc7aa9affdd3f5bb6506 GIT binary patch literal 4471 zcmaJ_c|25Y`zIwkB_&j2645Yb%wjNvktkyuV~=45W0_%QWGP!n)Fe~Lo-JFElqEu0 zvP&T(WlKc1Bx}F%JoWtEKc4qJpL5Q=oa=k-*M07DqD`>+f_xHu92^{i24^v5>=wIo z@$6#XIa?|W+09{wo)yEK>ca3N&`2EGM5+@BVBke?C7F>3!~maGk_HC{mkSwZ#jr9u zujWkkQX=foDEWJNv(X$J8e0C|1ZNKt1K>n*B~#GA`RY0#fJ{UKE#XGWM&7z4H}cs) z8p%8mi*pY2a7GbFA(FA{?Q@b~hh(AE6Wz`yvavHLsIU?AWx5{3sF__tD4 zMkWAVDvbnyE2$_tD?=av1VRY{gCh_S5CEzSfr6FUCqfYdQ-dSaph&>)1IU&}Bf6-W zVb1)P#U7!7ZVZOE8W`;7=cnYSqC};+f*~jrYKI3Ds>r5Lqz6zK1b;;e{rDda7!uu? zM)qcqsT9BtM}ia8mw^VdHT~NJFK;8Ge;8Bfza7PP8Q7oT4TdNwgT1_V?D~tE&M+hW zzZ(BaO~(azlfY&qI@Oov%#Mf4@jqa;@BX)-9YVG?YQ{7&J17KC4At4!i$q}er=qR%hsVER;RvX*G903!iaNuN zgdQA)($iK&s-RR55TvrMs`ekO0fo*WP@GAB8jec!{F4DD zZd3-9?nd8AV#K_rt~%XBTDTr$~M>x-Oc>{ln(5RZAd#{4qYwi=$cynR2 z!7+H8iL{g6oU8cQ+i@47%S@>+K854hHWyP?=H+$t77`YAUg|#Fk(!i8T>R3LJy_=Y zPE5fO@IoY4kZd|WjA@7yUQR{P%^c37fB*4g`}#j;B*F?{)D>TTg2P*$@Eq?yMW;8Xy)`r@1rD8h*qFC-*XZ1dE8`b}=D z(hQ#%qF-EmQ#9mM{k=ra2Kmj`#JfqQiReNfyT}-Lv2BGAcK1@LV?{*;f1%d)&uob& zWmfz03rSaRNyjwr3I)l5eenV;~G09033XOg;u+mhT<#ku$IX;!Qj(}SER zTRyM~BP4O9K3FAKxYxj9ZC=XP15LI$5PcRO`}==vZ_F=SxsOGpBr0qfU9SXHA6Beq zMFcE=9!YfQYr{L1mt_|Xe!#Z2 z$zJ-k;sRge(iA1%%j$k$`P_rmsGLD(N|bnxIri+?ADG?T#AW_zcB`2R_kF(ZH&Jie zE7ceAes_0onU!p^qd67toMDQUIMtKL;Tmo`GJk;)&3YB;(c#XDnw8sHY6mAO**~LA z#x%KOJti8gI!8jh?!Bp3Hh<|X^y!ON!oBeDa5>}j+4=dsk~;ZUuU@@*L|wKy_~&R; zD~u+S*yrg(j>8>%Uefet_<%G_4n%TUYXw!=T~1f``}Q)DU$O6^d~T$cBsQnarBkA) zDw6+DGo>AMf_d%kaNVZiy(G%LvE858wCuwB{C)auV=1BG>gvcPF!=O9U*DbvzmGvv zk#6undwm;!+~<|Y7O9oZX)e02b4u*1&yY>sXF?x3)CD^_)~g4z&0zFo>4n8CC|9w| zY?sakyQtbBM4g_myWpcT*UdDq(vp>MAA>g(wI<|mefaQUd8)h4_bdMM97)S!Y{Ana zKU5!<#1a-3c3n#sn3!BO%479Kh=h*9s=mG}3Hi0PYFTmte(ruHsXgJuxr7Dutf(c* zP49?f3c~A+NU7H50@pyx{Fg6|6BlGl3WlW8q4@^UcMqn17sWP5ckkgp_`t4ee=eZF z_?fL)?ySa>@^Z>ZjWxRJ+8JJymzNi4SMO!b#i1q(1}RY>BN6O?n6@awKeVm5xd-^V zCNimI*Idr0yugPw34L}B4jEU!O)pf>*GkH1oQR4O)Ya1i=2aztinMx&3~*Z9X}I~A#4oOPp8qfmLa){6d_sq2lF zNPhQPGl;U|nKoIg+F~agJE4$Mo+es`8!z@AyVK2L3G2alrPmH`Qg(&A{ZwcR+4$jA z$a$0*itqrG^vv8y!H|}op_lh~LPxYD;$^sLmZ*oVi%Krd!Y^8RAo%jGwxeb|@<(Ln zyU+Bp7sV!9Sh|{TOz-2Pj&s(P`j6LY&gqVM0E=3?M72H;C13cD$=&*nKk+)XhjvG1-c6+&6Y+v1fy0VWj?Ca{9C!{O;1l8_&^6A~RUHc-z5HlC*(OHv= z0b`B4WiZRjeDT*0ftA$5t?vcinah=Wk`RAdQv+n%xbIkQXDw#z;kIDo&+NI8SO<|} z*<=0tncU>X0cWF4v|G0%GjGeW*U9Lcfh4Brf%~pJXn! z=ay4G6iVmYt+SWw=-9wK+pZ+8SV1IYfQQ=&o$n(STlg|W$+ldew?)UO1Drg4H6@d| z7AUu6RZS}!dDm8RTWnJF>FZ+J%1mEQ!zgdhZi(kjGTM*!Nf$=*f%dnobY*B!&+5Px zLq!#`i%mVR#ID9bR4nOpb91@7B3Kh)l5ZvR4es8y`J!ke@%(J*Aa1h@R7l{s82q=*$OkA;r)|u9}l>8fzG~iinlX)F-dgA zQKe#Q3=i~Sc=~pyV`RZ5oUx3rBi<1&#pu)Sm4QJs-cwy^pG5{tqj+*T^9Re%*WdW% zO|rQL@V9l7DGG#Lq%|xg_}|Uv(ETB@RNyAifqvCc0>BI6<)sBKm#iF#n8h2h8dJxJ z3A{S{PMmEt#d2kVzU!c?h=yS{wYR9Ahk&Vf1mEXJjV5XT;Crmr+17y8%W@2mi#g!Z zwvaBH*ir~Egy7=O%0;-bGTWP3SJk@PTD_yaZ^=m{&S$k%y}0gKc?YLCB zyY9Apn9Fjp6Zx?cn$q~@iJy*>3GHYwyYBKB?Oe@yVc=8g8WDd7gJi{& zHqn!vWaB(v%yy@#Pwh!C{^i`)6DM-+=GaVRVaws~=g+K9m&Eu4sG{Xi^1S64y#9iX zeX|}ey&a)Eo$?uiI;Y||!k=Q8Oo@C*4N>UmWc7&{_h#3w)KSa!Y3|f@Y6)N3jnx>1 z!&u9Eg)+n8dxa&=G4a;xZw{nq+|A;T?C>AwM(B&Kw`b*8VKto&3Y!vp2dv6>vESC( zKTPwawhtYD$9w7aSQwv*{bbToJaUkHHf%X~;Orw_Zq>3wmbLfm>-2zW(BTQKlj4U8 zv1MHXtcfqB$1G`LI=Skv%@kw}FGUXq4SqV+rTjT@3)9fEN7ir;tVg6ps-k>zh1t?F zzvl)v{NxqQW4IIQpPN~zM+L3(!m<4DTl-&)C1u%|#?xBTcuAQm?q$`g4IQek%n^uQ zy=uHvgWjFPMU`7WuVLUwweB8#U>8t6*lp=+WwaGD=NE)D?07t$yyhD3lli9N*P(op zYedO>k)hcmd3gbgs7}fo@gj$ym3Y`$)k(R!pJV)ApUQ_NA8?0KY47$ePNcwUE;K1P zI(=d)o=VjWtl|;UPiDt%lsmgpD77}~4h;=EA zr)hCC*I-?K{>GeE)#8AbQS#!TYX&o_f9TzknaHV6rfC-QqYY6X=vz+XwLu%ZISxlo z(z@QcCFgXUcs3%SDzf;y+k9@6&Ht^#T* z1d5h_76&wFyMWD=3#%N! z4#r6ih78_!549M}v7F>D-7Ltu?5p7;f*A;oR($6+Jd5ZX2HodNtJ7=lkV#=0v^-i{e7x{JHpR zEt6aND2lc_DjJxUmL?wFZ^vImvrn*o*4F$hjBBsVI z9J4m(@o@)b-i!Q&1v$+dYJP%qO)Ay$a_H%RoW1>xOxX+V4D;Kv(-T!kE5B2PCOvu! zHeWU=hlV{ocECrhbL0G_CD$4kc)y*)kCTU0S|(D(6<2~MRm-Nf?J9b|YsnXC3vGgX zE%8eRI_=l$Ox@SM*4^K1pTS9~)hg84Z093WF0I`TZ57>c;N<4m3L^Asm~@`n`4wWI Lhs6}@I9~ZbFKHr^ literal 0 HcmV?d00001 From a50ec626cd3e1c19645fac923a59cfa258e26d27 Mon Sep 17 00:00:00 2001 From: cxt Date: Mon, 16 Nov 2015 08:52:32 +0800 Subject: [PATCH 008/143] =?UTF-8?q?=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/schema.rb | 100 +++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 74 insertions(+), 26 deletions(-) diff --git a/db/schema.rb b/db/schema.rb index 1f48eaf02..272db1944 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 => 20151110011003) do +ActiveRecord::Schema.define(:version => 20151113025751) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -528,23 +528,26 @@ ActiveRecord::Schema.define(:version => 20151110011003) do add_index "documents", ["created_on"], :name => "index_documents_on_created_on" add_index "documents", ["project_id"], :name => "documents_project_id" - create_table "dts", :force => true do |t| - t.string "IPLineCode" - t.string "Description" - t.string "Num" - t.string "Variable" - t.string "TraceInfo" - t.string "Method" + 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 "IPLine" - t.string "Review" - t.string "Category" - t.string "Defect" - t.string "PreConditions" - t.string "StartLine" + 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 + t.string "Description" + t.text "PreConditions", :limit => 2147483647 + t.text "TraceInfo", :limit => 2147483647 + t.text "Code", :limit => 2147483647 t.integer "project_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at" + t.datetime "updated_at" + t.integer "id", :null => false end create_table "enabled_modules", :force => true do |t| @@ -569,6 +572,60 @@ ActiveRecord::Schema.define(:version => 20151110011003) do add_index "enumerations", ["id", "type"], :name => "index_enumerations_on_id_and_type" add_index "enumerations", ["project_id"], :name => "index_enumerations_on_project_id" + create_table "exercise_answers", :force => true do |t| + t.integer "user_id" + t.integer "exercise_question_id" + t.integer "exercise_choice_id" + t.text "answer_text" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "exercise_choices", :force => true do |t| + t.integer "exercise_question_id" + t.text "choice_text" + t.integer "choice_position" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "exercise_questions", :force => true do |t| + t.string "question_title" + t.integer "question_type" + t.integer "question_number" + t.integer "exercise_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "exercise_standard_answers", :force => true do |t| + t.integer "exercise_question_id" + t.integer "exercise_choice_id" + t.text "answer_text" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "exercise_users", :force => true do |t| + t.integer "user_id" + t.integer "exercise_id" + t.integer "score" + t.datetime "start_at" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "exercises", :force => true do |t| + t.string "exercise_name" + t.text "exercise_description" + t.integer "course_id" + t.integer "exercise_status" + t.integer "user_id" + t.integer "time" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + create_table "first_pages", :force => true do |t| t.string "web_title" t.string "title" @@ -814,16 +871,6 @@ ActiveRecord::Schema.define(:version => 20151110011003) do add_index "journal_details", ["journal_id"], :name => "journal_details_journal_id" - create_table "journal_details_copy", :force => true do |t| - t.integer "journal_id", :default => 0, :null => false - t.string "property", :limit => 30, :default => "", :null => false - t.string "prop_key", :limit => 30, :default => "", :null => false - t.text "old_value" - t.text "value" - end - - add_index "journal_details_copy", ["journal_id"], :name => "journal_details_journal_id" - create_table "journal_replies", :id => false, :force => true do |t| t.integer "journal_id" t.integer "user_id" @@ -960,6 +1007,7 @@ ActiveRecord::Schema.define(:version => 20151110011003) do t.datetime "created_on" t.integer "comments_count", :default => 0, :null => false t.integer "course_id" + t.integer "sticky", :default => 0 end add_index "news", ["author_id"], :name => "index_news_on_author_id" From e22b4cbdebaa54aca9e4ab9d276261b0425c8f0c Mon Sep 17 00:00:00 2001 From: cxt Date: Mon, 16 Nov 2015 10:44:27 +0800 Subject: [PATCH 009/143] =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E6=8F=90=E4=BA=A4?= =?UTF-8?q?=E6=88=AA=E6=AD=A2=E5=90=8E=EF=BC=8C=E6=9C=AA=E6=8F=90=E4=BA=A4?= =?UTF-8?q?=E4=BD=9C=E5=93=81=E7=9A=84=E5=AD=A6=E7=94=9F=E7=9C=8B=E5=88=B0?= =?UTF-8?q?=E7=9A=84=E4=BD=9C=E4=B8=9A=E5=8A=A8=E6=80=81=E5=B0=86=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E2=80=9C=E8=A1=A5=E4=BA=A4=E4=BD=9C=E5=93=81=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/application_helper.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index e08259b11..f4e0f88ff 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -2374,8 +2374,10 @@ module ApplicationHelper link_to "作品(#{homework.student_works.count})",student_work_index_path(:homework => homework.id),:class => "c_blue" else #学生显示提交作品、修改作品等按钮 work = cur_user_works_for_homework homework - if work.nil? + if work.nil? && Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d") link_to "提交作品(#{homework.student_works.count})", new_student_work_path(:homework => homework.id),:class => 'c_blue' + elsif work.nil? && Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") < Time.now.strftime("%Y-%m-%d") + link_to "补交作品(#{homework.student_works.count})", new_student_work_path(:homework => homework.id),:class => 'c_red' else if homework.homework_detail_manual && homework.homework_detail_manual.comment_status == 2 #匿评作业,且作业状态不是在开启匿评之前 link_to "作品匿评", student_work_index_path(:homework => homework.id), :class => 'c_blue', :title => "开启匿评后不可修改作品" From c50bcf93314617ef7163cd1b9e53cb34f9674033 Mon Sep 17 00:00:00 2001 From: cxt Date: Mon, 16 Nov 2015 10:56:00 +0800 Subject: [PATCH 010/143] =?UTF-8?q?=E5=AF=B9=E4=BA=8E=E6=8F=90=E4=BA=A4?= =?UTF-8?q?=E5=B7=B2=E6=88=AA=E6=AD=A2=E7=9A=84=E4=BD=9C=E4=B8=9A=EF=BC=8C?= =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E7=8A=B6=E6=80=81=E7=94=B1=E2=80=9C=E4=BD=9C?= =?UTF-8?q?=E5=93=81=E6=8F=90=E4=BA=A4=E4=B8=AD=E2=80=9D=E6=94=B9=E4=B8=BA?= =?UTF-8?q?=E2=80=9C=E4=BD=9C=E5=93=81=E8=A1=A5=E4=BA=A4=E4=B8=AD=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_course_homework.html.erb | 6 +++++- app/views/users/_user_homework_detail.html.erb | 6 +++++- public/stylesheets/courses.css | 1 + public/stylesheets/new_user.css | 1 + 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/app/views/users/_course_homework.html.erb b/app/views/users/_course_homework.html.erb index 38a4d6edd..d02cea104 100644 --- a/app/views/users/_course_homework.html.erb +++ b/app/views/users/_course_homework.html.erb @@ -23,7 +23,11 @@ <% else %> 匿评已禁用 <% end %> - 作品提交中 + <% if Time.parse(activity.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d")%> + 作品提交中 + <% elsif Time.parse(activity.end_time.to_s).strftime("%Y-%m-%d") < Time.now.strftime("%Y-%m-%d") %> + 作品补交中 + <% end %> <% elsif activity.homework_detail_manual.comment_status == 2%> <% if activity.anonymous_comment == 0%> 匿评中 diff --git a/app/views/users/_user_homework_detail.html.erb b/app/views/users/_user_homework_detail.html.erb index 0c2a28e5c..539b8b603 100644 --- a/app/views/users/_user_homework_detail.html.erb +++ b/app/views/users/_user_homework_detail.html.erb @@ -23,7 +23,11 @@ <% else %> 匿评已禁用 <% end %> - 作品提交中 + <% if Time.parse(homework_common.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d")%> + 作品提交中 + <% elsif Time.parse(homework_common.end_time.to_s).strftime("%Y-%m-%d") < Time.now.strftime("%Y-%m-%d") %> + 作品补交中 + <% end %> <% elsif homework_common.homework_detail_manual.comment_status == 2%> <% if homework_common.anonymous_comment == 0%> 匿评中 diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css index 05bba54f6..5469078a5 100644 --- a/public/stylesheets/courses.css +++ b/public/stylesheets/courses.css @@ -182,6 +182,7 @@ a.f_grey:hover {color:#000000;} /*.upbtn{ margin:42px 0 0 10px; border:none; color:#999; width:150px;}*/ .red_btn_cir{ background:#e74c3c; padding:1px 10px; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; color:#fff; font-weight:normal;font-size:12px;} .green_btn_cir{ background:#28be6c; padding:1px 10px; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; color:#fff; font-weight:normal;font-size:12px;} +.red_homework_btn_cir{ background:#e74c3c; padding:1px 3px; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; color:#fff; font-weight:normal;font-size:12px;} .green_homework_btn_cir{ background:#28be6c; padding:1px 3px; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; color:#fff; font-weight:normal;font-size:12px;} .grey_btn_cir{ background:#b2b2b2; padding:1px 10px; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; color:#fff; font-weight:normal; font-size:12px;} .grey_homework_btn_cir{ background:#b2b2b2; padding:1px 3px; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; color:#fff; font-weight:normal; font-size:12px;} diff --git a/public/stylesheets/new_user.css b/public/stylesheets/new_user.css index 368964f3b..6ccfc47f6 100644 --- a/public/stylesheets/new_user.css +++ b/public/stylesheets/new_user.css @@ -299,6 +299,7 @@ a:hover.bgreen_n_btn{background:#08a384;} .green_btn_cir{ background:#28be6c; padding:1px 10px; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; color:#fff; font-weight:normal;font-size:12px;} .green_homework_btn_cir{ background:#28be6c; padding:1px 3px; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; color:#fff; font-weight:normal;font-size:12px;} .grey_btn_cir{ background:#b2b2b2; padding:1px 10px; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; color:#fff; font-weight:normal; font-size:12px;} +.red_homework_btn_cir{ background:#e74c3c; padding:1px 3px; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; color:#fff; font-weight:normal;font-size:12px;} .grey_homework_btn_cir{ background:#b2b2b2; padding:1px 3px; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; color:#fff; font-weight:normal; font-size:12px;} .blue_btn_cir{ background:#3498db; padding:1px 10px; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; color:#fff; font-weight:normal;font-size:12px;} .orange_btn_cir{ background:#e67e22; padding:1px 10px; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; color:#fff; font-weight:normal; font-size:12px;} From de32745eefcfdfd9979a0fef1d5618867876075f Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Mon, 16 Nov 2015 15:02:57 +0800 Subject: [PATCH 011/143] =?UTF-8?q?1.=E5=B0=86=E9=A1=B9=E7=9B=AE=E5=8A=A8?= =?UTF-8?q?=E6=80=81=E6=95=B0=E6=8D=AE=E8=BF=81=E7=A7=BB=E8=87=B3=E7=BB=84?= =?UTF-8?q?=E7=BB=87=E5=8A=A8=E6=80=81=EF=BC=9B=202.=E5=9C=A8=E7=BB=84?= =?UTF-8?q?=E7=BB=87=E5=8A=A8=E6=80=81=E4=B8=AD=EF=BC=8C=E6=8C=89=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E5=80=92=E6=8E=92=E6=98=BE=E7=A4=BA=E7=BB=84=E7=BB=87?= =?UTF-8?q?=E5=8A=A8=E6=80=81=EF=BC=9B=203.=E5=A2=9E=E5=8A=A0=E6=88=91?= =?UTF-8?q?=E7=9A=84=E7=BB=84=E7=BB=87=E4=B8=AD=E6=90=9C=E7=B4=A2=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/organizations_controller.rb | 20 +++---- app/controllers/users_controller.rb | 14 +++++ app/models/forge_activity.rb | 12 +++- .../organizations/_org_activities.html.erb | 56 +++++++++++++++++++ app/views/organizations/show.html.erb | 46 ++------------- app/views/organizations/show.js.erb | 7 +-- app/views/users/_show_user_org.html.erb | 39 +++++++++++++ app/views/users/search_user_orgs.html.erb | 1 + app/views/users/search_user_orgs.js.erb | 2 + app/views/users/user_organizations.html.erb | 46 ++++++++------- config/routes.rb | 1 + ...copy_forge_activities_to_org_activities.rb | 16 ++++++ 12 files changed, 184 insertions(+), 76 deletions(-) create mode 100644 app/views/organizations/_org_activities.html.erb create mode 100644 app/views/users/_show_user_org.html.erb create mode 100644 app/views/users/search_user_orgs.html.erb create mode 100644 app/views/users/search_user_orgs.js.erb create mode 100644 db/migrate/20151116020842_copy_forge_activities_to_org_activities.rb diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb index b75742164..6a1030adc 100644 --- a/app/controllers/organizations_controller.rb +++ b/app/controllers/organizations_controller.rb @@ -55,22 +55,22 @@ class OrganizationsController < ApplicationController def show if @organization.is_public? || User.current.admin? || User.current.member_of_org?(@organization) @organization = Organization.find(params[:id]) - @org_activities = OrgActivity.where('container_id =? and container_type =? ', - @organization.id, 'Organization ').order('updated_at desc').page(params[:page]).per(10) - @org_activities_count = OrgActivity.where('container_id =? and container_type =? ', - @organization.id, 'Organization ').order('updated_at desc').count project_ids = @organization.projects.map(&:id) << 0 - @org_project_activties = ForgeActivity.where("project_id in (#{project_ids.join(',')}) and forge_act_type in('Issue','Message','ProjectCreateInfo')").order("updated_at desc").page(params[:page] || 1).per(10) - @org_project_activties_count = ForgeActivity.where('project_id in (?)',project_ids.join(',')).count + @org_activities = OrgActivity.where("(container_id =? and container_type =?) or (container_type ='Project' and container_id in (#{project_ids.join(',')}))", + @organization.id, 'Organization').order('updated_at desc').page(params[:page] || 1).per(10) + @org_activities_count = OrgActivity.where("(container_id =? and container_type =?) or (container_type ='Project' and container_id in (#{project_ids.join(',')}))" , + @organization.id, 'Organization ').count + # @org_project_activties = ForgeActivity.where("project_id in (#{project_ids.join(',')}) and forge_act_type in('Issue','Message','ProjectCreateInfo')").order("updated_at desc").page(params[:page] || 1).per(10) + # @org_project_activties_count = ForgeActivity.where('project_id in (?)',project_ids.join(',')).count #@org_activities = paginateHelper @org_activities, 10 @page = params[:page] + respond_to do |format| + format.html + format.js + end else render_403 end - respond_to do |format| - format.html - format.js - end end def update diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 273d48ccf..776e6b7d5 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1918,6 +1918,20 @@ class UsersController < ApplicationController end end + def search_user_orgs + name="" + if !params[:search_orgs].nil? + name = params[:search_orgs].strip + end + name = "%"+name+"%" + @orgs = User.current.organizations.where("name like ?", name) + @user = User.current + respond_to do |format| + format.html {render :layout => 'static_base'} + format.js + end + end + private def find_user diff --git a/app/models/forge_activity.rb b/app/models/forge_activity.rb index c4f13c6d0..8a94f1019 100644 --- a/app/models/forge_activity.rb +++ b/app/models/forge_activity.rb @@ -20,7 +20,7 @@ class ForgeActivity < ActiveRecord::Base validates :forge_act_id,presence: true validates :forge_act_type, presence: true has_many :user_acts, :class_name => 'UserAcivity',:as =>:act - after_save :add_user_activity + after_save :add_user_activity, :add_org_activity before_destroy :destroy_user_activity #在个人动态里面增加当前动态 @@ -45,6 +45,16 @@ class ForgeActivity < ActiveRecord::Base end end + def add_org_activity + OrgActivity.create(:user_id => self.user_id, + :org_act_id => self.forge_act_id, + :org_act_type => self.forge_act_type, + :container_id => self.project_id, + :container_type => 'Project', + :created_at => self.created_at, + :updated_at => self.updated_at) + end + def destroy_user_activity user_activity = UserActivity.where("act_type = '#{self.forge_act_type.to_s}' and act_id = '#{self.forge_act_id}'") user_activity.destroy_all diff --git a/app/views/organizations/_org_activities.html.erb b/app/views/organizations/_org_activities.html.erb new file mode 100644 index 000000000..cb69738b6 --- /dev/null +++ b/app/views/organizations/_org_activities.html.erb @@ -0,0 +1,56 @@ +<% unless org_activities.nil? %> + <% org_activities.each do |act| %> + <% if act.container_type == 'Organization' %> + <% if act.org_act_type == 'CreateOrganization' %> +
    +
    + +
    +
    <%= link_to User.find(act.user_id), user_path(act.user_id) %>  创建了 <%= Organization.find(act.org_act_id).name %> + | 组织
    +
    创建时间:<%= format_activity_day(act.created_at) %> <%= format_time(act.created_at, false) %>
    +
    +
    +
    +
    + <% end %> + <% if act.org_act_type == 'OrgDocumentComment' && act.org_act_id != @organization.home_id %> + + <%= render :partial => 'show_org_document', :locals => {:document => act.org_act} %> + <% end %> + <% end %> + <% if act.container_type == 'Project' %> + <% case act.org_act_type.to_s %> + <% when 'Issue' %> + <%= render :partial => 'organizations/org_project_issue', :locals => {:activity => Issue.find(act.org_act_id),:user_activity_id =>act.id} %> + <% when 'Message' %> + <%= render :partial => 'organizations/project_message', :locals => {:activity => Message.find(act.org_act_id),:user_activity_id =>act.id} %> + <%# when 'ProjectCreateInfo'%> + <%#= render :partial => 'organizations/project_create', :locals => {:activity => act,:user_activity_id =>act.id} %> + <% end %> + <% end %> + <% end %> + + <%#= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%> + +<% end %> + +<% if org_act_count == 10 %> +
    展开更多<%=link_to "", organization_path(org,:page => page.to_i + 1),:id => "more_org_activities_link",:remote => "true",:class => "none" %>
    + <%#= link_to "点击展开更多",user_activities_path(@user.id,:type => type,:page => page),:id => "show_more_activities",:remote => "true",:class => "loadMore mt10 f_grey"%> +<% end%> + + \ No newline at end of file diff --git a/app/views/organizations/show.html.erb b/app/views/organizations/show.html.erb index 0b624d479..a85ffa687 100644 --- a/app/views/organizations/show.html.erb +++ b/app/views/organizations/show.html.erb @@ -30,49 +30,15 @@ init_activity_KindEditor_data(<%= @organization.home_id%>, null, "87%"); }); - <%= render :partial => 'show_org_document', :locals => {:document => OrgDocumentComment.find(@organization.home_id), :home_id => @organization.home_id} %> <% end %> - <% unless @org_activities.nil? %> - <% @org_activities.each do |act| %> - <% if act.org_act_type == 'CreateOrganization' %> -
    -
    - -
    -
    <%= link_to User.find(act.user_id), user_path(act.user_id) %>  创建了 <%= Organization.find(act.org_act_id).name %> - | 组织
    -
    创建时间:<%= format_activity_day(act.created_at) %> <%= format_time(act.created_at, false) %>
    -
    -
    -
    -
    - <% end %> - <% if act.org_act_type == 'OrgDocumentComment' && act.org_act_id != @organization.home_id %> - - <%= render :partial => 'show_org_document', :locals => {:document => act.org_act} %> - <% end %> - <% end %> - - <%#= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%> - - <% end %> - - <%# @org_project_activties.each do |org_act|%> - <%= render :partial => 'organizations/org_project_activities', - :locals => {:org_project_activties =>@org_project_activties, - :page=>@page, - :org => @organization, - :org_act_count=>@org_activities.count, - :pro_act_count=>@org_project_activties.count}%> - <%# end %> +<%= render :partial => 'organizations/org_activities', + :locals => {:org_activities =>@org_activities, + :page=>@page, + :org => @organization, + :org_act_count=>@org_activities.count}%> + diff --git a/app/views/organizations/show.js.erb b/app/views/organizations/show.js.erb index b0a447910..ee405d73c 100644 --- a/app/views/organizations/show.js.erb +++ b/app/views/organizations/show.js.erb @@ -1,7 +1,6 @@ -$("#show_more_activities").replaceWith("<%= escape_javascript( render :partial => 'organizations/org_project_activities', - :locals => {:org_project_activties =>@org_project_activties, +$("#show_more_activities").replaceWith("<%= escape_javascript( render :partial => 'organizations/org_activities', + :locals => {:org_activities =>@org_activities, :page=>@page, :org => @organization, - :org_act_count=>@org_activities.count, - :pro_act_count=>@org_project_activties.count} )%>"); + :org_act_count=>@org_activities.count} )%>"); diff --git a/app/views/users/_show_user_org.html.erb b/app/views/users/_show_user_org.html.erb new file mode 100644 index 000000000..e753092fa --- /dev/null +++ b/app/views/users/_show_user_org.html.erb @@ -0,0 +1,39 @@ +<%= stylesheet_link_tag 'pleft','header','new_user','repository','org', 'project' %> +<%#= stylesheet_link_tag 'pleft','prettify','jquery/jquery-ui-1.9.2','header','new_user','repository','org' %> +
    +
    +
    +
    + 组织列表 + + <%= form_tag url_for(:controller => 'users', :action => 'search_user_orgs', :id => User.current.id), :method => 'get', :id => "search_org_form", :class=>"resourcesSearchloadBox", :style=>"float:right; margin-top:-5px;" do %> + + + + 搜索 + <% end %> +
    +
    +
    + <% orgs.each do |org| %> +
    +
    + <%= link_to image_tag(url_to_avatar(org), :width => '78', :height => '78', :alt => '组织logo'), organization_path(org), :class => "linkGrey2" %> +
    +
    +
    + <%= link_to org.name, organization_path(org), :class => 'f16 linkBlue' %> +
    +
    <%= org.description %>
    +
    创建者:<%= link_to User.find(org.creator_id), user_path(org.creator_id), :class => 'linkGrey2', :target => '_blank' %>
    + +
    您的身份:<%= User.current.admin_of_org?(org) ? "组织管理员" : "组织成员" %>
    +
    + +
    +
    + <% end %> +
    +
    +
    +
    \ No newline at end of file diff --git a/app/views/users/search_user_orgs.html.erb b/app/views/users/search_user_orgs.html.erb new file mode 100644 index 000000000..1a921d38e --- /dev/null +++ b/app/views/users/search_user_orgs.html.erb @@ -0,0 +1 @@ +<%= render :partial => 'show_user_org', :locals => {:orgs => @orgs} %> \ No newline at end of file diff --git a/app/views/users/search_user_orgs.js.erb b/app/views/users/search_user_orgs.js.erb new file mode 100644 index 000000000..7184a29c5 --- /dev/null +++ b/app/views/users/search_user_orgs.js.erb @@ -0,0 +1,2 @@ + +//$("#org_list").replaceWith("<%#= escape_javascript(render :partial => 'show_user_org', :locals => {:orgs => @orgs}) %>") \ No newline at end of file diff --git a/app/views/users/user_organizations.html.erb b/app/views/users/user_organizations.html.erb index 50fa03bbe..e2a24b2aa 100644 --- a/app/views/users/user_organizations.html.erb +++ b/app/views/users/user_organizations.html.erb @@ -1,4 +1,4 @@ -<%= stylesheet_link_tag 'pleft','header','new_user','repository','org' %> +<%= stylesheet_link_tag 'pleft','header','new_user','repository','org', 'project' %> <%#= stylesheet_link_tag 'pleft','prettify','jquery/jquery-ui-1.9.2','header','new_user','repository','org' %>
    @@ -6,30 +6,34 @@
    组织列表 - - - - + <%= form_tag url_for(:controller => 'users', :action => 'search_user_orgs', :id => User.current.id), :method => 'get', :id => "search_org_form", :class=>"resourcesSearchloadBox", :style=>"float:right; margin-top:-5px;" do %> + + + + 搜索 + <% end %>
    - <% @orgs.each do |org| %> -
    -
    - <%= link_to image_tag(url_to_avatar(org), :width => '78', :height => '78', :alt => '组织logo'), organization_path(org), :class => "linkGrey2" %> -
    -
    -
    - <%= link_to org.name, organization_path(org), :class => 'f16 linkBlue' %> +
    + <% @orgs.each do |org| %> +
    +
    + <%= link_to image_tag(url_to_avatar(org), :width => '78', :height => '78', :alt => '组织logo'), organization_path(org), :class => "linkGrey2" %>
    -
    <%= org.description %>
    -
    创建者:<%= link_to User.find(org.creator_id), user_path(org.creator_id), :class => 'linkGrey2', :target => '_blank' %>
    - -
    您的身份:<%= User.current.admin_of_org?(org) ? "组织管理员" : "组织成员" %>
    +
    +
    + <%= link_to org.name, organization_path(org), :class => 'f16 linkBlue' %> +
    +
    <%= org.description %>
    +
    创建者:<%= link_to User.find(org.creator_id), user_path(org.creator_id), :class => 'linkGrey2', :target => '_blank' %>
    + +
    您的身份:<%= User.current.admin_of_org?(org) ? "组织管理员" : "组织成员" %>
    +
    + +
    - -
    -
    - <% end %> + <% end %> +
    \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 0f05c3521..69134e666 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -444,6 +444,7 @@ RedmineApp::Application.routes.draw do get 'dealwith_apply_request' get 'store_selected_resource' get 'user_organizations' + get 'search_user_orgs' # end end #resources :blogs diff --git a/db/migrate/20151116020842_copy_forge_activities_to_org_activities.rb b/db/migrate/20151116020842_copy_forge_activities_to_org_activities.rb new file mode 100644 index 000000000..95c4ed5bf --- /dev/null +++ b/db/migrate/20151116020842_copy_forge_activities_to_org_activities.rb @@ -0,0 +1,16 @@ +class CopyForgeActivitiesToOrgActivities < ActiveRecord::Migration + def up + ForgeActivity.all.each do |forge_act| + OrgActivity.create(:user_id => forge_act.user_id, + :org_act_id => forge_act.forge_act_id, + :org_act_type => forge_act.forge_act_type, + :container_id => forge_act.project_id, + :container_type => 'Project', + :created_at => forge_act.created_at, + :updated_at => forge_act.updated_at) + end + end + + def down + end +end From 10dedcb7be406c5864d29457e5a10499477516d8 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Mon, 16 Nov 2015 15:39:59 +0800 Subject: [PATCH 012/143] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=BB=84=E7=BB=87?= =?UTF-8?q?=E6=88=90=E5=91=98=E5=8A=A0=E5=85=A5=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/org_member_controller.rb | 2 +- app/views/organizations/_org_members.html.erb | 5 ++++- .../20151116070906_add_created_at_to_org_members.rb | 5 +++++ .../20151116071721_set_time_for_org_member.rb | 13 +++++++++++++ 4 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 db/migrate/20151116070906_add_created_at_to_org_members.rb create mode 100644 db/migrate/20151116071721_set_time_for_org_member.rb diff --git a/app/controllers/org_member_controller.rb b/app/controllers/org_member_controller.rb index 4b842f9dc..642a100c3 100644 --- a/app/controllers/org_member_controller.rb +++ b/app/controllers/org_member_controller.rb @@ -16,7 +16,7 @@ class OrgMemberController < ApplicationController member_ids = params[:membership][:user_ids] role_id = params[:orgRole] member_ids.each do |user_id| - member = OrgMember.create(:user_id=>user_id) + member = OrgMember.create(:user_id=>user_id, :created_at => Time.now) @org.org_members << member OrgMemberRole.create(:org_member_id => member.id, :role_id => role_id) end diff --git a/app/views/organizations/_org_members.html.erb b/app/views/organizations/_org_members.html.erb index 3940a6576..ee15e19d7 100644 --- a/app/views/organizations/_org_members.html.erb +++ b/app/views/organizations/_org_members.html.erb @@ -5,7 +5,7 @@
    - + 加入时间
    <% members.each do |member| %> @@ -16,6 +16,9 @@ <%= l(:label_username)%> <%= link_to(member.user.show_name, user_path(member.user),:class => "ml5 c_blue02") %>
    身份:<%= member.user.admin_of_org?(organization)?"组织管理员":"组织成员" %> + <% if member.created_at %> + <%= format_time(member.created_at) %> + <% end %>
    <% end%> diff --git a/db/migrate/20151116070906_add_created_at_to_org_members.rb b/db/migrate/20151116070906_add_created_at_to_org_members.rb new file mode 100644 index 000000000..33d3a2817 --- /dev/null +++ b/db/migrate/20151116070906_add_created_at_to_org_members.rb @@ -0,0 +1,5 @@ +class AddCreatedAtToOrgMembers < ActiveRecord::Migration + def change + add_column :org_members, :created_at, :timestamp + end +end diff --git a/db/migrate/20151116071721_set_time_for_org_member.rb b/db/migrate/20151116071721_set_time_for_org_member.rb new file mode 100644 index 000000000..f9e78dff5 --- /dev/null +++ b/db/migrate/20151116071721_set_time_for_org_member.rb @@ -0,0 +1,13 @@ +class SetTimeForOrgMember < ActiveRecord::Migration + def up + OrgMember.all.each do |member| + if(member.created_at.nil?) + member.created_at = Time.now - 5.days + member.save + end + end + end + + def down + end +end From bd6a1a9d4931c6e14fa5b2fee516ac00c62a968c Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Mon, 16 Nov 2015 17:21:26 +0800 Subject: [PATCH 013/143] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=BB=84=E7=BB=87?= =?UTF-8?q?=E5=8A=A8=E6=80=81=E4=B8=AD=E7=9A=84=E9=A1=B9=E7=9B=AE=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E7=9A=84=E5=9B=9E=E5=A4=8D=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/issues_controller.rb | 21 +++++++++++++++++-- .../org_document_comments_controller.rb | 1 + app/views/issues/add_journal_in_org.js.erb | 3 +++ .../org_document_comments/add_reply.js.erb | 4 ++-- .../organizations/_org_activities.html.erb | 12 +++++------ .../organizations/_org_project_issue.html.erb | 18 +++++++++++++++- .../organizations/_show_org_document.html.erb | 14 ++++++------- app/views/organizations/show.html.erb | 3 ++- config/routes.rb | 1 + 9 files changed, 58 insertions(+), 19 deletions(-) create mode 100644 app/views/issues/add_journal_in_org.js.erb diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index e529dd3b9..edf055370 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -20,11 +20,11 @@ class IssuesController < ApplicationController default_search_scope :issues before_filter :authorize1, :only => [:show] - before_filter :find_issue, :only => [:show, :edit, :update,:add_journal] + before_filter :find_issue, :only => [:show, :edit, :update,:add_journal, :add_journal_in_org] before_filter :find_issues, :only => [:bulk_edit, :bulk_update, :destroy] before_filter :find_project, :only => [:new, :create, :update_form] #before_filter :authorize, :except => [:index, :show] - before_filter :authorize, :except => [:index,:add_journal] + before_filter :authorize, :except => [:index,:add_journal, :add_journal_in_org] before_filter :find_optional_project, :only => [:index] before_filter :check_for_default_issue_status, :only => [:new, :create] @@ -397,6 +397,23 @@ class IssuesController < ApplicationController end end + def add_journal_in_org + if User.current.logged? + jour = Journal.new + jour.user_id = User.current.id + jour.notes = params[:notes] + jour.journalized = @issue + jour.save + org_activity = OrgActivity.where("org_act_type='Issue' and org_act_id =#{@issue.id}").first + org_activity.updated_at = jour.created_on + org_activity.save + @user_activity_id = params[:user_activity_id] + respond_to do |format| + format.js + end + end + end + private def find_project diff --git a/app/controllers/org_document_comments_controller.rb b/app/controllers/org_document_comments_controller.rb index 60522dc3f..13a188e72 100644 --- a/app/controllers/org_document_comments_controller.rb +++ b/app/controllers/org_document_comments_controller.rb @@ -41,6 +41,7 @@ class OrgDocumentCommentsController < ApplicationController def add_reply @document = OrgDocumentComment.find(params[:id]).root + @act = OrgActivity.find(params[:id]) @comment = OrgDocumentComment.new(:organization_id => @document.organization_id, :creator_id => User.current.id, :reply_id => params[:id]) @comment.content = params[:org_content] @document.children << @comment diff --git a/app/views/issues/add_journal_in_org.js.erb b/app/views/issues/add_journal_in_org.js.erb new file mode 100644 index 000000000..ad7a85540 --- /dev/null +++ b/app/views/issues/add_journal_in_org.js.erb @@ -0,0 +1,3 @@ +$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'organizations/org_project_issue', :locals => {:activity => @issue,:user_activity_id =>@user_activity_id}) %>"); + +init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%"); \ No newline at end of file diff --git a/app/views/org_document_comments/add_reply.js.erb b/app/views/org_document_comments/add_reply.js.erb index 5d54af2bf..40ed2eeb2 100644 --- a/app/views/org_document_comments/add_reply.js.erb +++ b/app/views/org_document_comments/add_reply.js.erb @@ -1,3 +1,3 @@ -$("#organization_document_<%= @document.id %>").replaceWith("<%= escape_javascript(render :partial => 'organizations/show_org_document', :locals => {:document => @document}) %>"); -init_activity_KindEditor_data(<%= @document.id %>,"","87%"); \ No newline at end of file +$("#organization_document_<%= @act.id %>").replaceWith("<%= escape_javascript(render :partial => 'organizations/show_org_document', :locals => {:document => @document, :act => @act}) %>"); +init_activity_KindEditor_data(<%= @act.id %>,"","87%"); \ No newline at end of file diff --git a/app/views/organizations/_org_activities.html.erb b/app/views/organizations/_org_activities.html.erb index cb69738b6..148bb9efe 100644 --- a/app/views/organizations/_org_activities.html.erb +++ b/app/views/organizations/_org_activities.html.erb @@ -1,5 +1,10 @@ <% unless org_activities.nil? %> <% org_activities.each do |act| %> + <% if act.container_type == 'Organization' %> <% if act.org_act_type == 'CreateOrganization' %>
    @@ -17,12 +22,7 @@
    <% end %> <% if act.org_act_type == 'OrgDocumentComment' && act.org_act_id != @organization.home_id %> - - <%= render :partial => 'show_org_document', :locals => {:document => act.org_act} %> + <%= render :partial => 'show_org_document', :locals => {:document => act.org_act, :act => act} %> <% end %> <% end %> <% if act.container_type == 'Project' %> diff --git a/app/views/organizations/_org_project_issue.html.erb b/app/views/organizations/_org_project_issue.html.erb index 573429752..e29994967 100644 --- a/app/views/organizations/_org_project_issue.html.erb +++ b/app/views/organizations/_org_project_issue.html.erb @@ -130,7 +130,23 @@
    <% end %> - +
    +
    <%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(activity.author_id), :alt => "用户头像" %>
    +
    +
    + <%= form_for('new_form',:url => add_journal_in_org_issue_path(activity.id),:method => "post", :remote => true) do |f|%> + + +
    + +
    +

    + <% end%> +
    +
    +
    +
    +
  • diff --git a/app/views/organizations/_show_org_document.html.erb b/app/views/organizations/_show_org_document.html.erb index 4177c3688..e352288ab 100644 --- a/app/views/organizations/_show_org_document.html.erb +++ b/app/views/organizations/_show_org_document.html.erb @@ -91,16 +91,16 @@ <%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33", :alt => "用户头像"), user_path(User.current) %>
    -
    - <%= form_for('new_form', :url => add_reply_org_document_comment_path(:id => document.id), :method => "post", :remote => true) do |f| %> - - +
    + <%= form_for('new_form', :url => add_reply_org_document_comment_path(:id => document.id, :act_id => act.id), :method => "post", :remote => true) do |f| %> + + -
    - +
    +
    -

    +

    <% end %>
    diff --git a/app/views/organizations/show.html.erb b/app/views/organizations/show.html.erb index a85ffa687..1ccb2f0e5 100644 --- a/app/views/organizations/show.html.erb +++ b/app/views/organizations/show.html.erb @@ -30,7 +30,8 @@ init_activity_KindEditor_data(<%= @organization.home_id%>, null, "87%"); }); - <%= render :partial => 'show_org_document', :locals => {:document => OrgDocumentComment.find(@organization.home_id), :home_id => @organization.home_id} %> + <% act = OrgActivity.where("org_act_type = 'OrgDocumentComment' and org_act_id =?", @organization.home_id).first %> + <%= render :partial => 'show_org_document', :locals => {:document => OrgDocumentComment.find(@organization.home_id), :home_id => @organization.home_id, :act => act} %> <% end %> <%= render :partial => 'organizations/org_activities', diff --git a/config/routes.rb b/config/routes.rb index 69134e666..24d159f04 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -634,6 +634,7 @@ RedmineApp::Application.routes.draw do end member do post 'add_journal' + post 'add_journal_in_org' end resources :time_entries, :controller => 'timelog' do collection do From 5400b907e6a491cea534d9e7575c6a29e423f3e9 Mon Sep 17 00:00:00 2001 From: cxt Date: Tue, 17 Nov 2015 09:33:40 +0800 Subject: [PATCH 014/143] =?UTF-8?q?=E5=AD=A6=E7=94=9F=E6=B5=8B=E9=AA=8C?= =?UTF-8?q?=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/exercise_controller.rb | 19 ++- app/views/exercise/_exercise.html.erb | 2 +- app/views/exercise/_student_exercise.html.erb | 46 ++++++ .../exercise/student_exercise_list.html.erb | 138 ++++++++++++++++++ config/routes.rb | 1 + ...4_add_publish_time_end_time_to_exercise.rb | 6 + db/schema.rb | 4 +- 7 files changed, 213 insertions(+), 3 deletions(-) create mode 100644 app/views/exercise/_student_exercise.html.erb create mode 100644 app/views/exercise/student_exercise_list.html.erb create mode 100644 db/migrate/20151116065904_add_publish_time_end_time_to_exercise.rb diff --git a/app/controllers/exercise_controller.rb b/app/controllers/exercise_controller.rb index bed3d9061..296c744b6 100644 --- a/app/controllers/exercise_controller.rb +++ b/app/controllers/exercise_controller.rb @@ -1,7 +1,7 @@ class ExerciseController < ApplicationController layout "base_courses" - before_filter :find_course, :only => [:index,:new,:create] + before_filter :find_course, :only => [:index,:new,:create,:student_exercise_list] def index @is_teacher = User.current.allowed_to?(:as_teacher,@course) if @is_teacher @@ -44,6 +44,23 @@ class ExerciseController < ApplicationController end + def student_exercise_list + @is_teacher = User.current.allowed_to?(:as_teacher,@course) || User.current.admin? + @exercise = Exercise.find params[:id] + @all_exercises = @course.exercises.order("created_at desc") + @exercise_count = @exercise.exercise_users.where('score is not NULL').count + if @is_teacher || (!@exercise.exercise_users.where(:user_id => User.current.id).empty? && Time.parse(@exercise.end_time.to_s).strftime("%Y-%m-%d-%H-%M-%S") <= Time.now.strftime("%Y-%m-%d-%H-%M-%S")) + @exercise_users_list = @exercise.exercise_users.where('score is not NULL') + elsif !@exercise.exercise_users.where(:user_id => User.current.id).empty? && Time.parse(@exercise.end_time.to_s).strftime("%Y-%m-%d-%H-%M-%S") > Time.now.strftime("%Y-%m-%d-%H-%M-%S") + @exercise_users_list = @exercise.exercise_users.where("user_id = ? and score is not NULL",User.current.id) + else + @exercise_users_list = [] + end + respond_to do |format| + format.html + end + end + private def find_course @course = Course.find params[:course_id] diff --git a/app/views/exercise/_exercise.html.erb b/app/views/exercise/_exercise.html.erb index e469c471c..15a684a62 100644 --- a/app/views/exercise/_exercise.html.erb +++ b/app/views/exercise/_exercise.html.erb @@ -15,7 +15,7 @@ <% if exercise.exercise_status == 1%>
  • 统计结果
  • <% else %> -
  • <%= link_to l(:label_statistical_results), statistics_result_exercise_path(exercise.id), :class => "pollsbtn fl ml10"%>
  • +
  • <%= link_to l(:label_statistical_results), student_exercise_list_exercise_path(exercise.id,:course_id => @course.id), :class => "pollsbtn fl ml10"%>
  • <% end%> <% if exercise.exercise_status == 1 %> diff --git a/app/views/exercise/_student_exercise.html.erb b/app/views/exercise/_student_exercise.html.erb new file mode 100644 index 000000000..b133baa04 --- /dev/null +++ b/app/views/exercise/_student_exercise.html.erb @@ -0,0 +1,46 @@ +
    + + 测验 + + (<%= @exercise_count%>人已交) + + <% if !@is_teacher && @exercise_users_list.empty?%> + 您尚未提交 + <% elsif !@is_teacher && !@exercise_users_list.empty?%> + 您已提交 + <% end %> + + <%if @is_teacher || @exercise.exercise_status == 3%> +
    + + +
    + <%#= select_tag(:student_work_in_group,options_for_select(course_group_list(@course),@group), {:class => "classSplit"}) unless course_group_list(@course).empty? %> + <% end%> + +
    +
    + +
    + <%= render :partial => "evaluation_un_title"%> +
    +
    + +<% @stundet_works.each do |student_work|%> + <% if @is_evaluation%> + <%= render :partial => "evaluation_work", :locals => {:student_work => student_work}%> + <% else%> + <%= render :partial => "evaluation_un_work", :locals => {:student_work => student_work}%> + <% end%> +
    +
    + <% if student_work.user == User.current && !@is_evaluation %> + <% if @homework.homework_type == 2%> + <%=render :partial => 'programing_work_show', :locals=> {:work => student_work, :score =>student_work_score(student_work,User.current),:student_work_scores => student_work.student_works_scores.order("updated_at desc")} %> + <% else %> + <%=render :partial => 'show' , :locals=> {:work => student_work, :score =>student_work_score(student_work,User.current),:student_work_scores => student_work.student_works_scores.order("updated_at desc")} %> + <% end %> + <% end %> +
    +
    +<% end%> \ No newline at end of file diff --git a/app/views/exercise/student_exercise_list.html.erb b/app/views/exercise/student_exercise_list.html.erb new file mode 100644 index 000000000..8653836ca --- /dev/null +++ b/app/views/exercise/student_exercise_list.html.erb @@ -0,0 +1,138 @@ + + +
    +
    +
    + + +
    +
    + +
    +
    + + <% if @exercise.exercise_status == 1 %> + 未发布 + <% elsif @exercise.exercise_status == 2 %> + 已发布 + <% elsif @exercise.exercise_status == 3 %> + 已截止 + <% end%> + [ 隐藏测验信息 ] +
    +
    发布者:<%= @exercise.user.show_name %>
    +
    +
    <%= @exercise.exercise_description.html_safe %>
    +
    + + +
    +
    +
    截止时间:<%= format_time @exercise.end_time %>
    + <% if @exercise.exercise_status == 1 %> +
    发布时间:<%= format_time @exercise.publish_time %>
    + <% end %> + <% end_time = @exercise.end_time.to_time.to_i %> + <% if end_time > Time.now.to_i %> +
    提交剩余时间: <%= (end_time - Time.now.to_i) / (24*60*60) %> 天 + <%= ((end_time - Time.now.to_i) % (24*60*60)) / (60*60)%> 小时 + <%= (((end_time - Time.now.to_i) % (24*60*60)) % (60*60)) / 60%>
    + <% else %> +
    提交已截止
    + <% end %> +
    +
    +
    +
    + +
    +
    +
    + <%= render :partial => "exercise/student_exercise"%> +
    +
    +
    + +
    +
    +
    +
    \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 3f1ca2ba0..f1073381f 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -150,6 +150,7 @@ RedmineApp::Application.routes.draw do resources :exercise do member do #生成路径为 /exercise/:id/方法名 get 'statistics_result' + get 'student_exercise_list' get 'export_exercise' end diff --git a/db/migrate/20151116065904_add_publish_time_end_time_to_exercise.rb b/db/migrate/20151116065904_add_publish_time_end_time_to_exercise.rb new file mode 100644 index 000000000..90aec321f --- /dev/null +++ b/db/migrate/20151116065904_add_publish_time_end_time_to_exercise.rb @@ -0,0 +1,6 @@ +class AddPublishTimeEndTimeToExercise < ActiveRecord::Migration + def change + add_column :exercises, :publish_time, :timestamp + add_column :exercises, :end_time, :timestamp + end +end diff --git a/db/schema.rb b/db/schema.rb index 272db1944..3feb43adb 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 => 20151113025751) do +ActiveRecord::Schema.define(:version => 20151116065904) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -624,6 +624,8 @@ ActiveRecord::Schema.define(:version => 20151113025751) do t.integer "time" t.datetime "created_at", :null => false t.datetime "updated_at", :null => false + t.datetime "publish_time" + t.datetime "end_time" end create_table "first_pages", :force => true do |t| From fba461f94a62d405c1632eea14902508ec2082bc Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Tue, 17 Nov 2015 09:51:16 +0800 Subject: [PATCH 015/143] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=BB=84=E7=BB=87?= =?UTF-8?q?=E6=A8=A1=E5=9D=97=E4=B8=AD=E9=A1=B9=E7=9B=AE=E8=AE=A8=E8=AE=BA?= =?UTF-8?q?=E5=8C=BA=E7=9A=84=E5=9B=9E=E5=A4=8D=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/messages_controller.rb | 5 +++++ app/controllers/organizations_controller.rb | 6 +++--- .../organizations/_org_activities.html.erb | 4 ++-- .../organizations/_project_create.html.erb | 2 +- .../organizations/_project_message.html.erb | 18 ++++++++++++++++++ app/views/organizations/show.html.erb | 9 ++++++--- 6 files changed, 35 insertions(+), 9 deletions(-) diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb index 4f78d61f5..9b090de9a 100644 --- a/app/controllers/messages_controller.rb +++ b/app/controllers/messages_controller.rb @@ -174,6 +174,11 @@ class MessagesController < ApplicationController user_activity.updated_at = Time.now user_activity.save end + org_activity = OrgActivity.where("org_act_type='Message' and org_act_id =#{@topic.id}").first + if org_activity + org_activity.updated_at = Time.now + org_activity.save + end #@topic.update_attribute(:updated_on, Time.now) if !@reply.new_record? if params[:asset_id] diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb index 6a1030adc..392966d68 100644 --- a/app/controllers/organizations_controller.rb +++ b/app/controllers/organizations_controller.rb @@ -56,10 +56,10 @@ class OrganizationsController < ApplicationController if @organization.is_public? || User.current.admin? || User.current.member_of_org?(@organization) @organization = Organization.find(params[:id]) project_ids = @organization.projects.map(&:id) << 0 - @org_activities = OrgActivity.where("(container_id =? and container_type =?) or (container_type ='Project' and container_id in (#{project_ids.join(',')}))", + @org_activities = OrgActivity.where("(container_id =? and container_type =?) or (container_type ='Project' and org_act_type in ('Issue','Message','ProjectCreateInfo') and container_id in (#{project_ids.join(',')}))", @organization.id, 'Organization').order('updated_at desc').page(params[:page] || 1).per(10) - @org_activities_count = OrgActivity.where("(container_id =? and container_type =?) or (container_type ='Project' and container_id in (#{project_ids.join(',')}))" , - @organization.id, 'Organization ').count + # @org_activities_count = OrgActivity.where("(container_id =? and container_type =?) or (container_type ='Project' and container_id in (#{project_ids.join(',')}))" , + # @organization.id, 'Organization ').count # @org_project_activties = ForgeActivity.where("project_id in (#{project_ids.join(',')}) and forge_act_type in('Issue','Message','ProjectCreateInfo')").order("updated_at desc").page(params[:page] || 1).per(10) # @org_project_activties_count = ForgeActivity.where('project_id in (?)',project_ids.join(',')).count #@org_activities = paginateHelper @org_activities, 10 diff --git a/app/views/organizations/_org_activities.html.erb b/app/views/organizations/_org_activities.html.erb index 148bb9efe..9523a0a15 100644 --- a/app/views/organizations/_org_activities.html.erb +++ b/app/views/organizations/_org_activities.html.erb @@ -31,8 +31,8 @@ <%= render :partial => 'organizations/org_project_issue', :locals => {:activity => Issue.find(act.org_act_id),:user_activity_id =>act.id} %> <% when 'Message' %> <%= render :partial => 'organizations/project_message', :locals => {:activity => Message.find(act.org_act_id),:user_activity_id =>act.id} %> - <%# when 'ProjectCreateInfo'%> - <%#= render :partial => 'organizations/project_create', :locals => {:activity => act,:user_activity_id =>act.id} %> + <% when 'ProjectCreateInfo'%> + <%= render :partial => 'organizations/project_create', :locals => {:activity => act,:user_activity_id =>act.id} %> <% end %> <% end %> <% end %> diff --git a/app/views/organizations/_project_create.html.erb b/app/views/organizations/_project_create.html.erb index d966d8e18..607c14a45 100644 --- a/app/views/organizations/_project_create.html.erb +++ b/app/views/organizations/_project_create.html.erb @@ -1,4 +1,4 @@ -<% project = Project.find(activity.project_id) %> +<% project = Project.find(activity.org_act_id) %> <% user = User.find(project.user_id)%>
    diff --git a/app/views/organizations/_project_message.html.erb b/app/views/organizations/_project_message.html.erb index 85ed08f2f..2708bb546 100644 --- a/app/views/organizations/_project_message.html.erb +++ b/app/views/organizations/_project_message.html.erb @@ -95,6 +95,24 @@
    <% end %> +
    +
    <%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(activity.author_id), :alt => "用户头像" %>
    +
    +
    + <%= form_for('new_form',:url => {:controller=>'messages',:action => 'reply', :id => activity.id, :board_id => activity.board_id, :is_board => 'true'},:method => "post", :remote => true) do |f|%> + + + +
    + +
    +

    + <% end%> +
    +
    +
    +
    +
    \ No newline at end of file diff --git a/app/views/organizations/show.html.erb b/app/views/organizations/show.html.erb index 1ccb2f0e5..36cc24225 100644 --- a/app/views/organizations/show.html.erb +++ b/app/views/organizations/show.html.erb @@ -14,14 +14,17 @@
    最新动态
    - + +
    <% if !@organization.home_id.nil? and OrgDocumentComment.where("id = ?", @organization.home_id).count > 0 %> From 6f5cb8f1426a0935690266fcdfa0777a615abab4 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Tue, 17 Nov 2015 10:17:07 +0800 Subject: [PATCH 016/143] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=BB=84=E7=BB=87?= =?UTF-8?q?=E5=8A=A8=E6=80=81=E7=9A=84=E8=BF=87=E6=BB=A4=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=EF=BC=8C=E7=BB=84=E7=BB=87=E5=8A=A8=E6=80=81=E5=8C=85=E6=8B=AC?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E5=8A=A8=E6=80=81=E5=92=8C=E7=BB=84=E7=BB=87?= =?UTF-8?q?=E7=9A=84=E5=8A=A8=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/organizations_controller.rb | 18 +++++++++++------- app/views/organizations/show.html.erb | 20 ++++++++++++++++---- 2 files changed, 27 insertions(+), 11 deletions(-) diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb index 392966d68..b35d7f3db 100644 --- a/app/controllers/organizations_controller.rb +++ b/app/controllers/organizations_controller.rb @@ -56,13 +56,17 @@ class OrganizationsController < ApplicationController if @organization.is_public? || User.current.admin? || User.current.member_of_org?(@organization) @organization = Organization.find(params[:id]) project_ids = @organization.projects.map(&:id) << 0 - @org_activities = OrgActivity.where("(container_id =? and container_type =?) or (container_type ='Project' and org_act_type in ('Issue','Message','ProjectCreateInfo') and container_id in (#{project_ids.join(',')}))", - @organization.id, 'Organization').order('updated_at desc').page(params[:page] || 1).per(10) - # @org_activities_count = OrgActivity.where("(container_id =? and container_type =?) or (container_type ='Project' and container_id in (#{project_ids.join(',')}))" , - # @organization.id, 'Organization ').count - # @org_project_activties = ForgeActivity.where("project_id in (#{project_ids.join(',')}) and forge_act_type in('Issue','Message','ProjectCreateInfo')").order("updated_at desc").page(params[:page] || 1).per(10) - # @org_project_activties_count = ForgeActivity.where('project_id in (?)',project_ids.join(',')).count - #@org_activities = paginateHelper @org_activities, 10 + case params[:type] + when nil + @org_activities = OrgActivity.where("(container_id =? and container_type =?) or (container_type ='Project' and org_act_type in ('Issue','Message','ProjectCreateInfo') and container_id in (#{project_ids.join(',')}))", + @organization.id, 'Organization').order('updated_at desc').page(params[:page] || 1).per(10) + when 'project_issue' + @org_activities = OrgActivity.where("container_type = 'Project' and org_act_type = 'Issue' and container_id in (#{project_ids.join(',')})").order('updated_at desc').page(params[:page] || 1).per(10) + when 'project_message' + @org_activities = OrgActivity.where("container_type = 'Project' and org_act_type = 'Message' and container_id in (#{project_ids.join(',')})").order('updated_at desc').page(params[:page] || 1).per(10) + when 'org' + @org_activities = OrgActivity.where("container_id =? and container_type =?",@organization.id, 'Organization').order('updated_at desc').page(params[:page] || 1).per(10) + end @page = params[:page] respond_to do |format| format.html diff --git a/app/views/organizations/show.html.erb b/app/views/organizations/show.html.erb index 36cc24225..e62a66913 100644 --- a/app/views/organizations/show.html.erb +++ b/app/views/organizations/show.html.erb @@ -16,10 +16,22 @@
    最新动态
    diff --git a/app/views/exercise/_new_single.html.erb b/app/views/exercise/_new_single.html.erb index c97483bce..1ee79e198 100644 --- a/app/views/exercise/_new_single.html.erb +++ b/app/views/exercise/_new_single.html.erb @@ -13,7 +13,7 @@
  • <% score = exercise.exercise_questions.where("question_type=3").last.nil? ? "": exercise.exercise_questions.where("question_type=3").last.question_score %> - 分 +
  • diff --git a/app/views/exercise/_show_MC.html.erb b/app/views/exercise/_show_MC.html.erb index 183e8d190..b932eac1e 100644 --- a/app/views/exercise/_show_MC.html.erb +++ b/app/views/exercise/_show_MC.html.erb @@ -46,13 +46,13 @@ ''+ ''+ ''+ - ''+ + ''+ ''+ '
    '+ '
      '+ '
    • '+ ''+ - '分'+ + '分'+ '
    • '+ '
    • '+ ''+ @@ -84,13 +84,13 @@ '
      '+ '
    • '+ ''+ - ''+ + ''+ '
    • '+ '
      '+ '
    '+ '
    '+ ''+ '<% end%>' ); - $("#poll_questions_title_"+quest_type+"_"+quest_id).focus(); + $("#poll_questions_title").focus(); } } else { diff --git a/app/views/exercise/_show_MCQ.html.erb b/app/views/exercise/_show_MCQ.html.erb index af2b0facb..2a91afab5 100644 --- a/app/views/exercise/_show_MCQ.html.erb +++ b/app/views/exercise/_show_MCQ.html.erb @@ -45,13 +45,13 @@ ''+ ''+ ''+ - ''+ + ''+ ''+ '
    '+ '
      '+ '
    • '+ ''+ - '分'+ + '分'+ '
    • '+ '
    • '+ ''+ @@ -83,13 +83,13 @@ '
      '+ '
    • '+ ''+ - ''+ + ''+ '
    • '+ '
      '+ '
    '+ '
    '+ '
    '+ '<% end%>' ); - $("#poll_questions_title_"+quest_type+"_"+quest_id).focus(); + $("#poll_questions_title").focus(); } }else { $("#insert_new_poll_question_"+quest_type+"_"+quest_id).html(""); diff --git a/app/views/exercise/_show_single.html.erb b/app/views/exercise/_show_single.html.erb index 9c7936e6d..5f36a931e 100644 --- a/app/views/exercise/_show_single.html.erb +++ b/app/views/exercise/_show_single.html.erb @@ -33,13 +33,13 @@ ''+ ''+ ''+ - ''+ + ''+ ''+ '
    '+ '
      '+ '
    • '+ ''+ - '分'+ + '分'+ '
    • '+ '
    • '+ ''+ @@ -65,7 +65,7 @@ '
    '+ '
    '+ '
    '+ '<% end%>' ); - $("#poll_questions_title_"+quest_type+"_"+quest_id).focus(); + $("#poll_questions_title").focus(); } } else { $("#insert_new_poll_question_"+quest_type+"_"+quest_id).html(""); From 87285578130fe52a93d0f7c85640f4a609ab44e5 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 20 Nov 2015 17:29:15 +0800 Subject: [PATCH 115/143] =?UTF-8?q?=E8=80=81=E5=B8=88=E5=92=8C=E5=AD=A6?= =?UTF-8?q?=E7=94=9F=E7=BB=9F=E8=AE=A1=E6=95=B0=E7=9B=AE=E5=8C=BA=E5=88=86?= 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 ac8727e21..9c119f37a 100644 --- a/app/views/layouts/base_courses.html.erb +++ b/app/views/layouts/base_courses.html.erb @@ -159,7 +159,7 @@ From 6068867670c33f9868001537c252cb58baa530d4 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Fri, 20 Nov 2015 17:42:43 +0800 Subject: [PATCH 116/143] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E5=8A=A8=E6=80=81?= =?UTF-8?q?=E5=92=8C=E7=BB=84=E7=BB=87=E5=8A=A8=E6=80=81=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E5=90=8E=EF=BC=8C=E5=88=A0=E9=99=A4=E7=9B=B8=E5=BA=94=E7=9A=84?= =?UTF-8?q?=E7=BB=84=E7=BB=87=E5=8A=A8=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/course_activity.rb | 7 ++++++- app/models/forge_activity.rb | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/app/models/course_activity.rb b/app/models/course_activity.rb index cd3234196..e1f9ab9f5 100644 --- a/app/models/course_activity.rb +++ b/app/models/course_activity.rb @@ -6,7 +6,7 @@ class CourseActivity < ActiveRecord::Base belongs_to :user has_many :user_acts, :class_name => 'UserAcivity',:as =>:act after_save :add_user_activity, :add_course_activity - before_destroy :destroy_user_activity + before_destroy :destroy_user_activity, :destroy_org_activity #在个人动态里面增加当前动态 def add_user_activity @@ -55,4 +55,9 @@ class CourseActivity < ActiveRecord::Base user_activity = UserActivity.where("act_type = '#{self.course_act_type.to_s}' and act_id = '#{self.course_act_id}'") user_activity.destroy_all end + + def destroy_org_activity + org_activity = OrgActivity.where("org_act_type = '#{self.course_act_type.to_s}' and org_act_id = '#{self.course_act_id}'") + org_activity.destroy_all + end end diff --git a/app/models/forge_activity.rb b/app/models/forge_activity.rb index 5005f9eab..bb5f30442 100644 --- a/app/models/forge_activity.rb +++ b/app/models/forge_activity.rb @@ -21,7 +21,7 @@ class ForgeActivity < ActiveRecord::Base validates :forge_act_type, presence: true has_many :user_acts, :class_name => 'UserAcivity',:as =>:act after_save :add_user_activity, :add_org_activity - before_destroy :destroy_user_activity + before_destroy :destroy_user_activity, :destroy_org_activity #在个人动态里面增加当前动态 def add_user_activity @@ -67,7 +67,7 @@ class ForgeActivity < ActiveRecord::Base end def destroy_org_activity - org_acts = OrgActivity.where("org_act_type='#{self.forge_act_type.to_s}' and act_id = '#{self.forge_act_id}'") + org_acts = OrgActivity.where("org_act_type='#{self.forge_act_type.to_s}' and org_act_id = '#{self.forge_act_id}'") org_acts.destroy_all end end From 332ace0f34c85e5d0a833da755e7b58c254d10ac Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 20 Nov 2015 18:00:11 +0800 Subject: [PATCH 117/143] =?UTF-8?q?=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/exercise_controller.rb | 1 + app/views/exercise/_exercise.html.erb | 24 ++++++++++------------ app/views/exercise/_exercise_form.html.erb | 4 ++-- 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/app/controllers/exercise_controller.rb b/app/controllers/exercise_controller.rb index e23560efe..1a8faff55 100644 --- a/app/controllers/exercise_controller.rb +++ b/app/controllers/exercise_controller.rb @@ -112,6 +112,7 @@ class ExerciseController < ApplicationController end def destroy + @is_teacher = User.current.allowed_to?(:as_teacher,@course) || User.current.admin? if @exercise && @exercise.destroy if @is_teacher exercises = Exercise.where("course_id =?", @course.id) diff --git a/app/views/exercise/_exercise.html.erb b/app/views/exercise/_exercise.html.erb index e44cd69c6..78ca97887 100644 --- a/app/views/exercise/_exercise.html.erb +++ b/app/views/exercise/_exercise.html.erb @@ -20,10 +20,8 @@ <% if exercise.exercise_status == 1 %>
  • 发布试卷
  • - <% elsif exercise.exercise_status == 2%> + <% else %>
  • 取消发布
  • - <% else%> -
  • 发布试卷
  • <% end%> <%= link_to(l(:button_delete), exercise,:method => :delete, :confirm => l(:text_are_you_sure), :remote => true, :class => "polls_de fr ml5 mr10") %> @@ -34,17 +32,17 @@
  • 编辑
  • <% end%> - <% if exercise.exercise_status == 2 %> -
  • 关闭
  • - <% else %> -
  • 关闭
  • - <% end%> + <%# if exercise.exercise_status == 2 %> + + <%# else %> + + <%# end%> - <% if exercise.exercise_status == 1%> -
  • 导出
  • - <% elsif exercise.exercise_status == 2 || exercise.exercise_status == 3 %> -
  • <%= link_to "导出", export_exercise_exercise_path(exercise.id,:format => "xls"), :class => "polls_de fr ml5"%>
  • - <% end%> + <%# if exercise.exercise_status == 1%> + + <%# elsif exercise.exercise_status == 2 || exercise.exercise_status == 3 %> + + <%# end%>
  • <%= format_date exercise.created_at.to_date%>
  • diff --git a/app/views/exercise/_exercise_form.html.erb b/app/views/exercise/_exercise_form.html.erb index 69f55f3d7..22589097a 100644 --- a/app/views/exercise/_exercise_form.html.erb +++ b/app/views/exercise/_exercise_form.html.erb @@ -83,9 +83,9 @@ function add_poll_question(doc,quest_type,quest_id) { var title = $.trim($("#poll_questions_title").val()); - var score = $.trim($("#questions_score").val()); + var score = $.trim($("#question_score").val()); if(title.length == 0 || score.length == 0){ - alert("题目标题/分数+不能为空"); + alert("题目标题/分数不能为空"); }else{ doc.parent().parent().parent().submit();} } From 97485ca2216a9a95de22995e88da23c396e7fec0 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 20 Nov 2015 18:01:50 +0800 Subject: [PATCH 118/143] =?UTF-8?q?=E4=BF=AE=E6=94=B9show=E9=80=BB?= =?UTF-8?q?=E8=BE=91=20=E6=8F=90=E4=BA=A4=E9=97=AE=E5=8D=B7=E5=90=8E?= =?UTF-8?q?=E5=AD=A6=E7=94=9F=E9=A1=B5=E9=9D=A2=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/exercise_controller.rb | 47 +++++++++++++------ .../_exercise_student_result.html.erb | 13 +++-- 2 files changed, 39 insertions(+), 21 deletions(-) diff --git a/app/controllers/exercise_controller.rb b/app/controllers/exercise_controller.rb index e23560efe..3164235d5 100644 --- a/app/controllers/exercise_controller.rb +++ b/app/controllers/exercise_controller.rb @@ -27,19 +27,21 @@ class ExerciseController < ApplicationController render_403 return end - + @can_edit_excercise = (!has_commit_exercise?(@exercise.id,User.current.id)) || User.current.admin? + @exercise_user = ExerciseUser.where("user_id=? and exercise_id=?", User.current.id, @exercise.id).first # 学生点击的时候即创建关联,自动保存 #eu = ExerciseUser.create(:user_id => User.current, :exercise_id => @exercise.id, :start_at => Time.now, :status => false) # 已提交问卷的用户不能再访问该界面 if has_commit_exercise?(@exercise.id, User.current.id) && (!User.current.admin?) - redirect_to exercise_index_url(:course_id=> @course.id) + respond_to do |format| + format.html {render :layout => 'base_courses'} + end else if !@is_teacher && !has_click_exercise?(@exercise.id, User.current.id) eu = ExerciseUser.create(:user_id => User.current.id, :exercise_id => @exercise.id, :start_at => Time.now, :status => false) end - @can_edit_excercise = (!has_commit_exercise?(@exercise.id,User.current.id)) || User.current.admin? - @exercise_user = ExerciseUser.where("user_id=? and exercise_id=?", User.current.id, @exercise.id).first + # @percent = get_percent(@exercise,User.current) exercise_questions = @exercise.exercise_questions @exercise_questions = paginateHelper exercise_questions,5 #分页 @@ -433,6 +435,8 @@ class ExerciseController < ApplicationController redirect_to exercise_url(@exercise) # REDO: 提示提交成功 else + # 更新提交状态 + @exercise.exercise_users.first.update_attributes(:status => true) # 答题过程中需要统计完成量 @uncomplete_question = get_uncomplete_question(@exercise, User.current) # 获取改学生的考试得分 @@ -480,16 +484,17 @@ class ExerciseController < ApplicationController score2 = score + question.question_score unless question.question_score.nil? end else - ecs = ExerciseAnswer.where("user_id =? and exercise_question_id =?", user.id, question.id) - arr = [] - ecs.each do |ec| - arr << ec.exercise_choice.choice_position - end - arr.sort - arr = arr.join("") - if arr.to_i == standard_answer.exercise_choice_id - score3 = score + question.question_score unless question.question_score.nil? - end + get_mulscore(question, user, standard_answer) + # ecs = ExerciseAnswer.where("user_id =? and exercise_question_id =?", user.id, question.id) + # arr = [] + # ecs.each do |ec| + # arr << ec.exercise_choice.choice_position + # end + # arr.sort + # arr = arr.join("") + # if arr.to_i == standard_answer.exercise_choice_id + # score3 = score + question.question_score unless question.question_score.nil? + # end end end end @@ -497,6 +502,20 @@ class ExerciseController < ApplicationController end private + # 获取多选的得分 + def get_mulscore(question, user, standard_answer) + ecs = ExerciseAnswer.where("user_id =? and exercise_question_id =?", user.id, question.id) + arr = [] + ecs.each do |ec| + arr << ec.exercise_choice.choice_position + end + arr.sort + arr = arr.join("") + if arr.to_i == standard_answer.exercise_choice_id + score3 = score + question.question_score unless question.question_score.nil? + end + end + # ExerciseUser记录用户是否已提交问卷有对应的记录则已提交,没有则新建一个 def get_exercise_user exercise_id,user_id eu = ExerciseUser.find_by_exercise_id_and_user_id(exercise_id,user_id) diff --git a/app/views/exercise/_exercise_student_result.html.erb b/app/views/exercise/_exercise_student_result.html.erb index c6b9a251c..95ef022d5 100644 --- a/app/views/exercise/_exercise_student_result.html.erb +++ b/app/views/exercise/_exercise_student_result.html.erb @@ -12,9 +12,8 @@
    开始时间:<%=format_time(exercise_user.start_at.to_s) %> 测验时长:<%=exercise.time %>分钟 - <% time = exercise_user.end_at - exercise_user.start_at %> - 测验用时:<%= (time % (24*60*60)) / (60*60)%> 小时 <%= ((time % (24*60*60)) % (60*60)) / 60%> 分钟 <%= ((time % (24*60*60)) % (60*60)) % 60%> 秒 -
    + <%# time = exercise_user.end_at - exercise_user.start_at %> +
    <%= exercise.exercise_description.nil? ? "" : exercise.exercise_description.html_safe%>
    @@ -32,7 +31,7 @@ <% answer = get_user_answer(exercise_question, User.current)%> <% standard_answer = get_user_standard_answer(exercise_question, User.current)%> - <% if answer.exercise_choice_id == standard_answer.exercise_choice_id %> + <% if answer.first.exercise_choice.choice_position == standard_answer.first.exercise_choice_id %> √ <% else %> × @@ -63,7 +62,7 @@
    ">

    多选题

    - <% mcq_question_list.each_wtih_index do |exercise_question, list_index| %> + <% mcq_question_list.each_with_index do |exercise_question, list_index| %>
    @@ -71,7 +70,7 @@ <% answer = get_user_answer(exercise_question, User.current)%> <% standard_answer = get_user_standard_answer(exercise_question, User.current)%> - <% if answer.exercise_choice_id == standard_answer.exercise_choice_id %> + <% if answer.first.exercise_choice_id == standard_answer.first.exercise_choice_id %> √ <% else %> × @@ -110,7 +109,7 @@ <% answer = get_user_answer(exercise_question, User.current)%> <% standard_answer = get_user_standard_answer(exercise_question, User.current)%> - <% if standard_answer.include?(answer.exercise_choice_id) %> + <% if standard_answer.include?(answer.first.answer_text) %> √ <% else %> × From bb726e3475682c509c498ca9bf7179b8b71494a5 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 20 Nov 2015 18:21:31 +0800 Subject: [PATCH 119/143] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E7=AD=94=E6=A1=88?= =?UTF-8?q?=E9=AA=8C=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/exercise_controller.rb | 18 ++++-------------- app/helpers/exercise_helper.rb | 11 +++++++++++ .../exercise/_exercise_student_result.html.erb | 2 +- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/app/controllers/exercise_controller.rb b/app/controllers/exercise_controller.rb index cbc6009b1..781ea50cd 100644 --- a/app/controllers/exercise_controller.rb +++ b/app/controllers/exercise_controller.rb @@ -485,7 +485,10 @@ class ExerciseController < ApplicationController score2 = score + question.question_score unless question.question_score.nil? end else - get_mulscore(question, user, standard_answer) + arr = get_mulscore(question, user) + if arr.to_i == standard_answer.exercise_choice_id + score3 = score + question.question_score unless question.question_score.nil? + end # ecs = ExerciseAnswer.where("user_id =? and exercise_question_id =?", user.id, question.id) # arr = [] # ecs.each do |ec| @@ -503,19 +506,6 @@ class ExerciseController < ApplicationController end private - # 获取多选的得分 - def get_mulscore(question, user, standard_answer) - ecs = ExerciseAnswer.where("user_id =? and exercise_question_id =?", user.id, question.id) - arr = [] - ecs.each do |ec| - arr << ec.exercise_choice.choice_position - end - arr.sort - arr = arr.join("") - if arr.to_i == standard_answer.exercise_choice_id - score3 = score + question.question_score unless question.question_score.nil? - end - end # ExerciseUser记录用户是否已提交问卷有对应的记录则已提交,没有则新建一个 def get_exercise_user exercise_id,user_id diff --git a/app/helpers/exercise_helper.rb b/app/helpers/exercise_helper.rb index 21c0144b9..bb87f3b82 100644 --- a/app/helpers/exercise_helper.rb +++ b/app/helpers/exercise_helper.rb @@ -36,6 +36,17 @@ module ExerciseHelper end end + # 获取多选的得分 + def get_mulscore(question, user) + ecs = ExerciseAnswer.where("user_id =? and exercise_question_id =?", user.id, question.id) + arr = [] + ecs.each do |ec| + arr << ec.exercise_choice.choice_position + end + arr.sort + arr = arr.join("") + end + # 判断用户是否已经提交了问卷 # status 为0的时候是用户点击试卷。为1表示用户已经提交 def has_commit_exercise?(exercise_id, user_id) diff --git a/app/views/exercise/_exercise_student_result.html.erb b/app/views/exercise/_exercise_student_result.html.erb index 95ef022d5..32cb556b3 100644 --- a/app/views/exercise/_exercise_student_result.html.erb +++ b/app/views/exercise/_exercise_student_result.html.erb @@ -70,7 +70,7 @@ <% answer = get_user_answer(exercise_question, User.current)%> <% standard_answer = get_user_standard_answer(exercise_question, User.current)%> - <% if answer.first.exercise_choice_id == standard_answer.first.exercise_choice_id %> + <% if get_mulscore(exercise_question, User.current).to_i == standard_answer.first.exercise_choice_id %> √ <% else %> × From c9ba57f64bbfaf23fbd057847a65ca0399f40ddb Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 20 Nov 2015 18:29:26 +0800 Subject: [PATCH 120/143] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E5=85=B3=E9=97=AD?= =?UTF-8?q?=E3=80=81=E5=AF=BC=E5=85=A5=E7=AD=89=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/exercise_controller.rb | 10 ++-------- app/views/exercise/_exercise.html.erb | 2 +- app/views/exercise/_exercise_submit.html.erb | 6 +++--- app/views/exercise/index.html.erb | 2 +- 4 files changed, 7 insertions(+), 13 deletions(-) diff --git a/app/controllers/exercise_controller.rb b/app/controllers/exercise_controller.rb index 1a8faff55..6f08cb75f 100644 --- a/app/controllers/exercise_controller.rb +++ b/app/controllers/exercise_controller.rb @@ -284,13 +284,7 @@ class ExerciseController < ApplicationController @exercise.exercise_status = 2 @exercise.publish_time = Time.now if @exercise.save - if params[:is_remote] - redirect_to exercise_index_url(:course_id => @course.id) - else - respond_to do |format| - format.js - end - end + redirect_to exercise_index_url(:course_id=> @course.id) end end @@ -430,7 +424,7 @@ class ExerciseController < ApplicationController def commit_exercise # 老师不需要提交 if User.current.allowed_to?(:as_teacher,@course) - @exercise.update_attributes(:show_result => params[:exercise][:show_result]) + @exercise.update_attributes(:show_result => params[:show_result]) redirect_to exercise_url(@exercise) # REDO: 提示提交成功 else diff --git a/app/views/exercise/_exercise.html.erb b/app/views/exercise/_exercise.html.erb index 78ca97887..dfcc8d3b4 100644 --- a/app/views/exercise/_exercise.html.erb +++ b/app/views/exercise/_exercise.html.erb @@ -21,7 +21,7 @@ <% if exercise.exercise_status == 1 %>
  • 发布试卷
  • <% else %> -
  • 取消发布
  • +
  • 发布试卷
  • <% end%> <%= link_to(l(:button_delete), exercise,:method => :delete, :confirm => l(:text_are_you_sure), :remote => true, :class => "polls_de fr ml5 mr10") %> diff --git a/app/views/exercise/_exercise_submit.html.erb b/app/views/exercise/_exercise_submit.html.erb index acbbea244..8e2ad74a2 100644 --- a/app/views/exercise/_exercise_submit.html.erb +++ b/app/views/exercise/_exercise_submit.html.erb @@ -1,4 +1,4 @@ -<%= form_for(exercise, +<%= form_for('', :html => { :multipart => true }, :url => {:controller => 'exercise', :action => 'commit_exercise', @@ -7,8 +7,8 @@
    提交
    - <%= f.check_box :show_result, :value => exercise.show_result%> - <%= label_tag 'exercise_show_result', '允许学生查看测验结果' %> + <%= f.check_box 'show_result', :value => exercise.show_result%> + <%= label_tag '_show_result', '允许学生查看测验结果' %>
    diff --git a/app/views/exercise/index.html.erb b/app/views/exercise/index.html.erb index 14db03e09..1e2d6ff34 100644 --- a/app/views/exercise/index.html.erb +++ b/app/views/exercise/index.html.erb @@ -37,7 +37,7 @@ $('#ajax-modal').html("
    " + "
    " + "
    " + - "

    问卷发布后将不能对问卷进行修改,
    是否确定发布该问卷?

    " + + "

    测验发布后将不能对测验进行修改,
    是否确定发布该测验?

    " + "
    " + "确  定" + "取  消" + From c07e2fe2d2ef413787abc95b500234f626e568b9 Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 20 Nov 2015 18:38:50 +0800 Subject: [PATCH 121/143] =?UTF-8?q?=E5=8F=91=E5=B8=83=E8=AF=95=E5=8D=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/exercise_controller.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/controllers/exercise_controller.rb b/app/controllers/exercise_controller.rb index e34e89cb7..c95458a57 100644 --- a/app/controllers/exercise_controller.rb +++ b/app/controllers/exercise_controller.rb @@ -40,6 +40,7 @@ class ExerciseController < ApplicationController else if !@is_teacher && !has_click_exercise?(@exercise.id, User.current.id) eu = ExerciseUser.create(:user_id => User.current.id, :exercise_id => @exercise.id, :start_at => Time.now, :status => false) + @exercise_user = ExerciseUser.where("user_id=? and exercise_id=?", User.current.id, @exercise.id).first end # @percent = get_percent(@exercise,User.current) From aa36c927d3c7c0a4ac88fac7741e68ae90c7115b Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 20 Nov 2015 18:39:35 +0800 Subject: [PATCH 122/143] 0 --- app/controllers/exercise_controller.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/app/controllers/exercise_controller.rb b/app/controllers/exercise_controller.rb index 781ea50cd..6699702aa 100644 --- a/app/controllers/exercise_controller.rb +++ b/app/controllers/exercise_controller.rb @@ -41,7 +41,6 @@ class ExerciseController < ApplicationController if !@is_teacher && !has_click_exercise?(@exercise.id, User.current.id) eu = ExerciseUser.create(:user_id => User.current.id, :exercise_id => @exercise.id, :start_at => Time.now, :status => false) end - # @percent = get_percent(@exercise,User.current) exercise_questions = @exercise.exercise_questions @exercise_questions = paginateHelper exercise_questions,5 #分页 From da55b00da7f1ccaa5662eb01015bb36bd3f0f1bd Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 20 Nov 2015 19:05:39 +0800 Subject: [PATCH 123/143] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=8F=92=E5=85=A5?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/exercise_controller.rb | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/app/controllers/exercise_controller.rb b/app/controllers/exercise_controller.rb index 448c9a90a..9c4ce463a 100644 --- a/app/controllers/exercise_controller.rb +++ b/app/controllers/exercise_controller.rb @@ -269,11 +269,23 @@ class ExerciseController < ApplicationController def delete_exercise_question @exercise_question = ExerciseQuestion.find params[:exercise_question] @exercise = @exercise_question.exercise - exercise_questions = @exercise.exercise_questions.where("question_number > #{@exercise_question.question_number}") - exercise_questions.each do |question| - question.question_number -= 1 - question.save + + 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 + # + # exercise_questions = @exercise.exercise_questions.where("question_number > #{@exercise_question.question_number}") + # exercise_questions.each do |question| + # question.question_number -= 1 + # question.save + # end if @exercise_question && @exercise_question.destroy respond_to do |format| format.js @@ -568,7 +580,9 @@ class ExerciseController < ApplicationController exercises = course.exercises.where("exercise_name=?","") unless exercises.empty? exercises.each do |exercise| - exercise.destroy + if exercise.exercise_questions.empty? + exercise.destroy + end end end end From c0dfc17b19e6afd84b76eebbe19ffc391111c57f Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 20 Nov 2015 19:35:32 +0800 Subject: [PATCH 124/143] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/exercise_controller.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/exercise_controller.rb b/app/controllers/exercise_controller.rb index 9c4ce463a..28f532db6 100644 --- a/app/controllers/exercise_controller.rb +++ b/app/controllers/exercise_controller.rb @@ -443,7 +443,8 @@ class ExerciseController < ApplicationController # REDO: 提示提交成功 else # 更新提交状态 - @exercise.exercise_users.first.update_attributes(:status => true) + cur_exercise_user = ExerciseUser.where("user_id =? and exercise_id=?", User.current, @exercise.id).first + cur_exercise_user.update_attributes(:status => 1) # 答题过程中需要统计完成量 @uncomplete_question = get_uncomplete_question(@exercise, User.current) # 获取改学生的考试得分 From 5ac65d86b18b94b53693c1ac7d3857c8c289ed98 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Fri, 20 Nov 2015 19:58:25 +0800 Subject: [PATCH 125/143] =?UTF-8?q?=E5=B0=86org=5Fdocument=5Fcomment?= =?UTF-8?q?=E4=B8=AD=E7=9A=84title=E6=94=B9=E6=88=90text=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...0151120115137_changecolumn_of_org_document_comments.rb | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 db/migrate/20151120115137_changecolumn_of_org_document_comments.rb diff --git a/db/migrate/20151120115137_changecolumn_of_org_document_comments.rb b/db/migrate/20151120115137_changecolumn_of_org_document_comments.rb new file mode 100644 index 000000000..15cc8fdcd --- /dev/null +++ b/db/migrate/20151120115137_changecolumn_of_org_document_comments.rb @@ -0,0 +1,8 @@ +class ChangecolumnOfOrgDocumentComments < ActiveRecord::Migration + def up + change_column :org_document_comments, :title, :text + end + + def down + end +end From 9ca336a70a926d62ad2fa407fe4c115b238c7354 Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 20 Nov 2015 19:59:05 +0800 Subject: [PATCH 126/143] =?UTF-8?q?=E5=8F=91=E5=B8=83=E5=92=8C=E5=8F=96?= =?UTF-8?q?=E6=B6=88=E5=8F=91=E5=B8=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/exercise_controller.rb | 2 +- app/views/exercise/_exercise.html.erb | 6 ++++-- app/views/exercise/_exercise_form.html.erb | 8 +++++++- app/views/exercise/create_exercise_question.js.erb | 4 +++- app/views/exercise/update_exercise_question.js.erb | 2 +- 5 files changed, 16 insertions(+), 6 deletions(-) diff --git a/app/controllers/exercise_controller.rb b/app/controllers/exercise_controller.rb index 448c9a90a..94a5a8028 100644 --- a/app/controllers/exercise_controller.rb +++ b/app/controllers/exercise_controller.rb @@ -294,7 +294,7 @@ class ExerciseController < ApplicationController # 重新发布的时候会删除所有的答题 def republish_exercise @exercise.exercise_questions.each do |exercise_question| - exercise_question.exercise_ansers.destroy_all + exercise_question.exercise_answers.destroy_all end @exercise.exercise_users.destroy_all @exercise.exercise_status = 1 diff --git a/app/views/exercise/_exercise.html.erb b/app/views/exercise/_exercise.html.erb index dfcc8d3b4..f5896c5e3 100644 --- a/app/views/exercise/_exercise.html.erb +++ b/app/views/exercise/_exercise.html.erb @@ -20,8 +20,10 @@ <% if exercise.exercise_status == 1 %>
  • 发布试卷
  • - <% else %> -
  • 发布试卷
  • + <% elsif exercise.exercise_status == 2%> +
  • 取消发布
  • + <% else%> +
  • 发布试卷
  • <% end%> <%= link_to(l(:button_delete), exercise,:method => :delete, :confirm => l(:text_are_you_sure), :remote => true, :class => "polls_de fr ml5 mr10") %> diff --git a/app/views/exercise/_exercise_form.html.erb b/app/views/exercise/_exercise_form.html.erb index 22589097a..29ccc685d 100644 --- a/app/views/exercise/_exercise_form.html.erb +++ b/app/views/exercise/_exercise_form.html.erb @@ -84,8 +84,11 @@ { var title = $.trim($("#poll_questions_title").val()); var score = $.trim($("#question_score").val()); + var standard_ans = $.trim($("#question_standard_ans").val()); if(title.length == 0 || score.length == 0){ alert("题目标题/分数不能为空"); + }else if(standard_ans.length == 0) { + alert("标准答案不能为空"); }else{ doc.parent().parent().parent().submit();} } @@ -94,8 +97,11 @@ { var title = $.trim($("#poll_questions_title_" + id).val()); var score = $.trim($("#poll_question_score_"+ id).val()); + var standard_ans = $.trim($("#poll_question_standard_answer_" + id).val()); if(title.length == 0 || score.length == 0){ - alert("题目标题不能为空"); + alert("题目标题/分数不能为空"); + }else if(standard_ans.length == 0) { + alert("标准答案不能为空"); }else{ doc.parent().parent().parent().submit();} } diff --git a/app/views/exercise/create_exercise_question.js.erb b/app/views/exercise/create_exercise_question.js.erb index 9047cfeda..326a19ec8 100644 --- a/app/views/exercise/create_exercise_question.js.erb +++ b/app/views/exercise/create_exercise_question.js.erb @@ -1,6 +1,8 @@ <% if @is_insert %> $("#poll_content").html('<%= escape_javascript(render :partial => 'exercise_content', :locals => {:exercise => @exercise})%>'); $("#exercise_submit").html("<%= escape_javascript(render :partial => 'exercise_submit', :locals => {:exercise => @exercise}) %>"); + $("#current_score_div").show(); + $("#current_score").html("<%=get_current_score @exercise %>分"); <% else %> $("#new_exercise_question").html('<%= escape_javascript(render :partial => 'new_question', :locals => {:exercise => @exercise}) %>'); $("#new_poll_question").html(""); @@ -35,6 +37,6 @@ "
    " + "
    "); <% end %> -$("#current_score").html("<%=get_current_score @exercise %>分"); $("#current_score_div").show(); +$("#current_score").html("<%=get_current_score @exercise %>分"); <% end %> diff --git a/app/views/exercise/update_exercise_question.js.erb b/app/views/exercise/update_exercise_question.js.erb index ef9004c06..9e7822cb7 100644 --- a/app/views/exercise/update_exercise_question.js.erb +++ b/app/views/exercise/update_exercise_question.js.erb @@ -16,5 +16,5 @@ $("#poll_questions_<%= @exercise_question.id%>").html("
    {:exercise_question => @exercise_question}) %>" + "<% end%>" + "
    "); -$("#current_score").html("<%=get_current_score @exercise %>分"); +$("#current_score").html("<%=get_current_score @exercise_question.exercise %>分"); $("#exercise_submit").html("<%= escape_javascript(render :partial => 'exercise_submit', :locals => {:exercise => @exercise_question.exercise}) %>"); From 8b29002a0fdf30058186869621b7e0bdbc69920b Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 20 Nov 2015 20:02:57 +0800 Subject: [PATCH 127/143] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=BE=97=E5=88=86?= =?UTF-8?q?=E8=A7=84=E5=88=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/exercise_controller.rb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/app/controllers/exercise_controller.rb b/app/controllers/exercise_controller.rb index 28f532db6..c15d5ad23 100644 --- a/app/controllers/exercise_controller.rb +++ b/app/controllers/exercise_controller.rb @@ -21,6 +21,10 @@ class ExerciseController < ApplicationController end def show + unless User.current.member_of_course?(@course) + render_403 + return + end @exercise = Exercise.find params[:id] @is_teacher = User.current.allowed_to?(:as_teacher,@course) || User.current.admin? if @exercise.exercise_status != 2 && (!User.current.allowed_to?(:as_teacher,@course) || User.current.admin?) @@ -485,16 +489,16 @@ class ExerciseController < ApplicationController # 问答题有多个答案 if question.question_type == 3 if standard_answer.include?(answer.first.answer_text) - score1 = score+ question.question_score unless question.question_score.nil? + score1 = score1+ question.question_score unless question.question_score.nil? end elsif question.question_type == 1 if answer.first.exercise_choice.choice_position == standard_answer.exercise_choice_id - score2 = score + question.question_score unless question.question_score.nil? + score2 = score2 + question.question_score unless question.question_score.nil? end else arr = get_mulscore(question, user) if arr.to_i == standard_answer.exercise_choice_id - score3 = score + question.question_score unless question.question_score.nil? + score3 = score3 + question.question_score unless question.question_score.nil? end # ecs = ExerciseAnswer.where("user_id =? and exercise_question_id =?", user.id, question.id) # arr = [] From cc19c345e1a629a26f6789f7dd38085e499fa036 Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 20 Nov 2015 20:23:02 +0800 Subject: [PATCH 128/143] =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/exercise/_exercise_form.html.erb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/views/exercise/_exercise_form.html.erb b/app/views/exercise/_exercise_form.html.erb index 29ccc685d..0d6b8602d 100644 --- a/app/views/exercise/_exercise_form.html.erb +++ b/app/views/exercise/_exercise_form.html.erb @@ -87,9 +87,9 @@ var standard_ans = $.trim($("#question_standard_ans").val()); if(title.length == 0 || score.length == 0){ alert("题目标题/分数不能为空"); - }else if(standard_ans.length == 0) { + }/*else if(standard_ans.length == 0) { alert("标准答案不能为空"); - }else{ + }*/else{ doc.parent().parent().parent().submit();} } //修改标题时确定按钮 @@ -100,9 +100,9 @@ var standard_ans = $.trim($("#poll_question_standard_answer_" + id).val()); if(title.length == 0 || score.length == 0){ alert("题目标题/分数不能为空"); - }else if(standard_ans.length == 0) { + }/*else if(standard_ans.length == 0) { alert("标准答案不能为空"); - }else{ + }*/else{ doc.parent().parent().parent().submit();} } From b10fbcde8c2b3c8fb735d5648a60005462472223 Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 20 Nov 2015 20:44:27 +0800 Subject: [PATCH 129/143] =?UTF-8?q?=E5=8F=96=E6=B6=88=E5=8F=91=E5=B8=83?= =?UTF-8?q?=E5=92=8C=E5=8F=91=E5=B8=83=E6=B5=8B=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/exercise_controller.rb | 7 ++++++- app/views/exercise/_edit_MC.html.erb | 2 +- app/views/exercise/_edit_MCQ.html.erb | 2 +- app/views/exercise/_edit_single.html.erb | 2 +- app/views/exercise/_exercise_form.html.erb | 12 ++++++------ app/views/exercise/_exercises_list.html.erb | 2 +- app/views/exercise/_new_MC.html.erb | 2 +- app/views/exercise/_new_MCQ.html.erb | 2 +- app/views/exercise/_new_single.html.erb | 2 +- app/views/exercise/_show_MC.html.erb | 2 +- app/views/exercise/_show_MCQ.html.erb | 2 +- app/views/exercise/_show_single.html.erb | 2 +- app/views/exercise/index.html.erb | 2 +- app/views/exercise/republish_exercise.js.erb | 2 +- 14 files changed, 24 insertions(+), 19 deletions(-) diff --git a/app/controllers/exercise_controller.rb b/app/controllers/exercise_controller.rb index c8e5bf27c..d53dc067c 100644 --- a/app/controllers/exercise_controller.rb +++ b/app/controllers/exercise_controller.rb @@ -299,16 +299,21 @@ class ExerciseController < ApplicationController # 发布试卷 def publish_exercise + @is_teacher = User.current.allowed_to?(:as_teacher,@course) @exercise.exercise_status = 2 @exercise.publish_time = Time.now if @exercise.save - redirect_to exercise_index_url(:course_id=> @course.id) + #redirect_to exercise_index_url(:course_id=> @course.id) + respond_to do |format| + format.js + end end end # 重新发布试卷 # 重新发布的时候会删除所有的答题 def republish_exercise + @is_teacher = User.current.allowed_to?(:as_teacher,@course) @exercise.exercise_questions.each do |exercise_question| exercise_question.exercise_answers.destroy_all end diff --git a/app/views/exercise/_edit_MC.html.erb b/app/views/exercise/_edit_MC.html.erb index a1c8aa8b1..008c95c24 100644 --- a/app/views/exercise/_edit_MC.html.erb +++ b/app/views/exercise/_edit_MC.html.erb @@ -50,7 +50,7 @@
    diff --git a/app/views/exercise/_new_single.html.erb b/app/views/exercise/_new_single.html.erb index 1ee79e198..08b31087a 100644 --- a/app/views/exercise/_new_single.html.erb +++ b/app/views/exercise/_new_single.html.erb @@ -40,7 +40,7 @@
    diff --git a/app/views/exercise/_show_MC.html.erb b/app/views/exercise/_show_MC.html.erb index b932eac1e..5c214165a 100644 --- a/app/views/exercise/_show_MC.html.erb +++ b/app/views/exercise/_show_MC.html.erb @@ -90,7 +90,7 @@ ''+ '
    '+ ''+ ''+ ' diff --git a/app/views/exercise/_exercise_student_result.html.erb b/app/views/exercise/_exercise_student_result.html.erb index 32cb556b3..b9306b0d2 100644 --- a/app/views/exercise/_exercise_student_result.html.erb +++ b/app/views/exercise/_exercise_student_result.html.erb @@ -46,7 +46,7 @@ diff --git a/app/views/exercise/_new_question.html.erb b/app/views/exercise/_new_question.html.erb index 6148c9bb9..faadb08a9 100644 --- a/app/views/exercise/_new_question.html.erb +++ b/app/views/exercise/_new_question.html.erb @@ -8,7 +8,9 @@ \ No newline at end of file diff --git a/app/views/student_work/create.js.erb b/app/views/student_work/create.js.erb index 42b1db8b8..afd8617aa 100644 --- a/app/views/student_work/create.js.erb +++ b/app/views/student_work/create.js.erb @@ -1,4 +1,12 @@ -<% if @submit_result%> +<% if @has_commit %> + $('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/has_commit_work') %>'); + showModal('ajax-modal', '500px'); + $('#ajax-modal').siblings().remove(); + $('#ajax-modal').before("" + + ""); + $('#ajax-modal').parent().css("top","").css("left",""); + $('#ajax-modal').parent().addClass("anonymos"); +<% elsif @submit_result%> $('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/work_information') %>'); showModal('ajax-modal', '500px'); $('#ajax-modal').siblings().remove(); From c6b5abba4ef7ea29220101a9fc3d6a8e57397161 Mon Sep 17 00:00:00 2001 From: houxiang Date: Fri, 27 Nov 2015 10:10:59 +0800 Subject: [PATCH 143/143] hide the the count of project'repo --- .../projects/_development_group.html.erb | 2 +- config/configuration.yml | 2 +- config/initializers/gitlab_config.rb | 4 +- db/schema.rb | 5446 ++++++----------- 4 files changed, 1873 insertions(+), 3581 deletions(-) diff --git a/app/views/projects/_development_group.html.erb b/app/views/projects/_development_group.html.erb index ec8562885..83b65fe90 100644 --- a/app/views/projects/_development_group.html.erb +++ b/app/views/projects/_development_group.html.erb @@ -47,7 +47,7 @@ <% else %> <%= link_to l(:project_module_repository),({:controller => 'repositories', :action => 'show', :id => @project, :repository_id => gitlab_repository(@project).identifier}), :class => "f14 c_blue02" %> <% end %> - (<%= @project.repositories.count %>) + <% if (User.current.admin? || User.current.allowed_to?({:controller => 'projects', :action => 'settings'}, @project)) && rep_is_gitlab?(@project) %> <%= link_to "+"+l(:project_gitlab_create_repository), url_for(:controller => 'projects', :action => 'settings', :id => @project.id, :tab=>'repositories') , :class => "subnav_green" %> <% end %> diff --git a/config/configuration.yml b/config/configuration.yml index 7c62e8988..3790045aa 100644 --- a/config/configuration.yml +++ b/config/configuration.yml @@ -201,7 +201,7 @@ default: judge_server: 'http://judge.trustie.net/' # Git's url - gitlab_address: 'http://git.trustie.net' + gitlab_address: 'http://gitfast.trustie.net' # specific configuration options for production environment # that overrides the default ones diff --git a/config/initializers/gitlab_config.rb b/config/initializers/gitlab_config.rb index 6e015d4b8..c82b2edff 100644 --- a/config/initializers/gitlab_config.rb +++ b/config/initializers/gitlab_config.rb @@ -1,8 +1,8 @@ Gitlab.configure do |config| # config.endpoint = 'http://192.168.41.130:3000/trustie/api/v3' # API endpoint URL, default: ENV['GITLAB_API_ENDPOINT'] # config.private_token = 'cK15gUDwvt8EEkzwQ_63' # user's private token, default: ENV['GITLAB_API_PRIVATE_TOKEN'] - config.endpoint = 'http://git.trustie.net/api/v3' # API endpoint URL, default: ENV['GITLAB_API_ENDPOINT'] - config.private_token = 'kZUYYbAY12QSQ2Tx1zes' # user's private token, default: ENV['GITLAB_API_PRIVATE_TOKEN'] + config.endpoint = 'http://gitfast.trustie.net/api/v3' # API endpoint URL, default: ENV['GITLAB_API_ENDPOINT'] + config.private_token = 'fPc_gBmEiSANve8TCfxW' # user's private token, default: ENV['GITLAB_API_PRIVATE_TOKEN'] # Optional # config.user_agent = 'Custom User Agent' # user agent, default: 'Gitlab Ruby Gem [version]' # config.sudo = 'user' # username for sudo mode, default: nil diff --git a/db/schema.rb b/db/schema.rb index 55f58ea39..e77265f2f 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1,3577 +1,1869 @@ -# encoding: UTF-8 -# This file is auto-generated from the current state of the database. Instead -# of editing this file, please use the migrations feature of Active Record to -# incrementally modify your database, and then regenerate this schema definition. -# -# Note that this schema.rb definition is the authoritative source for your -# database schema. If you need to create the application database on another -# system, you should be using db:schema:load, not running all the migrations -# from scratch. The latter is a flawed and unsustainable approach (the more migrations -# you'll amass, the slower it'll run and the greater likelihood for issues). -# -# It's strongly recommended to check this file into your version control system. - -ActiveRecord::Schema.define(:version => 20151102090519) do - - create_table "activities", :force => true do |t| - t.integer "act_id", :null => false - t.string "act_type", :null => false - t.integer "user_id", :null => false - t.integer "activity_container_id" - t.string "activity_container_type", :default => "" - t.datetime "created_at" - end - - add_index "activities", ["act_id", "act_type"], :name => "index_activities_on_act_id_and_act_type" - add_index "activities", ["user_id", "act_type"], :name => "index_activities_on_user_id_and_act_type" - add_index "activities", ["user_id"], :name => "index_activities_on_user_id" - - create_table "activity_notifies", :force => true do |t| - t.integer "activity_container_id" - t.string "activity_container_type" - t.integer "activity_id" - t.string "activity_type" - t.integer "notify_to" - t.datetime "created_on" - t.integer "is_read" - end - - add_index "activity_notifies", ["activity_container_id", "activity_container_type"], :name => "index_an_activity_container_id" - add_index "activity_notifies", ["created_on"], :name => "index_an_created_on" - add_index "activity_notifies", ["notify_to"], :name => "index_an_notify_to" - - create_table "api_keys", :force => true do |t| - t.string "access_token" - t.datetime "expires_at" - t.integer "user_id" - t.boolean "active", :default => true - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - add_index "api_keys", ["access_token"], :name => "index_api_keys_on_access_token" - add_index "api_keys", ["user_id"], :name => "index_api_keys_on_user_id" - - create_table "applied_projects", :force => true do |t| - t.integer "project_id", :null => false - t.integer "user_id", :null => false - end - - create_table "apply_project_masters", :force => true do |t| - t.integer "user_id" - t.string "apply_type" - t.integer "apply_id" - t.integer "status" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "attachments", :force => true do |t| - t.integer "container_id" - t.string "container_type", :limit => 30 - t.string "filename", :default => "", :null => false - t.string "disk_filename", :default => "", :null => false - t.integer "filesize", :default => 0, :null => false - t.string "content_type", :default => "" - t.string "digest", :limit => 40, :default => "", :null => false - t.integer "downloads", :default => 0, :null => false - t.integer "author_id", :default => 0, :null => false - t.datetime "created_on" - t.string "description" - t.string "disk_directory" - t.integer "attachtype", :default => 1 - t.integer "is_public", :default => 1 - t.integer "copy_from" - t.integer "quotes" - end - - add_index "attachments", ["author_id"], :name => "index_attachments_on_author_id" - add_index "attachments", ["container_id", "container_type"], :name => "index_attachments_on_container_id_and_container_type" - add_index "attachments", ["created_on"], :name => "index_attachments_on_created_on" - - create_table "attachmentstypes", :force => true do |t| - t.integer "typeId", :null => false - t.string "typeName", :limit => 50 - end - - create_table "auth_sources", :force => true do |t| - t.string "type", :limit => 30, :default => "", :null => false - t.string "name", :limit => 60, :default => "", :null => false - t.string "host", :limit => 60 - t.integer "port" - t.string "account" - t.string "account_password", :default => "" - t.string "base_dn" - t.string "attr_login", :limit => 30 - t.string "attr_firstname", :limit => 30 - t.string "attr_lastname", :limit => 30 - t.string "attr_mail", :limit => 30 - t.boolean "onthefly_register", :default => false, :null => false - t.boolean "tls", :default => false, :null => false - t.string "filter" - t.integer "timeout" - end - - add_index "auth_sources", ["id", "type"], :name => "index_auth_sources_on_id_and_type" - - create_table "biding_projects", :force => true do |t| - t.integer "project_id" - t.integer "bid_id" - t.integer "user_id" - t.string "description" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "reward" - end - - create_table "bids", :force => true do |t| - t.string "name" - t.string "budget", :null => false - t.integer "author_id" - t.date "deadline" - t.text "description" - t.datetime "created_on", :null => false - t.datetime "updated_on", :null => false - t.integer "commit" - t.integer "reward_type" - t.integer "homework_type" - t.integer "parent_id" - t.string "password" - t.integer "is_evaluation" - t.integer "proportion", :default => 60 - t.integer "comment_status", :default => 0 - t.integer "evaluation_num", :default => 3 - t.integer "open_anonymous_evaluation", :default => 1 - end - - create_table "blog_comments", :force => true do |t| - t.integer "blog_id", :null => false - t.integer "parent_id" - t.string "title", :default => "", :null => false - t.text "content" - t.integer "author_id" - t.integer "comments_count", :default => 0, :null => false - t.integer "last_comment_id" - t.datetime "created_on", :null => false - t.datetime "updated_on", :null => false - t.boolean "locked", :default => false - t.integer "sticky", :default => 0 - t.integer "reply_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "blogs", :force => true do |t| - t.string "name", :default => "", :null => false - t.text "description" - t.integer "position", :default => 1 - t.integer "article_count", :default => 0, :null => false - t.integer "comments_count", :default => 0, :null => false - t.integer "last_comments_id" - t.integer "parent_id" - t.integer "author_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "boards", :force => true do |t| - t.integer "project_id", :null => false - t.string "name", :default => "", :null => false - t.string "description" - t.integer "position", :default => 1 - t.integer "topics_count", :default => 0, :null => false - t.integer "messages_count", :default => 0, :null => false - t.integer "last_message_id" - t.integer "parent_id" - t.integer "course_id" - end - - add_index "boards", ["last_message_id"], :name => "index_boards_on_last_message_id" - add_index "boards", ["project_id"], :name => "boards_project_id" - - create_table "bug_to_osps", :force => true do |t| - t.integer "osp_id" - t.integer "relative_memo_id" - t.string "description" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "changes", :force => true do |t| - t.integer "changeset_id", :null => false - t.string "action", :limit => 1, :default => "", :null => false - t.text "path", :null => false - t.text "from_path" - t.string "from_revision" - t.string "revision" - t.string "branch" - end - - add_index "changes", ["changeset_id"], :name => "changesets_changeset_id" - - create_table "changeset_parents", :id => false, :force => true do |t| - t.integer "changeset_id", :null => false - t.integer "parent_id", :null => false - end - - add_index "changeset_parents", ["changeset_id"], :name => "changeset_parents_changeset_ids" - add_index "changeset_parents", ["parent_id"], :name => "changeset_parents_parent_ids" - - create_table "changesets", :force => true do |t| - t.integer "repository_id", :null => false - t.string "revision", :null => false - t.string "committer" - t.datetime "committed_on", :null => false - t.text "comments" - t.date "commit_date" - t.string "scmid" - t.integer "user_id" - end - - add_index "changesets", ["committed_on"], :name => "index_changesets_on_committed_on" - add_index "changesets", ["repository_id", "revision"], :name => "changesets_repos_rev", :unique => true - add_index "changesets", ["repository_id", "scmid"], :name => "changesets_repos_scmid" - add_index "changesets", ["repository_id"], :name => "index_changesets_on_repository_id" - add_index "changesets", ["user_id"], :name => "index_changesets_on_user_id" - - create_table "changesets_issues", :id => false, :force => true do |t| - t.integer "changeset_id", :null => false - t.integer "issue_id", :null => false - end - - 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 - t.integer "author_id", :default => 0, :null => false - t.text "comments" - t.datetime "created_on", :null => false - t.datetime "updated_on", :null => false - end - - add_index "comments", ["author_id"], :name => "index_comments_on_author_id" - add_index "comments", ["commented_id", "commented_type"], :name => "index_comments_on_commented_id_and_commented_type" - - create_table "contest_notifications", :force => true do |t| - t.text "title" - t.text "content" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "contesting_projects", :force => true do |t| - t.integer "project_id" - t.string "contest_id" - t.integer "user_id" - t.string "description" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "reward" - end - - create_table "contesting_softapplications", :force => true do |t| - t.integer "softapplication_id" - t.integer "contest_id" - t.integer "user_id" - t.string "description" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "reward" - end - - create_table "contestnotifications", :force => true do |t| - t.integer "contest_id" - t.string "title" - t.string "summary" - t.text "description" - t.integer "author_id" - t.integer "notificationcomments_count" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "contests", :force => true do |t| - t.string "name" - t.string "budget", :default => "" - t.integer "author_id" - t.date "deadline" - t.string "description" - t.integer "commit" - t.string "password" - t.datetime "created_on", :null => false - t.datetime "updated_on", :null => false - end - - create_table "course_activities", :force => true do |t| - t.integer "user_id" - t.integer "course_id" - t.integer "course_act_id" - t.string "course_act_type" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "course_attachments", :force => true do |t| - t.string "filename" - t.string "disk_filename" - t.integer "filesize" - t.string "content_type" - t.string "digest" - t.integer "downloads" - t.string "author_id" - t.string "integer" - t.string "description" - t.string "disk_directory" - t.integer "attachtype" - t.integer "is_public" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "container_id", :default => 0 - end - - create_table "course_groups", :force => true do |t| - t.string "name" - t.integer "course_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "course_infos", :force => true do |t| - t.integer "course_id" - t.integer "user_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "course_messages", :force => true do |t| - t.integer "user_id" - t.integer "course_id" - t.integer "course_message_id" - t.string "course_message_type" - t.integer "viewed" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "content" - t.integer "status" - end - - create_table "course_statuses", :force => true do |t| - t.integer "changesets_count" - t.integer "watchers_count" - t.integer "course_id" - t.float "grade", :default => 0.0 - t.integer "course_ac_para", :default => 0 - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "courses", :force => true do |t| - t.integer "tea_id" - t.string "name" - t.integer "state" - t.string "code" - t.integer "time" - t.string "extra" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "location" - t.string "term" - t.string "string" - t.string "password" - t.string "setup_time" - t.string "endup_time" - t.string "class_period" - t.integer "school_id" - t.text "description" - 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 - end - - create_table "custom_fields", :force => true do |t| - t.string "type", :limit => 30, :default => "", :null => false - t.string "name", :limit => 30, :default => "", :null => false - t.string "field_format", :limit => 30, :default => "", :null => false - t.text "possible_values" - t.string "regexp", :default => "" - t.integer "min_length", :default => 0, :null => false - t.integer "max_length", :default => 0, :null => false - t.boolean "is_required", :default => false, :null => false - t.boolean "is_for_all", :default => false, :null => false - t.boolean "is_filter", :default => false, :null => false - t.integer "position", :default => 1 - t.boolean "searchable", :default => false - t.text "default_value" - t.boolean "editable", :default => true - t.boolean "visible", :default => true, :null => false - t.boolean "multiple", :default => false - end - - add_index "custom_fields", ["id", "type"], :name => "index_custom_fields_on_id_and_type" - - create_table "custom_fields_projects", :id => false, :force => true do |t| - t.integer "custom_field_id", :default => 0, :null => false - t.integer "project_id", :default => 0, :null => false - end - - add_index "custom_fields_projects", ["custom_field_id", "project_id"], :name => "index_custom_fields_projects_on_custom_field_id_and_project_id", :unique => true - - create_table "custom_fields_trackers", :id => false, :force => true do |t| - t.integer "custom_field_id", :default => 0, :null => false - t.integer "tracker_id", :default => 0, :null => false - end - - add_index "custom_fields_trackers", ["custom_field_id", "tracker_id"], :name => "index_custom_fields_trackers_on_custom_field_id_and_tracker_id", :unique => true - - create_table "custom_values", :force => true do |t| - t.string "customized_type", :limit => 30, :default => "", :null => false - t.integer "customized_id", :default => 0, :null => false - t.integer "custom_field_id", :default => 0, :null => false - t.text "value" - end - - add_index "custom_values", ["custom_field_id"], :name => "index_custom_values_on_custom_field_id" - add_index "custom_values", ["customized_type", "customized_id"], :name => "custom_values_customized" - - create_table "delayed_jobs", :force => true do |t| - t.integer "priority", :default => 0, :null => false - t.integer "attempts", :default => 0, :null => false - t.text "handler", :null => false - t.text "last_error" - t.datetime "run_at" - t.datetime "locked_at" - t.datetime "failed_at" - t.string "locked_by" - t.string "queue" - t.datetime "created_at" - t.datetime "updated_at" - end - - 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 - t.string "title", :limit => 60, :default => "", :null => false - t.text "description" - t.datetime "created_on" - t.integer "user_id", :default => 0 - t.integer "is_public", :default => 1 - end - - add_index "documents", ["category_id"], :name => "index_documents_on_category_id" - 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 - t.string "Description" - t.text "PreConditions", :limit => 2147483647 - t.text "TraceInfo", :limit => 2147483647 - t.text "Code", :limit => 2147483647 - t.integer "project_id" - t.datetime "created_at" - t.datetime "updated_at" - t.integer "id", :null => false - end - - create_table "enabled_modules", :force => true do |t| - t.integer "project_id" - t.string "name", :null => false - t.integer "course_id" - end - - add_index "enabled_modules", ["project_id"], :name => "enabled_modules_project_id" - - create_table "enumerations", :force => true do |t| - t.string "name", :limit => 30, :default => "", :null => false - t.integer "position", :default => 1 - t.boolean "is_default", :default => false, :null => false - t.string "type" - t.boolean "active", :default => true, :null => false - t.integer "project_id" - t.integer "parent_id" - t.string "position_name", :limit => 30 - end - - add_index "enumerations", ["id", "type"], :name => "index_enumerations_on_id_and_type" - add_index "enumerations", ["project_id"], :name => "index_enumerations_on_project_id" - - create_table "first_pages", :force => true do |t| - t.string "web_title" - t.string "title" - t.text "description" - t.string "page_type" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "sort_type" - t.integer "image_width", :default => 107 - t.integer "image_height", :default => 63 - t.integer "show_course", :default => 1 - t.integer "show_contest", :default => 1 - end - - create_table "forge_activities", :force => true do |t| - t.integer "user_id" - t.integer "project_id" - t.integer "forge_act_id" - t.string "forge_act_type" - t.integer "org_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - add_index "forge_activities", ["forge_act_id"], :name => "index_forge_activities_on_forge_act_id" - - create_table "forge_messages", :force => true do |t| - t.integer "user_id" - t.integer "project_id" - t.integer "forge_message_id" - t.string "forge_message_type" - t.integer "viewed" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "secret_key" - t.integer "status" - end - - create_table "forums", :force => true do |t| - t.string "name", :null => false - t.text "description" - t.integer "topic_count", :default => 0 - t.integer "memo_count", :default => 0 - t.integer "last_memo_id", :default => 0 - t.integer "creator_id", :null => false - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "sticky" - t.integer "locked" - end - - create_table "groups_users", :id => false, :force => true do |t| - t.integer "group_id", :null => false - t.integer "user_id", :null => false - end - - add_index "groups_users", ["group_id", "user_id"], :name => "groups_users_ids", :unique => true - - 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.string "reward" - t.string "name" - t.text "description" - t.integer "state" - t.integer "project_id", :default => 0 - t.float "score", :default => 0.0 - t.integer "is_teacher_score", :default => 0 - end - - add_index "homework_attaches", ["bid_id"], :name => "index_homework_attaches_on_bid_id" - - create_table "homework_commons", :force => true do |t| - t.string "name" - t.integer "user_id" - t.text "description" - t.date "publish_time" - t.date "end_time" - t.integer "homework_type", :default => 1 - t.string "late_penalty" - t.integer "course_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "teacher_priority", :default => 1 - t.integer "anonymous_comment", :default => 0 - end - - create_table "homework_detail_manuals", :force => true do |t| - t.float "ta_proportion" - t.integer "comment_status" - t.date "evaluation_start" - t.date "evaluation_end" - t.integer "evaluation_num" - t.integer "absence_penalty", :default => 1 - t.integer "homework_common_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "homework_detail_programings", :force => true do |t| - t.string "language" - t.text "standard_code", :limit => 2147483647 - t.integer "homework_common_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.float "ta_proportion", :default => 0.1 - t.integer "question_id" - end - - create_table "homework_evaluations", :force => true do |t| - t.string "user_id" - t.string "homework_attach_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "homework_for_courses", :force => true do |t| - t.integer "course_id" - t.integer "bid_id" - end - - add_index "homework_for_courses", ["bid_id"], :name => "index_homework_for_courses_on_bid_id" - add_index "homework_for_courses", ["course_id"], :name => "index_homework_for_courses_on_course_id" - - create_table "homework_tests", :force => true do |t| - t.text "input" - t.text "output" - t.integer "homework_common_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "result" - t.text "error_msg" - end - - create_table "homework_users", :force => true do |t| - t.string "homework_attach_id" - t.string "user_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "invite_lists", :force => true do |t| - t.integer "project_id" - t.integer "user_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "mail" - end - - create_table "issue_categories", :force => true do |t| - t.integer "project_id", :default => 0, :null => false - t.string "name", :limit => 30, :default => "", :null => false - t.integer "assigned_to_id" - end - - add_index "issue_categories", ["assigned_to_id"], :name => "index_issue_categories_on_assigned_to_id" - add_index "issue_categories", ["project_id"], :name => "issue_categories_project_id" - - create_table "issue_relations", :force => true do |t| - t.integer "issue_from_id", :null => false - t.integer "issue_to_id", :null => false - t.string "relation_type", :default => "", :null => false - t.integer "delay" - end - - add_index "issue_relations", ["issue_from_id", "issue_to_id"], :name => "index_issue_relations_on_issue_from_id_and_issue_to_id", :unique => true - add_index "issue_relations", ["issue_from_id"], :name => "index_issue_relations_on_issue_from_id" - add_index "issue_relations", ["issue_to_id"], :name => "index_issue_relations_on_issue_to_id" - - create_table "issue_statuses", :force => true do |t| - t.string "name", :limit => 30, :default => "", :null => false - t.boolean "is_closed", :default => false, :null => false - t.boolean "is_default", :default => false, :null => false - t.integer "position", :default => 1 - t.integer "default_done_ratio" - end - - add_index "issue_statuses", ["is_closed"], :name => "index_issue_statuses_on_is_closed" - add_index "issue_statuses", ["is_default"], :name => "index_issue_statuses_on_is_default" - add_index "issue_statuses", ["position"], :name => "index_issue_statuses_on_position" - - create_table "issues", :force => true do |t| - t.integer "tracker_id", :null => false - t.integer "project_id", :null => false - t.string "subject", :default => "", :null => false - t.text "description" - t.date "due_date" - t.integer "category_id" - t.integer "status_id", :null => false - t.integer "assigned_to_id" - t.integer "priority_id", :null => false - t.integer "fixed_version_id" - t.integer "author_id", :null => false - t.integer "lock_version", :default => 0, :null => false - t.datetime "created_on" - t.datetime "updated_on" - t.date "start_date" - t.integer "done_ratio", :default => 0, :null => false - t.float "estimated_hours" - t.integer "parent_id" - t.integer "root_id" - t.integer "lft" - t.integer "rgt" - t.boolean "is_private", :default => false, :null => false - t.datetime "closed_on" - t.integer "project_issues_index" - end - - add_index "issues", ["assigned_to_id"], :name => "index_issues_on_assigned_to_id" - add_index "issues", ["author_id"], :name => "index_issues_on_author_id" - add_index "issues", ["category_id"], :name => "index_issues_on_category_id" - add_index "issues", ["created_on"], :name => "index_issues_on_created_on" - add_index "issues", ["fixed_version_id"], :name => "index_issues_on_fixed_version_id" - add_index "issues", ["priority_id"], :name => "index_issues_on_priority_id" - add_index "issues", ["project_id"], :name => "issues_project_id" - add_index "issues", ["root_id", "lft", "rgt"], :name => "index_issues_on_root_id_and_lft_and_rgt" - add_index "issues", ["status_id"], :name => "index_issues_on_status_id" - add_index "issues", ["tracker_id"], :name => "index_issues_on_tracker_id" - - create_table "join_in_competitions", :force => true do |t| - t.integer "user_id" - t.integer "competition_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "join_in_contests", :force => true do |t| - t.integer "user_id" - t.integer "bid_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "journal_details", :force => true do |t| - t.integer "journal_id", :default => 0, :null => false - t.string "property", :limit => 30, :default => "", :null => false - t.string "prop_key", :limit => 30, :default => "", :null => false - t.text "old_value" - t.text "value" - end - - add_index "journal_details", ["journal_id"], :name => "journal_details_journal_id" - - create_table "journal_replies", :id => false, :force => true do |t| - t.integer "journal_id" - t.integer "user_id" - t.integer "reply_id" - end - - add_index "journal_replies", ["journal_id"], :name => "index_journal_replies_on_journal_id" - add_index "journal_replies", ["reply_id"], :name => "index_journal_replies_on_reply_id" - add_index "journal_replies", ["user_id"], :name => "index_journal_replies_on_user_id" - - create_table "journals", :force => true do |t| - t.integer "journalized_id", :default => 0, :null => false - t.string "journalized_type", :limit => 30, :default => "", :null => false - t.integer "user_id", :default => 0, :null => false - t.text "notes" - t.datetime "created_on", :null => false - t.boolean "private_notes", :default => false, :null => false - end - - add_index "journals", ["created_on"], :name => "index_journals_on_created_on" - add_index "journals", ["journalized_id", "journalized_type"], :name => "journals_journalized_id" - add_index "journals", ["journalized_id"], :name => "index_journals_on_journalized_id" - add_index "journals", ["user_id"], :name => "index_journals_on_user_id" - - create_table "journals_for_messages", :force => true do |t| - t.integer "jour_id" - t.string "jour_type" - t.integer "user_id" - t.text "notes" - t.integer "status" - t.integer "reply_id" - t.datetime "created_on", :null => false - t.datetime "updated_on", :null => false - t.string "m_parent_id" - t.boolean "is_readed" - t.integer "m_reply_count" - t.integer "m_reply_id" - t.integer "is_comprehensive_evaluation" - end - - create_table "kindeditor_assets", :force => true do |t| - t.string "asset" - t.integer "file_size" - t.string "file_type" - t.integer "owner_id" - t.string "asset_type" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "owner_type", :default => 0 - end - - create_table "member_roles", :force => true do |t| - t.integer "member_id", :null => false - t.integer "role_id", :null => false - t.integer "inherited_from" - end - - add_index "member_roles", ["member_id"], :name => "index_member_roles_on_member_id" - add_index "member_roles", ["role_id"], :name => "index_member_roles_on_role_id" - - create_table "members", :force => true do |t| - t.integer "user_id", :default => 0, :null => false - t.integer "project_id", :default => 0 - t.datetime "created_on" - t.boolean "mail_notification", :default => false, :null => false - t.integer "course_id", :default => -1 - t.integer "course_group_id", :default => 0 - end - - add_index "members", ["project_id"], :name => "index_members_on_project_id" - add_index "members", ["user_id", "project_id", "course_id"], :name => "index_members_on_user_id_and_project_id", :unique => true - add_index "members", ["user_id"], :name => "index_members_on_user_id" - - create_table "memo_messages", :force => true do |t| - t.integer "user_id" - t.integer "forum_id" - t.integer "memo_id" - t.string "memo_type" - t.integer "viewed" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "memos", :force => true do |t| - t.integer "forum_id", :null => false - t.integer "parent_id" - t.string "subject", :null => false - t.text "content", :null => false - t.integer "author_id", :null => false - t.integer "replies_count", :default => 0 - t.integer "last_reply_id" - t.boolean "lock", :default => false - t.boolean "sticky", :default => false - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "viewed_count", :default => 0 - end - - create_table "message_alls", :force => true do |t| - t.integer "user_id" - t.integer "message_id" - t.string "message_type" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "messages", :force => true do |t| - t.integer "board_id", :null => false - t.integer "parent_id" - t.string "subject", :default => "", :null => false - t.text "content" - t.integer "author_id" - t.integer "replies_count", :default => 0, :null => false - t.integer "last_reply_id" - t.datetime "created_on", :null => false - t.datetime "updated_on", :null => false - t.boolean "locked", :default => false - t.integer "sticky", :default => 0 - t.integer "reply_id" - end - - add_index "messages", ["author_id"], :name => "index_messages_on_author_id" - add_index "messages", ["board_id"], :name => "messages_board_id" - add_index "messages", ["created_on"], :name => "index_messages_on_created_on" - add_index "messages", ["last_reply_id"], :name => "index_messages_on_last_reply_id" - add_index "messages", ["parent_id"], :name => "messages_parent_id" - - create_table "news", :force => true do |t| - t.integer "project_id" - t.string "title", :limit => 60, :default => "", :null => false - t.string "summary", :default => "" - t.text "description" - t.integer "author_id", :default => 0, :null => false - t.datetime "created_on" - t.integer "comments_count", :default => 0, :null => false - t.integer "course_id" - end - - add_index "news", ["author_id"], :name => "index_news_on_author_id" - add_index "news", ["created_on"], :name => "index_news_on_created_on" - add_index "news", ["project_id"], :name => "news_project_id" - - create_table "no_uses", :force => true do |t| - t.integer "user_id", :null => false - t.string "no_use_type" - t.integer "no_use_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "notificationcomments", :force => true do |t| - t.string "notificationcommented_type" - t.integer "notificationcommented_id" - t.integer "author_id" - t.text "notificationcomments" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "onclick_times", :force => true do |t| - t.integer "user_id" - t.datetime "onclick_time" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "open_id_authentication_associations", :force => true do |t| - t.integer "issued" - t.integer "lifetime" - t.string "handle" - t.string "assoc_type" - t.binary "server_url" - t.binary "secret" - end - - create_table "open_id_authentication_nonces", :force => true do |t| - t.integer "timestamp", :null => false - t.string "server_url" - t.string "salt", :null => false - end - - create_table "open_source_projects", :force => true do |t| - t.string "name" - t.text "description" - t.integer "commit_count", :default => 0 - t.integer "code_line", :default => 0 - t.integer "users_count", :default => 0 - t.date "last_commit_time" - t.string "url" - t.date "date_collected" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "option_numbers", :force => true do |t| - t.integer "user_id" - t.integer "memo" - t.integer "messages_for_issues" - t.integer "issues_status" - t.integer "replay_for_message" - t.integer "replay_for_memo" - t.integer "follow" - t.integer "tread" - t.integer "praise_by_one" - t.integer "praise_by_two" - t.integer "praise_by_three" - t.integer "tread_by_one" - t.integer "tread_by_two" - t.integer "tread_by_three" - t.integer "changeset" - t.integer "document" - t.integer "attachment" - t.integer "issue_done_ratio" - t.integer "post_issue" - t.integer "score_type" - t.integer "total_score" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "project_id" - end - - create_table "org_members", :force => true do |t| - t.integer "user_id" - t.integer "organization_id" - t.string "role" - end - - create_table "organizations", :force => true do |t| - t.string "name" - t.text "description" - t.integer "creator_id" - t.integer "home_id" - t.string "domain" - t.boolean "is_public" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "phone_app_versions", :force => true do |t| - t.string "version" - t.text "description" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "poll_answers", :force => true do |t| - t.integer "poll_question_id" - t.text "answer_text" - t.integer "answer_position" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "poll_questions", :force => true do |t| - t.string "question_title" - t.integer "question_type" - t.integer "is_necessary" - t.integer "poll_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "question_number" - end - - create_table "poll_users", :force => true do |t| - t.integer "user_id" - t.integer "poll_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "poll_votes", :force => true do |t| - t.integer "user_id" - t.integer "poll_question_id" - t.integer "poll_answer_id" - t.text "vote_text" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "polls", :force => true do |t| - t.string "polls_name" - t.string "polls_type" - t.integer "polls_group_id" - t.integer "polls_status" - t.integer "user_id" - t.datetime "published_at" - t.datetime "closed_at" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.text "polls_description" - t.integer "show_result", :default => 1 - end - - create_table "praise_tread_caches", :force => true do |t| - t.integer "object_id", :null => false - t.string "object_type" - t.integer "praise_num" - t.integer "tread_num" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "praise_treads", :force => true do |t| - t.integer "user_id", :null => false - t.integer "praise_tread_object_id" - t.string "praise_tread_object_type" - t.integer "praise_or_tread" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "principal_activities", :force => true do |t| - t.integer "user_id" - t.integer "principal_id" - t.integer "principal_act_id" - t.string "principal_act_type" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "project_infos", :force => true do |t| - t.integer "project_id" - t.integer "user_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "project_scores", :force => true do |t| - t.string "project_id" - t.integer "score" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "issue_num", :default => 0 - t.integer "issue_journal_num", :default => 0 - t.integer "news_num", :default => 0 - t.integer "documents_num", :default => 0 - t.integer "changeset_num", :default => 0 - t.integer "board_message_num", :default => 0 - end - - create_table "project_statuses", :force => true do |t| - t.integer "changesets_count" - t.integer "watchers_count" - t.integer "project_id" - t.integer "project_type" - t.float "grade", :default => 0.0 - t.integer "course_ac_para", :default => 0 - end - - add_index "project_statuses", ["grade"], :name => "index_project_statuses_on_grade" - - create_table "projecting_softapplictions", :force => true do |t| - t.integer "user_id" - t.integer "softapplication_id" - t.integer "project_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "projects", :force => true do |t| - t.string "name", :default => "", :null => false - t.text "description" - t.string "homepage", :default => "" - t.boolean "is_public", :default => true, :null => false - t.integer "parent_id" - t.datetime "created_on" - t.datetime "updated_on" - t.string "identifier" - t.integer "status", :default => 1, :null => false - t.integer "lft" - t.integer "rgt" - t.boolean "inherit_members", :default => false, :null => false - t.integer "project_type" - t.boolean "hidden_repo", :default => false, :null => false - t.integer "attachmenttype", :default => 1 - t.integer "user_id" - t.integer "dts_test", :default => 0 - t.string "enterprise_name" - t.integer "organization_id" - t.integer "project_new_type" - t.integer "gpid" - end - - add_index "projects", ["lft"], :name => "index_projects_on_lft" - add_index "projects", ["rgt"], :name => "index_projects_on_rgt" - - create_table "projects_trackers", :id => false, :force => true do |t| - t.integer "project_id", :default => 0, :null => false - t.integer "tracker_id", :default => 0, :null => false - end - - add_index "projects_trackers", ["project_id", "tracker_id"], :name => "projects_trackers_unique", :unique => true - add_index "projects_trackers", ["project_id"], :name => "projects_trackers_project_id" - - create_table "queries", :force => true do |t| - t.integer "project_id" - t.string "name", :default => "", :null => false - t.text "filters" - t.integer "user_id", :default => 0, :null => false - t.boolean "is_public", :default => false, :null => false - t.text "column_names" - t.text "sort_criteria" - t.string "group_by" - t.string "type" - end - - add_index "queries", ["project_id"], :name => "index_queries_on_project_id" - add_index "queries", ["user_id"], :name => "index_queries_on_user_id" - - create_table "relative_memo_to_open_source_projects", :force => true do |t| - t.integer "osp_id" - t.integer "relative_memo_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "relative_memos", :force => true do |t| - t.integer "osp_id" - t.integer "parent_id" - t.string "subject", :null => false - t.text "content", :limit => 16777215, :null => false - t.integer "author_id" - t.integer "replies_count", :default => 0 - t.integer "last_reply_id" - t.boolean "lock", :default => false - t.boolean "sticky", :default => false - t.boolean "is_quote", :default => false - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "viewed_count_crawl", :default => 0 - t.integer "viewed_count_local", :default => 0 - t.string "url" - t.string "username" - t.string "userhomeurl" - t.date "date_collected" - t.string "topic_resource" - end - - create_table "repositories", :force => true do |t| - t.integer "project_id", :default => 0, :null => false - t.string "url", :default => "", :null => false - t.string "login", :limit => 60, :default => "" - t.string "password", :default => "" - t.string "root_url", :default => "" - t.string "type" - t.string "path_encoding", :limit => 64 - t.string "log_encoding", :limit => 64 - t.text "extra_info" - t.string "identifier" - t.boolean "is_default", :default => false - t.boolean "hidden", :default => false - end - - add_index "repositories", ["project_id"], :name => "index_repositories_on_project_id" - - create_table "rich_rich_files", :force => true do |t| - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "rich_file_file_name" - t.string "rich_file_content_type" - t.integer "rich_file_file_size" - t.datetime "rich_file_updated_at" - t.string "owner_type" - t.integer "owner_id" - t.text "uri_cache" - t.string "simplified_type", :default => "file" - end - - create_table "roles", :force => true do |t| - t.string "name", :limit => 30, :default => "", :null => false - t.integer "position", :default => 1 - t.boolean "assignable", :default => true - t.integer "builtin", :default => 0, :null => false - t.text "permissions" - t.string "issues_visibility", :limit => 30, :default => "default", :null => false - end - - create_table "schools", :force => true do |t| - t.string "name" - t.string "province" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "logo_link" - t.string "pinyin" - end - - create_table "seems_rateable_cached_ratings", :force => true do |t| - t.integer "cacheable_id", :limit => 8 - t.string "cacheable_type" - t.float "avg", :null => false - t.integer "cnt", :null => false - t.string "dimension" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "seems_rateable_rates", :force => true do |t| - t.integer "rater_id", :limit => 8 - t.integer "rateable_id" - t.string "rateable_type" - t.float "stars", :null => false - t.string "dimension" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "is_teacher_score", :default => 0 - end - - create_table "settings", :force => true do |t| - t.string "name", :default => "", :null => false - t.text "value" - t.datetime "updated_on" - end - - add_index "settings", ["name"], :name => "index_settings_on_name" - - create_table "shares", :force => true do |t| - t.date "created_on" - t.string "url" - t.string "title" - t.integer "share_type" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "project_id" - t.integer "user_id" - t.string "description" - end - - create_table "softapplications", :force => true do |t| - t.string "name" - t.text "description" - t.integer "app_type_id" - t.string "app_type_name" - t.string "android_min_version_available" - t.integer "user_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "contest_id" - t.integer "softapplication_id" - t.integer "is_public" - t.string "application_developers" - t.string "deposit_project_url" - t.string "deposit_project" - t.integer "project_id" - end - - create_table "student_work_tests", :force => true do |t| - t.integer "student_work_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "status", :default => 9 - t.text "results" - t.text "src" - end - - create_table "student_works", :force => true do |t| - t.string "name" - t.text "description", :limit => 2147483647 - t.integer "homework_common_id" - t.integer "user_id" - t.float "final_score" - t.float "teacher_score" - t.float "student_score" - t.float "teaching_asistant_score" - t.integer "project_id", :default => 0 - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "late_penalty", :default => 0 - t.integer "absence_penalty", :default => 0 - t.float "system_score", :default => 0.0 - t.boolean "is_test", :default => false - end - - create_table "student_works_evaluation_distributions", :force => true do |t| - t.integer "student_work_id" - t.integer "user_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "student_works_scores", :force => true do |t| - t.integer "student_work_id" - t.integer "user_id" - t.integer "score" - t.text "comment" - t.integer "reviewer_role" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "students_for_courses", :force => true do |t| - t.integer "student_id" - t.integer "course_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - add_index "students_for_courses", ["course_id"], :name => "index_students_for_courses_on_course_id" - add_index "students_for_courses", ["student_id"], :name => "index_students_for_courses_on_student_id" - - create_table "system_messages", :force => true do |t| - t.integer "user_id" - t.string "content" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.text "description" - t.string "subject" - end - - create_table "taggings", :force => true do |t| - t.integer "tag_id" - t.integer "taggable_id" - t.string "taggable_type" - t.integer "tagger_id" - t.string "tagger_type" - t.string "context", :limit => 128 - t.datetime "created_at" - end - - add_index "taggings", ["tag_id"], :name => "index_taggings_on_tag_id" - add_index "taggings", ["taggable_id", "taggable_type", "context"], :name => "index_taggings_on_taggable_id_and_taggable_type_and_context" - add_index "taggings", ["taggable_type"], :name => "index_taggings_on_taggable_type" - - create_table "tags", :force => true do |t| - t.string "name" - end - - create_table "teachers", :force => true do |t| - t.string "tea_name" - t.string "location" - t.integer "couurse_time" - t.integer "course_code" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "extra" - end - - create_table "time_entries", :force => true do |t| - t.integer "project_id", :null => false - t.integer "user_id", :null => false - t.integer "issue_id" - t.float "hours", :null => false - t.string "comments" - t.integer "activity_id", :null => false - t.date "spent_on", :null => false - t.integer "tyear", :null => false - t.integer "tmonth", :null => false - t.integer "tweek", :null => false - t.datetime "created_on", :null => false - t.datetime "updated_on", :null => false - end - - add_index "time_entries", ["activity_id"], :name => "index_time_entries_on_activity_id" - add_index "time_entries", ["created_on"], :name => "index_time_entries_on_created_on" - add_index "time_entries", ["issue_id"], :name => "time_entries_issue_id" - add_index "time_entries", ["project_id"], :name => "time_entries_project_id" - add_index "time_entries", ["user_id"], :name => "index_time_entries_on_user_id" - - create_table "tokens", :force => true do |t| - t.integer "user_id", :default => 0, :null => false - t.string "action", :limit => 30, :default => "", :null => false - t.string "value", :limit => 40, :default => "", :null => false - t.datetime "created_on", :null => false - end - - add_index "tokens", ["user_id"], :name => "index_tokens_on_user_id" - add_index "tokens", ["value"], :name => "tokens_value", :unique => true - - create_table "trackers", :force => true do |t| - t.string "name", :limit => 30, :default => "", :null => false - t.boolean "is_in_chlog", :default => false, :null => false - t.integer "position", :default => 1 - t.boolean "is_in_roadmap", :default => true, :null => false - t.integer "fields_bits", :default => 0 - end - - create_table "user_activities", :force => true do |t| - t.string "act_type" - t.integer "act_id" - t.string "container_type" - t.integer "container_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "user_id" - end - - create_table "user_extensions", :force => true do |t| - t.integer "user_id", :null => false - t.date "birthday" - t.string "brief_introduction" - t.integer "gender" - t.string "location" - t.string "occupation" - t.integer "work_experience" - t.integer "zip_code" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "technical_title" - t.integer "identity" - t.string "student_id" - t.string "teacher_realname" - t.string "student_realname" - t.string "location_city" - t.integer "school_id" - t.string "description", :default => "" - end - - create_table "user_feedback_messages", :force => true do |t| - t.integer "user_id" - t.integer "journals_for_message_id" - t.string "journals_for_message_type" - t.integer "viewed" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "user_grades", :force => true do |t| - t.integer "user_id", :null => false - t.integer "project_id", :null => false - t.float "grade", :default => 0.0 - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - add_index "user_grades", ["grade"], :name => "index_user_grades_on_grade" - add_index "user_grades", ["project_id"], :name => "index_user_grades_on_project_id" - add_index "user_grades", ["user_id"], :name => "index_user_grades_on_user_id" - - create_table "user_levels", :force => true do |t| - t.integer "user_id" - t.integer "level" - end - - create_table "user_preferences", :force => true do |t| - t.integer "user_id", :default => 0, :null => false - t.text "others" - t.boolean "hide_mail", :default => false - t.string "time_zone" - end - - add_index "user_preferences", ["user_id"], :name => "index_user_preferences_on_user_id" - - create_table "user_score_details", :force => true do |t| - t.integer "current_user_id" - t.integer "target_user_id" - t.string "score_type" - t.string "score_action" - t.integer "user_id" - t.integer "old_score" - t.integer "new_score" - t.integer "current_user_level" - t.integer "target_user_level" - t.integer "score_changeable_obj_id" - t.string "score_changeable_obj_type" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - 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 - end - - create_table "user_statuses", :force => true do |t| - t.integer "changesets_count" - t.integer "watchers_count" - t.integer "user_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.float "grade", :default => 0.0 - end - - add_index "user_statuses", ["changesets_count"], :name => "index_user_statuses_on_changesets_count" - add_index "user_statuses", ["grade"], :name => "index_user_statuses_on_grade" - add_index "user_statuses", ["watchers_count"], :name => "index_user_statuses_on_watchers_count" - - create_table "users", :force => true do |t| - t.string "login", :default => "", :null => false - t.string "hashed_password", :limit => 40, :default => "", :null => false - t.string "firstname", :limit => 30, :default => "", :null => false - t.string "lastname", :default => "", :null => false - t.string "mail", :limit => 60, :default => "", :null => false - t.boolean "admin", :default => false, :null => false - t.integer "status", :default => 1, :null => false - t.datetime "last_login_on" - t.string "language", :limit => 5, :default => "" - t.integer "auth_source_id" - t.datetime "created_on" - t.datetime "updated_on" - t.string "type" - t.string "identity_url" - t.string "mail_notification", :default => "", :null => false - t.string "salt", :limit => 64 - t.integer "gid" - end - - add_index "users", ["auth_source_id"], :name => "index_users_on_auth_source_id" - add_index "users", ["id", "type"], :name => "index_users_on_id_and_type" - add_index "users", ["type"], :name => "index_users_on_type" - - create_table "versions", :force => true do |t| - t.integer "project_id", :default => 0, :null => false - t.string "name", :default => "", :null => false - t.string "description", :default => "" - t.date "effective_date" - t.datetime "created_on" - t.datetime "updated_on" - t.string "wiki_page_title" - t.string "status", :default => "open" - t.string "sharing", :default => "none", :null => false - end - - add_index "versions", ["project_id"], :name => "versions_project_id" - add_index "versions", ["sharing"], :name => "index_versions_on_sharing" - - create_table "visitors", :force => true do |t| - t.integer "user_id" - t.integer "master_id" - t.datetime "updated_on" - t.datetime "created_on" - end - - add_index "visitors", ["master_id"], :name => "index_visitors_master_id" - add_index "visitors", ["updated_on"], :name => "index_visitors_updated_on" - add_index "visitors", ["user_id"], :name => "index_visitors_user_id" - - create_table "watchers", :force => true do |t| - t.string "watchable_type", :default => "", :null => false - t.integer "watchable_id", :default => 0, :null => false - t.integer "user_id" - end - - add_index "watchers", ["user_id", "watchable_type"], :name => "watchers_user_id_type" - add_index "watchers", ["user_id"], :name => "index_watchers_on_user_id" - add_index "watchers", ["watchable_id", "watchable_type"], :name => "index_watchers_on_watchable_id_and_watchable_type" - - create_table "web_footer_companies", :force => true do |t| - t.string "name" - t.string "logo_size" - t.string "url" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "web_footer_oranizers", :force => true do |t| - t.string "name" - t.text "description" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "wiki_content_versions", :force => true do |t| - t.integer "wiki_content_id", :null => false - t.integer "page_id", :null => false - t.integer "author_id" - t.binary "data", :limit => 2147483647 - t.string "compression", :limit => 6, :default => "" - t.string "comments", :default => "" - t.datetime "updated_on", :null => false - t.integer "version", :null => false - end - - add_index "wiki_content_versions", ["updated_on"], :name => "index_wiki_content_versions_on_updated_on" - add_index "wiki_content_versions", ["wiki_content_id"], :name => "wiki_content_versions_wcid" - - create_table "wiki_contents", :force => true do |t| - t.integer "page_id", :null => false - t.integer "author_id" - t.text "text", :limit => 2147483647 - t.string "comments", :default => "" - t.datetime "updated_on", :null => false - t.integer "version", :null => false - end - - add_index "wiki_contents", ["author_id"], :name => "index_wiki_contents_on_author_id" - add_index "wiki_contents", ["page_id"], :name => "wiki_contents_page_id" - - create_table "wiki_pages", :force => true do |t| - t.integer "wiki_id", :null => false - t.string "title", :null => false - t.datetime "created_on", :null => false - t.boolean "protected", :default => false, :null => false - t.integer "parent_id" - end - - add_index "wiki_pages", ["parent_id"], :name => "index_wiki_pages_on_parent_id" - add_index "wiki_pages", ["wiki_id", "title"], :name => "wiki_pages_wiki_id_title" - add_index "wiki_pages", ["wiki_id"], :name => "index_wiki_pages_on_wiki_id" - - create_table "wiki_redirects", :force => true do |t| - t.integer "wiki_id", :null => false - t.string "title" - t.string "redirects_to" - t.datetime "created_on", :null => false - end - - add_index "wiki_redirects", ["wiki_id", "title"], :name => "wiki_redirects_wiki_id_title" - add_index "wiki_redirects", ["wiki_id"], :name => "index_wiki_redirects_on_wiki_id" - - create_table "wikis", :force => true do |t| - t.integer "project_id", :null => false - t.string "start_page", :null => false - t.integer "status", :default => 1, :null => false - end - - add_index "wikis", ["project_id"], :name => "wikis_project_id" - - create_table "workflows", :force => true do |t| - t.integer "tracker_id", :default => 0, :null => false - t.integer "old_status_id", :default => 0, :null => false - t.integer "new_status_id", :default => 0, :null => false - t.integer "role_id", :default => 0, :null => false - t.boolean "assignee", :default => false, :null => false - t.boolean "author", :default => false, :null => false - t.string "type", :limit => 30 - t.string "field_name", :limit => 30 - t.string "rule", :limit => 30 - end - - add_index "workflows", ["new_status_id"], :name => "index_workflows_on_new_status_id" - add_index "workflows", ["old_status_id"], :name => "index_workflows_on_old_status_id" - add_index "workflows", ["role_id", "tracker_id", "old_status_id"], :name => "wkfs_role_tracker_old_status" - add_index "workflows", ["role_id"], :name => "index_workflows_on_role_id" - - create_table "works_categories", :force => true do |t| - t.string "category" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "zip_packs", :force => true do |t| - t.integer "user_id" - t.integer "homework_id" - t.string "file_digest" - t.string "file_path" - t.integer "pack_times", :default => 1 - t.integer "pack_size", :default => 0 - t.text "file_digests" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - -end - -# encoding: UTF-8 -# This file is auto-generated from the current state of the database. Instead -# of editing this file, please use the migrations feature of Active Record to -# incrementally modify your database, and then regenerate this schema definition. -# -# Note that this schema.rb definition is the authoritative source for your -# database schema. If you need to create the application database on another -# system, you should be using db:schema:load, not running all the migrations -# from scratch. The latter is a flawed and unsustainable approach (the more migrations -# you'll amass, the slower it'll run and the greater likelihood for issues). -# -# It's strongly recommended to check this file into your version control system. - -ActiveRecord::Schema.define(:version => 20151112072948) do - - create_table "activities", :force => true do |t| - t.integer "act_id", :null => false - t.string "act_type", :null => false - t.integer "user_id", :null => false - t.integer "activity_container_id" - t.string "activity_container_type", :default => "" - t.datetime "created_at" - end - - add_index "activities", ["act_id", "act_type"], :name => "index_activities_on_act_id_and_act_type" - add_index "activities", ["user_id", "act_type"], :name => "index_activities_on_user_id_and_act_type" - add_index "activities", ["user_id"], :name => "index_activities_on_user_id" - - create_table "activity_notifies", :force => true do |t| - t.integer "activity_container_id" - t.string "activity_container_type" - t.integer "activity_id" - t.string "activity_type" - t.integer "notify_to" - t.datetime "created_on" - t.integer "is_read" - end - - add_index "activity_notifies", ["activity_container_id", "activity_container_type"], :name => "index_an_activity_container_id" - add_index "activity_notifies", ["created_on"], :name => "index_an_created_on" - add_index "activity_notifies", ["notify_to"], :name => "index_an_notify_to" - - create_table "api_keys", :force => true do |t| - t.string "access_token" - t.datetime "expires_at" - t.integer "user_id" - t.boolean "active", :default => true - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - add_index "api_keys", ["access_token"], :name => "index_api_keys_on_access_token" - add_index "api_keys", ["user_id"], :name => "index_api_keys_on_user_id" - - create_table "applied_projects", :force => true do |t| - t.integer "project_id", :null => false - t.integer "user_id", :null => false - end - - create_table "apply_project_masters", :force => true do |t| - t.integer "user_id" - t.string "apply_type" - t.integer "apply_id" - t.integer "status" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "attachments", :force => true do |t| - t.integer "container_id" - t.string "container_type", :limit => 30 - t.string "filename", :default => "", :null => false - t.string "disk_filename", :default => "", :null => false - t.integer "filesize", :default => 0, :null => false - t.string "content_type", :default => "" - t.string "digest", :limit => 40, :default => "", :null => false - t.integer "downloads", :default => 0, :null => false - t.integer "author_id", :default => 0, :null => false - t.datetime "created_on" - t.string "description" - t.string "disk_directory" - t.integer "attachtype", :default => 1 - t.integer "is_public", :default => 1 - t.integer "copy_from" - t.integer "quotes" - end - - add_index "attachments", ["author_id"], :name => "index_attachments_on_author_id" - add_index "attachments", ["container_id", "container_type"], :name => "index_attachments_on_container_id_and_container_type" - add_index "attachments", ["created_on"], :name => "index_attachments_on_created_on" - - create_table "attachmentstypes", :force => true do |t| - t.integer "typeId", :null => false - t.string "typeName", :limit => 50 - end - - create_table "auth_sources", :force => true do |t| - t.string "type", :limit => 30, :default => "", :null => false - t.string "name", :limit => 60, :default => "", :null => false - t.string "host", :limit => 60 - t.integer "port" - t.string "account" - t.string "account_password", :default => "" - t.string "base_dn" - t.string "attr_login", :limit => 30 - t.string "attr_firstname", :limit => 30 - t.string "attr_lastname", :limit => 30 - t.string "attr_mail", :limit => 30 - t.boolean "onthefly_register", :default => false, :null => false - t.boolean "tls", :default => false, :null => false - t.string "filter" - t.integer "timeout" - end - - add_index "auth_sources", ["id", "type"], :name => "index_auth_sources_on_id_and_type" - - create_table "biding_projects", :force => true do |t| - t.integer "project_id" - t.integer "bid_id" - t.integer "user_id" - t.string "description" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "reward" - end - - create_table "bids", :force => true do |t| - t.string "name" - t.string "budget", :null => false - t.integer "author_id" - t.date "deadline" - t.text "description" - t.datetime "created_on", :null => false - t.datetime "updated_on", :null => false - t.integer "commit" - t.integer "reward_type" - t.integer "homework_type" - t.integer "parent_id" - t.string "password" - t.integer "is_evaluation" - t.integer "proportion", :default => 60 - t.integer "comment_status", :default => 0 - t.integer "evaluation_num", :default => 3 - t.integer "open_anonymous_evaluation", :default => 1 - end - - create_table "blog_comments", :force => true do |t| - t.integer "blog_id", :null => false - t.integer "parent_id" - t.string "title", :default => "", :null => false - t.text "content" - t.integer "author_id" - t.integer "comments_count", :default => 0, :null => false - t.integer "last_comment_id" - t.datetime "created_on", :null => false - t.datetime "updated_on", :null => false - t.boolean "locked", :default => false - t.integer "sticky", :default => 0 - t.integer "reply_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "blogs", :force => true do |t| - t.string "name", :default => "", :null => false - t.text "description" - t.integer "position", :default => 1 - t.integer "article_count", :default => 0, :null => false - t.integer "comments_count", :default => 0, :null => false - t.integer "last_comments_id" - t.integer "parent_id" - t.integer "author_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "boards", :force => true do |t| - t.integer "project_id", :null => false - t.string "name", :default => "", :null => false - t.string "description" - t.integer "position", :default => 1 - t.integer "topics_count", :default => 0, :null => false - t.integer "messages_count", :default => 0, :null => false - t.integer "last_message_id" - t.integer "parent_id" - t.integer "course_id" - end - - add_index "boards", ["last_message_id"], :name => "index_boards_on_last_message_id" - add_index "boards", ["project_id"], :name => "boards_project_id" - - create_table "bug_to_osps", :force => true do |t| - t.integer "osp_id" - t.integer "relative_memo_id" - t.string "description" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "changes", :force => true do |t| - t.integer "changeset_id", :null => false - t.string "action", :limit => 1, :default => "", :null => false - t.text "path", :null => false - t.text "from_path" - t.string "from_revision" - t.string "revision" - t.string "branch" - end - - add_index "changes", ["changeset_id"], :name => "changesets_changeset_id" - - create_table "changeset_parents", :id => false, :force => true do |t| - t.integer "changeset_id", :null => false - t.integer "parent_id", :null => false - end - - add_index "changeset_parents", ["changeset_id"], :name => "changeset_parents_changeset_ids" - add_index "changeset_parents", ["parent_id"], :name => "changeset_parents_parent_ids" - - create_table "changesets", :force => true do |t| - t.integer "repository_id", :null => false - t.string "revision", :null => false - t.string "committer" - t.datetime "committed_on", :null => false - t.text "comments" - t.date "commit_date" - t.string "scmid" - t.integer "user_id" - end - - add_index "changesets", ["committed_on"], :name => "index_changesets_on_committed_on" - add_index "changesets", ["repository_id", "revision"], :name => "changesets_repos_rev", :unique => true - add_index "changesets", ["repository_id", "scmid"], :name => "changesets_repos_scmid" - add_index "changesets", ["repository_id"], :name => "index_changesets_on_repository_id" - add_index "changesets", ["user_id"], :name => "index_changesets_on_user_id" - - create_table "changesets_issues", :id => false, :force => true do |t| - t.integer "changeset_id", :null => false - t.integer "issue_id", :null => false - end - - 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 - t.integer "author_id", :default => 0, :null => false - t.text "comments" - t.datetime "created_on", :null => false - t.datetime "updated_on", :null => false - end - - add_index "comments", ["author_id"], :name => "index_comments_on_author_id" - add_index "comments", ["commented_id", "commented_type"], :name => "index_comments_on_commented_id_and_commented_type" - - create_table "contest_notifications", :force => true do |t| - t.text "title" - t.text "content" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "contesting_projects", :force => true do |t| - t.integer "project_id" - t.string "contest_id" - t.integer "user_id" - t.string "description" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "reward" - end - - create_table "contesting_softapplications", :force => true do |t| - t.integer "softapplication_id" - t.integer "contest_id" - t.integer "user_id" - t.string "description" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "reward" - end - - create_table "contestnotifications", :force => true do |t| - t.integer "contest_id" - t.string "title" - t.string "summary" - t.text "description" - t.integer "author_id" - t.integer "notificationcomments_count" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "contests", :force => true do |t| - t.string "name" - t.string "budget", :default => "" - t.integer "author_id" - t.date "deadline" - t.string "description" - t.integer "commit" - t.string "password" - t.datetime "created_on", :null => false - t.datetime "updated_on", :null => false - end - - create_table "course_activities", :force => true do |t| - t.integer "user_id" - t.integer "course_id" - t.integer "course_act_id" - t.string "course_act_type" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "course_attachments", :force => true do |t| - t.string "filename" - t.string "disk_filename" - t.integer "filesize" - t.string "content_type" - t.string "digest" - t.integer "downloads" - t.string "author_id" - t.string "integer" - t.string "description" - t.string "disk_directory" - t.integer "attachtype" - t.integer "is_public" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "container_id", :default => 0 - end - - create_table "course_groups", :force => true do |t| - t.string "name" - t.integer "course_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "course_infos", :force => true do |t| - t.integer "course_id" - t.integer "user_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "course_messages", :force => true do |t| - t.integer "user_id" - t.integer "course_id" - t.integer "course_message_id" - t.string "course_message_type" - t.integer "viewed" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "content" - t.integer "status" - end - - create_table "course_statuses", :force => true do |t| - t.integer "changesets_count" - t.integer "watchers_count" - t.integer "course_id" - t.float "grade", :default => 0.0 - t.integer "course_ac_para", :default => 0 - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "courses", :force => true do |t| - t.integer "tea_id" - t.string "name" - t.integer "state" - t.string "code" - t.integer "time" - t.string "extra" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "location" - t.string "term" - t.string "string" - t.string "password" - t.string "setup_time" - t.string "endup_time" - t.string "class_period" - t.integer "school_id" - t.text "description" - 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 - end - - create_table "custom_fields", :force => true do |t| - t.string "type", :limit => 30, :default => "", :null => false - t.string "name", :limit => 30, :default => "", :null => false - t.string "field_format", :limit => 30, :default => "", :null => false - t.text "possible_values" - t.string "regexp", :default => "" - t.integer "min_length", :default => 0, :null => false - t.integer "max_length", :default => 0, :null => false - t.boolean "is_required", :default => false, :null => false - t.boolean "is_for_all", :default => false, :null => false - t.boolean "is_filter", :default => false, :null => false - t.integer "position", :default => 1 - t.boolean "searchable", :default => false - t.text "default_value" - t.boolean "editable", :default => true - t.boolean "visible", :default => true, :null => false - t.boolean "multiple", :default => false - end - - add_index "custom_fields", ["id", "type"], :name => "index_custom_fields_on_id_and_type" - - create_table "custom_fields_projects", :id => false, :force => true do |t| - t.integer "custom_field_id", :default => 0, :null => false - t.integer "project_id", :default => 0, :null => false - end - - add_index "custom_fields_projects", ["custom_field_id", "project_id"], :name => "index_custom_fields_projects_on_custom_field_id_and_project_id", :unique => true - - create_table "custom_fields_trackers", :id => false, :force => true do |t| - t.integer "custom_field_id", :default => 0, :null => false - t.integer "tracker_id", :default => 0, :null => false - end - - add_index "custom_fields_trackers", ["custom_field_id", "tracker_id"], :name => "index_custom_fields_trackers_on_custom_field_id_and_tracker_id", :unique => true - - create_table "custom_values", :force => true do |t| - t.string "customized_type", :limit => 30, :default => "", :null => false - t.integer "customized_id", :default => 0, :null => false - t.integer "custom_field_id", :default => 0, :null => false - t.text "value" - end - - add_index "custom_values", ["custom_field_id"], :name => "index_custom_values_on_custom_field_id" - add_index "custom_values", ["customized_type", "customized_id"], :name => "custom_values_customized" - - create_table "delayed_jobs", :force => true do |t| - t.integer "priority", :default => 0, :null => false - t.integer "attempts", :default => 0, :null => false - t.text "handler", :null => false - t.text "last_error" - t.datetime "run_at" - t.datetime "locked_at" - t.datetime "failed_at" - t.string "locked_by" - t.string "queue" - t.datetime "created_at" - t.datetime "updated_at" - end - - 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 - t.string "title", :limit => 60, :default => "", :null => false - t.text "description" - t.datetime "created_on" - t.integer "user_id", :default => 0 - t.integer "is_public", :default => 1 - end - - add_index "documents", ["category_id"], :name => "index_documents_on_category_id" - add_index "documents", ["created_on"], :name => "index_documents_on_created_on" - add_index "documents", ["project_id"], :name => "documents_project_id" - - create_table "dts", :force => true do |t| - t.string "IPLineCode" - t.string "Description" - 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", :null => false - t.datetime "updated_at", :null => false - end - - create_table "enabled_modules", :force => true do |t| - t.integer "project_id" - t.string "name", :null => false - t.integer "course_id" - end - - add_index "enabled_modules", ["project_id"], :name => "enabled_modules_project_id" - - create_table "enumerations", :force => true do |t| - t.string "name", :limit => 30, :default => "", :null => false - t.integer "position", :default => 1 - t.boolean "is_default", :default => false, :null => false - t.string "type" - t.boolean "active", :default => true, :null => false - t.integer "project_id" - t.integer "parent_id" - t.string "position_name", :limit => 30 - end - - add_index "enumerations", ["id", "type"], :name => "index_enumerations_on_id_and_type" - add_index "enumerations", ["project_id"], :name => "index_enumerations_on_project_id" - - create_table "first_pages", :force => true do |t| - t.string "web_title" - t.string "title" - t.text "description" - t.string "page_type" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "sort_type" - t.integer "image_width", :default => 107 - t.integer "image_height", :default => 63 - t.integer "show_course", :default => 1 - t.integer "show_contest", :default => 1 - end - - create_table "forge_activities", :force => true do |t| - t.integer "user_id" - t.integer "project_id" - t.integer "forge_act_id" - t.string "forge_act_type" - t.integer "org_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - add_index "forge_activities", ["forge_act_id"], :name => "index_forge_activities_on_forge_act_id" - - create_table "forge_messages", :force => true do |t| - t.integer "user_id" - t.integer "project_id" - t.integer "forge_message_id" - t.string "forge_message_type" - t.integer "viewed" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "secret_key" - t.integer "status" - end - - create_table "forums", :force => true do |t| - t.string "name", :null => false - t.text "description" - t.integer "topic_count", :default => 0 - t.integer "memo_count", :default => 0 - t.integer "last_memo_id", :default => 0 - t.integer "creator_id", :null => false - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "sticky" - t.integer "locked" - end - - create_table "groups_users", :id => false, :force => true do |t| - t.integer "group_id", :null => false - t.integer "user_id", :null => false - end - - add_index "groups_users", ["group_id", "user_id"], :name => "groups_users_ids", :unique => true - - 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.string "reward" - t.string "name" - t.text "description" - t.integer "state" - t.integer "project_id", :default => 0 - t.float "score", :default => 0.0 - t.integer "is_teacher_score", :default => 0 - end - - add_index "homework_attaches", ["bid_id"], :name => "index_homework_attaches_on_bid_id" - - create_table "homework_commons", :force => true do |t| - t.string "name" - t.integer "user_id" - t.text "description" - t.date "publish_time" - t.date "end_time" - t.integer "homework_type", :default => 1 - t.string "late_penalty" - t.integer "course_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "teacher_priority", :default => 1 - t.integer "anonymous_comment", :default => 0 - end - - create_table "homework_detail_manuals", :force => true do |t| - t.float "ta_proportion" - t.integer "comment_status" - t.date "evaluation_start" - t.date "evaluation_end" - t.integer "evaluation_num" - t.integer "absence_penalty", :default => 1 - t.integer "homework_common_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "homework_detail_programings", :force => true do |t| - t.string "language" - t.text "standard_code", :limit => 2147483647 - t.integer "homework_common_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.float "ta_proportion", :default => 0.1 - t.integer "question_id" - end - - create_table "homework_evaluations", :force => true do |t| - t.string "user_id" - t.string "homework_attach_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "homework_for_courses", :force => true do |t| - t.integer "course_id" - t.integer "bid_id" - end - - add_index "homework_for_courses", ["bid_id"], :name => "index_homework_for_courses_on_bid_id" - add_index "homework_for_courses", ["course_id"], :name => "index_homework_for_courses_on_course_id" - - create_table "homework_tests", :force => true do |t| - t.text "input" - t.text "output" - t.integer "homework_common_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "result" - t.text "error_msg" - end - - create_table "homework_users", :force => true do |t| - t.string "homework_attach_id" - t.string "user_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "invite_lists", :force => true do |t| - t.integer "project_id" - t.integer "user_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "mail" - end - - create_table "issue_categories", :force => true do |t| - t.integer "project_id", :default => 0, :null => false - t.string "name", :limit => 30, :default => "", :null => false - t.integer "assigned_to_id" - end - - add_index "issue_categories", ["assigned_to_id"], :name => "index_issue_categories_on_assigned_to_id" - add_index "issue_categories", ["project_id"], :name => "issue_categories_project_id" - - create_table "issue_relations", :force => true do |t| - t.integer "issue_from_id", :null => false - t.integer "issue_to_id", :null => false - t.string "relation_type", :default => "", :null => false - t.integer "delay" - end - - add_index "issue_relations", ["issue_from_id", "issue_to_id"], :name => "index_issue_relations_on_issue_from_id_and_issue_to_id", :unique => true - add_index "issue_relations", ["issue_from_id"], :name => "index_issue_relations_on_issue_from_id" - add_index "issue_relations", ["issue_to_id"], :name => "index_issue_relations_on_issue_to_id" - - create_table "issue_statuses", :force => true do |t| - t.string "name", :limit => 30, :default => "", :null => false - t.boolean "is_closed", :default => false, :null => false - t.boolean "is_default", :default => false, :null => false - t.integer "position", :default => 1 - t.integer "default_done_ratio" - end - - add_index "issue_statuses", ["is_closed"], :name => "index_issue_statuses_on_is_closed" - add_index "issue_statuses", ["is_default"], :name => "index_issue_statuses_on_is_default" - add_index "issue_statuses", ["position"], :name => "index_issue_statuses_on_position" - - create_table "issues", :force => true do |t| - t.integer "tracker_id", :null => false - t.integer "project_id", :null => false - t.string "subject", :default => "", :null => false - t.text "description" - t.date "due_date" - t.integer "category_id" - t.integer "status_id", :null => false - t.integer "assigned_to_id" - t.integer "priority_id", :null => false - t.integer "fixed_version_id" - t.integer "author_id", :null => false - t.integer "lock_version", :default => 0, :null => false - t.datetime "created_on" - t.datetime "updated_on" - t.date "start_date" - t.integer "done_ratio", :default => 0, :null => false - t.float "estimated_hours" - t.integer "parent_id" - t.integer "root_id" - t.integer "lft" - t.integer "rgt" - t.boolean "is_private", :default => false, :null => false - t.datetime "closed_on" - t.integer "project_issues_index" - end - - add_index "issues", ["assigned_to_id"], :name => "index_issues_on_assigned_to_id" - add_index "issues", ["author_id"], :name => "index_issues_on_author_id" - add_index "issues", ["category_id"], :name => "index_issues_on_category_id" - add_index "issues", ["created_on"], :name => "index_issues_on_created_on" - add_index "issues", ["fixed_version_id"], :name => "index_issues_on_fixed_version_id" - add_index "issues", ["priority_id"], :name => "index_issues_on_priority_id" - add_index "issues", ["project_id"], :name => "issues_project_id" - add_index "issues", ["root_id", "lft", "rgt"], :name => "index_issues_on_root_id_and_lft_and_rgt" - add_index "issues", ["status_id"], :name => "index_issues_on_status_id" - add_index "issues", ["tracker_id"], :name => "index_issues_on_tracker_id" - - create_table "join_in_competitions", :force => true do |t| - t.integer "user_id" - t.integer "competition_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "join_in_contests", :force => true do |t| - t.integer "user_id" - t.integer "bid_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "journal_details", :force => true do |t| - t.integer "journal_id", :default => 0, :null => false - t.string "property", :limit => 30, :default => "", :null => false - t.string "prop_key", :limit => 30, :default => "", :null => false - t.text "old_value" - t.text "value" - end - - add_index "journal_details", ["journal_id"], :name => "journal_details_journal_id" - - create_table "journal_details_copy", :force => true do |t| - t.integer "journal_id", :default => 0, :null => false - t.string "property", :limit => 30, :default => "", :null => false - t.string "prop_key", :limit => 30, :default => "", :null => false - t.text "old_value" - t.text "value" - end - - add_index "journal_details_copy", ["journal_id"], :name => "journal_details_journal_id" - - create_table "journal_replies", :id => false, :force => true do |t| - t.integer "journal_id" - t.integer "user_id" - t.integer "reply_id" - end - - add_index "journal_replies", ["journal_id"], :name => "index_journal_replies_on_journal_id" - add_index "journal_replies", ["reply_id"], :name => "index_journal_replies_on_reply_id" - add_index "journal_replies", ["user_id"], :name => "index_journal_replies_on_user_id" - - create_table "journals", :force => true do |t| - t.integer "journalized_id", :default => 0, :null => false - t.string "journalized_type", :limit => 30, :default => "", :null => false - t.integer "user_id", :default => 0, :null => false - t.text "notes" - t.datetime "created_on", :null => false - t.boolean "private_notes", :default => false, :null => false - end - - add_index "journals", ["created_on"], :name => "index_journals_on_created_on" - add_index "journals", ["journalized_id", "journalized_type"], :name => "journals_journalized_id" - add_index "journals", ["journalized_id"], :name => "index_journals_on_journalized_id" - add_index "journals", ["user_id"], :name => "index_journals_on_user_id" - - create_table "journals_for_messages", :force => true do |t| - t.integer "jour_id" - t.string "jour_type" - t.integer "user_id" - t.text "notes" - t.integer "status" - t.integer "reply_id" - t.datetime "created_on", :null => false - t.datetime "updated_on", :null => false - t.string "m_parent_id" - t.boolean "is_readed" - t.integer "m_reply_count" - t.integer "m_reply_id" - t.integer "is_comprehensive_evaluation" - end - - create_table "kindeditor_assets", :force => true do |t| - t.string "asset" - t.integer "file_size" - t.string "file_type" - t.integer "owner_id" - t.string "asset_type" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "owner_type", :default => 0 - end - - create_table "member_roles", :force => true do |t| - t.integer "member_id", :null => false - t.integer "role_id", :null => false - t.integer "inherited_from" - end - - add_index "member_roles", ["member_id"], :name => "index_member_roles_on_member_id" - add_index "member_roles", ["role_id"], :name => "index_member_roles_on_role_id" - - create_table "members", :force => true do |t| - t.integer "user_id", :default => 0, :null => false - t.integer "project_id", :default => 0 - t.datetime "created_on" - t.boolean "mail_notification", :default => false, :null => false - t.integer "course_id", :default => -1 - t.integer "course_group_id", :default => 0 - end - - add_index "members", ["project_id"], :name => "index_members_on_project_id" - add_index "members", ["user_id", "project_id", "course_id"], :name => "index_members_on_user_id_and_project_id", :unique => true - add_index "members", ["user_id"], :name => "index_members_on_user_id" - - create_table "memo_messages", :force => true do |t| - t.integer "user_id" - t.integer "forum_id" - t.integer "memo_id" - t.string "memo_type" - t.integer "viewed" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "memos", :force => true do |t| - t.integer "forum_id", :null => false - t.integer "parent_id" - t.string "subject", :null => false - t.text "content", :null => false - t.integer "author_id", :null => false - t.integer "replies_count", :default => 0 - t.integer "last_reply_id" - t.boolean "lock", :default => false - t.boolean "sticky", :default => false - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "viewed_count", :default => 0 - end - - create_table "message_alls", :force => true do |t| - t.integer "user_id" - t.integer "message_id" - t.string "message_type" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "messages", :force => true do |t| - t.integer "board_id", :null => false - t.integer "parent_id" - t.string "subject", :default => "", :null => false - t.text "content" - t.integer "author_id" - t.integer "replies_count", :default => 0, :null => false - t.integer "last_reply_id" - t.datetime "created_on", :null => false - t.datetime "updated_on", :null => false - t.boolean "locked", :default => false - t.integer "sticky", :default => 0 - t.integer "reply_id" - end - - add_index "messages", ["author_id"], :name => "index_messages_on_author_id" - add_index "messages", ["board_id"], :name => "messages_board_id" - add_index "messages", ["created_on"], :name => "index_messages_on_created_on" - add_index "messages", ["last_reply_id"], :name => "index_messages_on_last_reply_id" - add_index "messages", ["parent_id"], :name => "messages_parent_id" - - create_table "news", :force => true do |t| - t.integer "project_id" - t.string "title", :limit => 60, :default => "", :null => false - t.string "summary", :default => "" - t.text "description" - t.integer "author_id", :default => 0, :null => false - t.datetime "created_on" - t.integer "comments_count", :default => 0, :null => false - t.integer "course_id" - t.integer "sticky", :default => 0 - end - - add_index "news", ["author_id"], :name => "index_news_on_author_id" - add_index "news", ["created_on"], :name => "index_news_on_created_on" - add_index "news", ["project_id"], :name => "news_project_id" - - create_table "no_uses", :force => true do |t| - t.integer "user_id", :null => false - t.string "no_use_type" - t.integer "no_use_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "notificationcomments", :force => true do |t| - t.string "notificationcommented_type" - t.integer "notificationcommented_id" - t.integer "author_id" - t.text "notificationcomments" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "onclick_times", :force => true do |t| - t.integer "user_id" - t.datetime "onclick_time" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "open_id_authentication_associations", :force => true do |t| - t.integer "issued" - t.integer "lifetime" - t.string "handle" - t.string "assoc_type" - t.binary "server_url" - t.binary "secret" - end - - create_table "open_id_authentication_nonces", :force => true do |t| - t.integer "timestamp", :null => false - t.string "server_url" - t.string "salt", :null => false - end - - create_table "open_source_projects", :force => true do |t| - t.string "name" - t.text "description" - t.integer "commit_count", :default => 0 - t.integer "code_line", :default => 0 - t.integer "users_count", :default => 0 - t.date "last_commit_time" - t.string "url" - t.date "date_collected" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "option_numbers", :force => true do |t| - t.integer "user_id" - t.integer "memo" - t.integer "messages_for_issues" - t.integer "issues_status" - t.integer "replay_for_message" - t.integer "replay_for_memo" - t.integer "follow" - t.integer "tread" - t.integer "praise_by_one" - t.integer "praise_by_two" - t.integer "praise_by_three" - t.integer "tread_by_one" - t.integer "tread_by_two" - t.integer "tread_by_three" - t.integer "changeset" - t.integer "document" - t.integer "attachment" - t.integer "issue_done_ratio" - t.integer "post_issue" - t.integer "score_type" - t.integer "total_score" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "project_id" - end - - create_table "org_activities", :force => true do |t| - t.integer "user_id" - t.integer "org_act_id" - t.string "org_act_type" - t.integer "container_id" - t.string "container_type" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "org_document_comments", :force => true do |t| - t.string "title" - t.text "content" - t.integer "organization_id" - t.integer "creator_id" - t.integer "parent_id" - t.integer "reply_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.boolean "locked", :default => false - t.integer "sticky", :default => 0 - end - - create_table "org_member_roles", :force => true do |t| - t.integer "org_member_id" - t.integer "role_id" - end - - create_table "org_members", :force => true do |t| - t.integer "user_id" - t.integer "organization_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "org_projects", :force => true do |t| - t.integer "organization_id" - t.integer "project_id" - t.datetime "created_at" - end - - create_table "organizations", :force => true do |t| - t.string "name" - t.text "description" - t.integer "creator_id" - t.integer "home_id" - t.string "domain" - t.boolean "is_public" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "phone_app_versions", :force => true do |t| - t.string "version" - t.text "description" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "poll_answers", :force => true do |t| - t.integer "poll_question_id" - t.text "answer_text" - t.integer "answer_position" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "poll_questions", :force => true do |t| - t.string "question_title" - t.integer "question_type" - t.integer "is_necessary" - t.integer "poll_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "question_number" - end - - create_table "poll_users", :force => true do |t| - t.integer "user_id" - t.integer "poll_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "poll_votes", :force => true do |t| - t.integer "user_id" - t.integer "poll_question_id" - t.integer "poll_answer_id" - t.text "vote_text" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "polls", :force => true do |t| - t.string "polls_name" - t.string "polls_type" - t.integer "polls_group_id" - t.integer "polls_status" - t.integer "user_id" - t.datetime "published_at" - t.datetime "closed_at" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.text "polls_description" - t.integer "show_result", :default => 1 - end - - create_table "praise_tread_caches", :force => true do |t| - t.integer "object_id", :null => false - t.string "object_type" - t.integer "praise_num" - t.integer "tread_num" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "praise_treads", :force => true do |t| - t.integer "user_id", :null => false - t.integer "praise_tread_object_id" - t.string "praise_tread_object_type" - t.integer "praise_or_tread" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "principal_activities", :force => true do |t| - t.integer "user_id" - t.integer "principal_id" - t.integer "principal_act_id" - t.string "principal_act_type" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "project_infos", :force => true do |t| - t.integer "project_id" - t.integer "user_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "project_scores", :force => true do |t| - t.string "project_id" - t.integer "score" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "issue_num", :default => 0 - t.integer "issue_journal_num", :default => 0 - t.integer "news_num", :default => 0 - t.integer "documents_num", :default => 0 - t.integer "changeset_num", :default => 0 - t.integer "board_message_num", :default => 0 - end - - create_table "project_statuses", :force => true do |t| - t.integer "changesets_count" - t.integer "watchers_count" - t.integer "project_id" - t.integer "project_type" - t.float "grade", :default => 0.0 - t.integer "course_ac_para", :default => 0 - end - - add_index "project_statuses", ["grade"], :name => "index_project_statuses_on_grade" - - create_table "projecting_softapplictions", :force => true do |t| - t.integer "user_id" - t.integer "softapplication_id" - t.integer "project_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "projects", :force => true do |t| - t.string "name", :default => "", :null => false - t.text "description" - t.string "homepage", :default => "" - t.boolean "is_public", :default => true, :null => false - t.integer "parent_id" - t.datetime "created_on" - t.datetime "updated_on" - t.string "identifier" - t.integer "status", :default => 1, :null => false - t.integer "lft" - t.integer "rgt" - t.boolean "inherit_members", :default => false, :null => false - t.integer "project_type" - t.boolean "hidden_repo", :default => false, :null => false - t.integer "attachmenttype", :default => 1 - t.integer "user_id" - t.integer "dts_test", :default => 0 - t.string "enterprise_name" - t.integer "organization_id" - t.integer "project_new_type" - t.integer "gpid" - end - - add_index "projects", ["lft"], :name => "index_projects_on_lft" - add_index "projects", ["rgt"], :name => "index_projects_on_rgt" - - create_table "projects_trackers", :id => false, :force => true do |t| - t.integer "project_id", :default => 0, :null => false - t.integer "tracker_id", :default => 0, :null => false - end - - add_index "projects_trackers", ["project_id", "tracker_id"], :name => "projects_trackers_unique", :unique => true - add_index "projects_trackers", ["project_id"], :name => "projects_trackers_project_id" - - create_table "queries", :force => true do |t| - t.integer "project_id" - t.string "name", :default => "", :null => false - t.text "filters" - t.integer "user_id", :default => 0, :null => false - t.boolean "is_public", :default => false, :null => false - t.text "column_names" - t.text "sort_criteria" - t.string "group_by" - t.string "type" - end - - add_index "queries", ["project_id"], :name => "index_queries_on_project_id" - add_index "queries", ["user_id"], :name => "index_queries_on_user_id" - - create_table "relative_memo_to_open_source_projects", :force => true do |t| - t.integer "osp_id" - t.integer "relative_memo_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "relative_memos", :force => true do |t| - t.integer "osp_id" - t.integer "parent_id" - t.string "subject", :null => false - t.text "content", :limit => 16777215, :null => false - t.integer "author_id" - t.integer "replies_count", :default => 0 - t.integer "last_reply_id" - t.boolean "lock", :default => false - t.boolean "sticky", :default => false - t.boolean "is_quote", :default => false - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "viewed_count_crawl", :default => 0 - t.integer "viewed_count_local", :default => 0 - t.string "url" - t.string "username" - t.string "userhomeurl" - t.date "date_collected" - t.string "topic_resource" - end - - create_table "repositories", :force => true do |t| - t.integer "project_id", :default => 0, :null => false - t.string "url", :default => "", :null => false - t.string "login", :limit => 60, :default => "" - t.string "password", :default => "" - t.string "root_url", :default => "" - t.string "type" - t.string "path_encoding", :limit => 64 - t.string "log_encoding", :limit => 64 - t.text "extra_info" - t.string "identifier" - t.boolean "is_default", :default => false - t.boolean "hidden", :default => false - end - - add_index "repositories", ["project_id"], :name => "index_repositories_on_project_id" - - create_table "rich_rich_files", :force => true do |t| - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "rich_file_file_name" - t.string "rich_file_content_type" - t.integer "rich_file_file_size" - t.datetime "rich_file_updated_at" - t.string "owner_type" - t.integer "owner_id" - t.text "uri_cache" - t.string "simplified_type", :default => "file" - end - - create_table "roles", :force => true do |t| - t.string "name", :limit => 30, :default => "", :null => false - t.integer "position", :default => 1 - t.boolean "assignable", :default => true - t.integer "builtin", :default => 0, :null => false - t.text "permissions" - t.string "issues_visibility", :limit => 30, :default => "default", :null => false - end - - create_table "schools", :force => true do |t| - t.string "name" - t.string "province" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "logo_link" - t.string "pinyin" - end - - create_table "seems_rateable_cached_ratings", :force => true do |t| - t.integer "cacheable_id", :limit => 8 - t.string "cacheable_type" - t.float "avg", :null => false - t.integer "cnt", :null => false - t.string "dimension" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "seems_rateable_rates", :force => true do |t| - t.integer "rater_id", :limit => 8 - t.integer "rateable_id" - t.string "rateable_type" - t.float "stars", :null => false - t.string "dimension" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "is_teacher_score", :default => 0 - end - - create_table "settings", :force => true do |t| - t.string "name", :default => "", :null => false - t.text "value" - t.datetime "updated_on" - end - - add_index "settings", ["name"], :name => "index_settings_on_name" - - create_table "shares", :force => true do |t| - t.date "created_on" - t.string "url" - t.string "title" - t.integer "share_type" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "project_id" - t.integer "user_id" - t.string "description" - end - - create_table "softapplications", :force => true do |t| - t.string "name" - t.text "description" - t.integer "app_type_id" - t.string "app_type_name" - t.string "android_min_version_available" - t.integer "user_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "contest_id" - t.integer "softapplication_id" - t.integer "is_public" - t.string "application_developers" - t.string "deposit_project_url" - t.string "deposit_project" - t.integer "project_id" - end - - create_table "student_work_tests", :force => true do |t| - t.integer "student_work_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "status", :default => 9 - t.text "results" - t.text "src" - end - - create_table "student_works", :force => true do |t| - t.string "name" - t.text "description", :limit => 2147483647 - t.integer "homework_common_id" - t.integer "user_id" - t.float "final_score" - t.float "teacher_score" - t.float "student_score" - t.float "teaching_asistant_score" - t.integer "project_id", :default => 0 - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "late_penalty", :default => 0 - t.integer "absence_penalty", :default => 0 - t.float "system_score", :default => 0.0 - t.boolean "is_test", :default => false - end - - create_table "student_works_evaluation_distributions", :force => true do |t| - t.integer "student_work_id" - t.integer "user_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "student_works_scores", :force => true do |t| - t.integer "student_work_id" - t.integer "user_id" - t.integer "score" - t.text "comment" - t.integer "reviewer_role" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "students_for_courses", :force => true do |t| - t.integer "student_id" - t.integer "course_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - add_index "students_for_courses", ["course_id"], :name => "index_students_for_courses_on_course_id" - add_index "students_for_courses", ["student_id"], :name => "index_students_for_courses_on_student_id" - - create_table "system_messages", :force => true do |t| - t.integer "user_id" - t.string "content" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.text "description" - t.string "subject" - end - - create_table "taggings", :force => true do |t| - t.integer "tag_id" - t.integer "taggable_id" - t.string "taggable_type" - t.integer "tagger_id" - t.string "tagger_type" - t.string "context", :limit => 128 - t.datetime "created_at" - end - - add_index "taggings", ["tag_id"], :name => "index_taggings_on_tag_id" - add_index "taggings", ["taggable_id", "taggable_type", "context"], :name => "index_taggings_on_taggable_id_and_taggable_type_and_context" - add_index "taggings", ["taggable_type"], :name => "index_taggings_on_taggable_type" - - create_table "tags", :force => true do |t| - t.string "name" - end - - create_table "teachers", :force => true do |t| - t.string "tea_name" - t.string "location" - t.integer "couurse_time" - t.integer "course_code" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "extra" - end - - create_table "time_entries", :force => true do |t| - t.integer "project_id", :null => false - t.integer "user_id", :null => false - t.integer "issue_id" - t.float "hours", :null => false - t.string "comments" - t.integer "activity_id", :null => false - t.date "spent_on", :null => false - t.integer "tyear", :null => false - t.integer "tmonth", :null => false - t.integer "tweek", :null => false - t.datetime "created_on", :null => false - t.datetime "updated_on", :null => false - end - - add_index "time_entries", ["activity_id"], :name => "index_time_entries_on_activity_id" - add_index "time_entries", ["created_on"], :name => "index_time_entries_on_created_on" - add_index "time_entries", ["issue_id"], :name => "time_entries_issue_id" - add_index "time_entries", ["project_id"], :name => "time_entries_project_id" - add_index "time_entries", ["user_id"], :name => "index_time_entries_on_user_id" - - create_table "tokens", :force => true do |t| - t.integer "user_id", :default => 0, :null => false - t.string "action", :limit => 30, :default => "", :null => false - t.string "value", :limit => 40, :default => "", :null => false - t.datetime "created_on", :null => false - end - - add_index "tokens", ["user_id"], :name => "index_tokens_on_user_id" - add_index "tokens", ["value"], :name => "tokens_value", :unique => true - - create_table "trackers", :force => true do |t| - t.string "name", :limit => 30, :default => "", :null => false - t.boolean "is_in_chlog", :default => false, :null => false - t.integer "position", :default => 1 - t.boolean "is_in_roadmap", :default => true, :null => false - t.integer "fields_bits", :default => 0 - end - - create_table "user_activities", :force => true do |t| - t.string "act_type" - t.integer "act_id" - t.string "container_type" - t.integer "container_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "user_id" - end - - create_table "user_extensions", :force => true do |t| - t.integer "user_id", :null => false - t.date "birthday" - t.string "brief_introduction" - t.integer "gender" - t.string "location" - t.string "occupation" - t.integer "work_experience" - t.integer "zip_code" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "technical_title" - t.integer "identity" - t.string "student_id" - t.string "teacher_realname" - t.string "student_realname" - t.string "location_city" - t.integer "school_id" - t.string "description", :default => "" - end - - create_table "user_feedback_messages", :force => true do |t| - t.integer "user_id" - t.integer "journals_for_message_id" - t.string "journals_for_message_type" - t.integer "viewed" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "user_grades", :force => true do |t| - t.integer "user_id", :null => false - t.integer "project_id", :null => false - t.float "grade", :default => 0.0 - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - add_index "user_grades", ["grade"], :name => "index_user_grades_on_grade" - add_index "user_grades", ["project_id"], :name => "index_user_grades_on_project_id" - add_index "user_grades", ["user_id"], :name => "index_user_grades_on_user_id" - - create_table "user_levels", :force => true do |t| - t.integer "user_id" - t.integer "level" - end - - create_table "user_preferences", :force => true do |t| - t.integer "user_id", :default => 0, :null => false - t.text "others" - t.boolean "hide_mail", :default => false - t.string "time_zone" - end - - add_index "user_preferences", ["user_id"], :name => "index_user_preferences_on_user_id" - - create_table "user_score_details", :force => true do |t| - t.integer "current_user_id" - t.integer "target_user_id" - t.string "score_type" - t.string "score_action" - t.integer "user_id" - t.integer "old_score" - t.integer "new_score" - t.integer "current_user_level" - t.integer "target_user_level" - t.integer "score_changeable_obj_id" - t.string "score_changeable_obj_type" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - 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 - end - - create_table "user_statuses", :force => true do |t| - t.integer "changesets_count" - t.integer "watchers_count" - t.integer "user_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.float "grade", :default => 0.0 - end - - add_index "user_statuses", ["changesets_count"], :name => "index_user_statuses_on_changesets_count" - add_index "user_statuses", ["grade"], :name => "index_user_statuses_on_grade" - add_index "user_statuses", ["watchers_count"], :name => "index_user_statuses_on_watchers_count" - - create_table "users", :force => true do |t| - t.string "login", :default => "", :null => false - t.string "hashed_password", :limit => 40, :default => "", :null => false - t.string "firstname", :limit => 30, :default => "", :null => false - t.string "lastname", :default => "", :null => false - t.string "mail", :limit => 60, :default => "", :null => false - t.boolean "admin", :default => false, :null => false - t.integer "status", :default => 1, :null => false - t.datetime "last_login_on" - t.string "language", :limit => 5, :default => "" - t.integer "auth_source_id" - t.datetime "created_on" - t.datetime "updated_on" - t.string "type" - t.string "identity_url" - t.string "mail_notification", :default => "", :null => false - t.string "salt", :limit => 64 - t.integer "gid" - end - - add_index "users", ["auth_source_id"], :name => "index_users_on_auth_source_id" - add_index "users", ["id", "type"], :name => "index_users_on_id_and_type" - add_index "users", ["type"], :name => "index_users_on_type" - - create_table "versions", :force => true do |t| - t.integer "project_id", :default => 0, :null => false - t.string "name", :default => "", :null => false - t.string "description", :default => "" - t.date "effective_date" - t.datetime "created_on" - t.datetime "updated_on" - t.string "wiki_page_title" - t.string "status", :default => "open" - t.string "sharing", :default => "none", :null => false - end - - add_index "versions", ["project_id"], :name => "versions_project_id" - add_index "versions", ["sharing"], :name => "index_versions_on_sharing" - - create_table "visitors", :force => true do |t| - t.integer "user_id" - t.integer "master_id" - t.datetime "updated_on" - t.datetime "created_on" - end - - add_index "visitors", ["master_id"], :name => "index_visitors_master_id" - add_index "visitors", ["updated_on"], :name => "index_visitors_updated_on" - add_index "visitors", ["user_id"], :name => "index_visitors_user_id" - - create_table "watchers", :force => true do |t| - t.string "watchable_type", :default => "", :null => false - t.integer "watchable_id", :default => 0, :null => false - t.integer "user_id" - end - - add_index "watchers", ["user_id", "watchable_type"], :name => "watchers_user_id_type" - add_index "watchers", ["user_id"], :name => "index_watchers_on_user_id" - add_index "watchers", ["watchable_id", "watchable_type"], :name => "index_watchers_on_watchable_id_and_watchable_type" - - create_table "web_footer_companies", :force => true do |t| - t.string "name" - t.string "logo_size" - t.string "url" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "web_footer_oranizers", :force => true do |t| - t.string "name" - t.text "description" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "wiki_content_versions", :force => true do |t| - t.integer "wiki_content_id", :null => false - t.integer "page_id", :null => false - t.integer "author_id" - t.binary "data", :limit => 2147483647 - t.string "compression", :limit => 6, :default => "" - t.string "comments", :default => "" - t.datetime "updated_on", :null => false - t.integer "version", :null => false - end - - add_index "wiki_content_versions", ["updated_on"], :name => "index_wiki_content_versions_on_updated_on" - add_index "wiki_content_versions", ["wiki_content_id"], :name => "wiki_content_versions_wcid" - - create_table "wiki_contents", :force => true do |t| - t.integer "page_id", :null => false - t.integer "author_id" - t.text "text", :limit => 2147483647 - t.string "comments", :default => "" - t.datetime "updated_on", :null => false - t.integer "version", :null => false - end - - add_index "wiki_contents", ["author_id"], :name => "index_wiki_contents_on_author_id" - add_index "wiki_contents", ["page_id"], :name => "wiki_contents_page_id" - - create_table "wiki_pages", :force => true do |t| - t.integer "wiki_id", :null => false - t.string "title", :null => false - t.datetime "created_on", :null => false - t.boolean "protected", :default => false, :null => false - t.integer "parent_id" - end - - add_index "wiki_pages", ["parent_id"], :name => "index_wiki_pages_on_parent_id" - add_index "wiki_pages", ["wiki_id", "title"], :name => "wiki_pages_wiki_id_title" - add_index "wiki_pages", ["wiki_id"], :name => "index_wiki_pages_on_wiki_id" - - create_table "wiki_redirects", :force => true do |t| - t.integer "wiki_id", :null => false - t.string "title" - t.string "redirects_to" - t.datetime "created_on", :null => false - end - - add_index "wiki_redirects", ["wiki_id", "title"], :name => "wiki_redirects_wiki_id_title" - add_index "wiki_redirects", ["wiki_id"], :name => "index_wiki_redirects_on_wiki_id" - - create_table "wikis", :force => true do |t| - t.integer "project_id", :null => false - t.string "start_page", :null => false - t.integer "status", :default => 1, :null => false - end - - add_index "wikis", ["project_id"], :name => "wikis_project_id" - - create_table "workflows", :force => true do |t| - t.integer "tracker_id", :default => 0, :null => false - t.integer "old_status_id", :default => 0, :null => false - t.integer "new_status_id", :default => 0, :null => false - t.integer "role_id", :default => 0, :null => false - t.boolean "assignee", :default => false, :null => false - t.boolean "author", :default => false, :null => false - t.string "type", :limit => 30 - t.string "field_name", :limit => 30 - t.string "rule", :limit => 30 - end - - add_index "workflows", ["new_status_id"], :name => "index_workflows_on_new_status_id" - add_index "workflows", ["old_status_id"], :name => "index_workflows_on_old_status_id" - add_index "workflows", ["role_id", "tracker_id", "old_status_id"], :name => "wkfs_role_tracker_old_status" - add_index "workflows", ["role_id"], :name => "index_workflows_on_role_id" - - create_table "works_categories", :force => true do |t| - t.string "category" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "zip_packs", :force => true do |t| - t.integer "user_id" - t.integer "homework_id" - t.string "file_digest" - t.string "file_path" - t.integer "pack_times", :default => 1 - t.integer "pack_size", :default => 0 - t.text "file_digests" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - -end - +# encoding: UTF-8 +# This file is auto-generated from the current state of the database. Instead +# of editing this file, please use the migrations feature of Active Record to +# incrementally modify your database, and then regenerate this schema definition. +# +# Note that this schema.rb definition is the authoritative source for your +# database schema. If you need to create the application database on another +# system, you should be using db:schema:load, not running all the migrations +# from scratch. The latter is a flawed and unsustainable approach (the more migrations +# you'll amass, the slower it'll run and the greater likelihood for issues). +# +# It's strongly recommended to check this file into your version control system. + +ActiveRecord::Schema.define(:version => 20151120134208) do + + create_table "activities", :force => true do |t| + t.integer "act_id", :null => false + t.string "act_type", :null => false + t.integer "user_id", :null => false + t.integer "activity_container_id" + t.string "activity_container_type", :default => "" + t.datetime "created_at" + end + + add_index "activities", ["act_id", "act_type"], :name => "index_activities_on_act_id_and_act_type" + add_index "activities", ["user_id", "act_type"], :name => "index_activities_on_user_id_and_act_type" + add_index "activities", ["user_id"], :name => "index_activities_on_user_id" + + create_table "activity_notifies", :force => true do |t| + t.integer "activity_container_id" + t.string "activity_container_type" + t.integer "activity_id" + t.string "activity_type" + t.integer "notify_to" + t.datetime "created_on" + t.integer "is_read" + end + + add_index "activity_notifies", ["activity_container_id", "activity_container_type"], :name => "index_an_activity_container_id" + add_index "activity_notifies", ["created_on"], :name => "index_an_created_on" + add_index "activity_notifies", ["notify_to"], :name => "index_an_notify_to" + + create_table "api_keys", :force => true do |t| + t.string "access_token" + t.datetime "expires_at" + t.integer "user_id" + t.boolean "active", :default => true + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + add_index "api_keys", ["access_token"], :name => "index_api_keys_on_access_token" + add_index "api_keys", ["user_id"], :name => "index_api_keys_on_user_id" + + create_table "applied_projects", :force => true do |t| + t.integer "project_id", :null => false + t.integer "user_id", :null => false + end + + create_table "apply_project_masters", :force => true do |t| + t.integer "user_id" + t.string "apply_type" + t.integer "apply_id" + t.integer "status" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "attachments", :force => true do |t| + t.integer "container_id" + t.string "container_type", :limit => 30 + t.string "filename", :default => "", :null => false + t.string "disk_filename", :default => "", :null => false + t.integer "filesize", :default => 0, :null => false + t.string "content_type", :default => "" + t.string "digest", :limit => 40, :default => "", :null => false + t.integer "downloads", :default => 0, :null => false + t.integer "author_id", :default => 0, :null => false + t.datetime "created_on" + t.string "description" + t.string "disk_directory" + t.integer "attachtype", :default => 1 + t.integer "is_public", :default => 1 + t.integer "copy_from" + t.integer "quotes" + end + + add_index "attachments", ["author_id"], :name => "index_attachments_on_author_id" + add_index "attachments", ["container_id", "container_type"], :name => "index_attachments_on_container_id_and_container_type" + add_index "attachments", ["created_on"], :name => "index_attachments_on_created_on" + + create_table "attachmentstypes", :force => true do |t| + t.integer "typeId", :null => false + t.string "typeName", :limit => 50 + end + + create_table "auth_sources", :force => true do |t| + t.string "type", :limit => 30, :default => "", :null => false + t.string "name", :limit => 60, :default => "", :null => false + t.string "host", :limit => 60 + t.integer "port" + t.string "account" + t.string "account_password", :default => "" + t.string "base_dn" + t.string "attr_login", :limit => 30 + t.string "attr_firstname", :limit => 30 + t.string "attr_lastname", :limit => 30 + t.string "attr_mail", :limit => 30 + t.boolean "onthefly_register", :default => false, :null => false + t.boolean "tls", :default => false, :null => false + t.string "filter" + t.integer "timeout" + end + + add_index "auth_sources", ["id", "type"], :name => "index_auth_sources_on_id_and_type" + + create_table "biding_projects", :force => true do |t| + t.integer "project_id" + t.integer "bid_id" + t.integer "user_id" + t.string "description" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "reward" + end + + create_table "bids", :force => true do |t| + t.string "name" + t.string "budget", :null => false + t.integer "author_id" + t.date "deadline" + t.text "description" + t.datetime "created_on", :null => false + t.datetime "updated_on", :null => false + t.integer "commit" + t.integer "reward_type" + t.integer "homework_type" + t.integer "parent_id" + t.string "password" + t.integer "is_evaluation" + t.integer "proportion", :default => 60 + t.integer "comment_status", :default => 0 + t.integer "evaluation_num", :default => 3 + t.integer "open_anonymous_evaluation", :default => 1 + end + + create_table "blog_comments", :force => true do |t| + t.integer "blog_id", :null => false + t.integer "parent_id" + t.string "title", :default => "", :null => false + t.text "content" + t.integer "author_id" + t.integer "comments_count", :default => 0, :null => false + t.integer "last_comment_id" + t.datetime "created_on", :null => false + t.datetime "updated_on", :null => false + t.boolean "locked", :default => false + t.integer "sticky", :default => 0 + t.integer "reply_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "blogs", :force => true do |t| + t.string "name", :default => "", :null => false + t.text "description" + t.integer "position", :default => 1 + t.integer "article_count", :default => 0, :null => false + t.integer "comments_count", :default => 0, :null => false + t.integer "last_comments_id" + t.integer "parent_id" + t.integer "author_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "boards", :force => true do |t| + t.integer "project_id", :null => false + t.string "name", :default => "", :null => false + t.string "description" + t.integer "position", :default => 1 + t.integer "topics_count", :default => 0, :null => false + t.integer "messages_count", :default => 0, :null => false + t.integer "last_message_id" + t.integer "parent_id" + t.integer "course_id" + end + + add_index "boards", ["last_message_id"], :name => "index_boards_on_last_message_id" + add_index "boards", ["project_id"], :name => "boards_project_id" + + create_table "bug_to_osps", :force => true do |t| + t.integer "osp_id" + t.integer "relative_memo_id" + t.string "description" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "changes", :force => true do |t| + t.integer "changeset_id", :null => false + t.string "action", :limit => 1, :default => "", :null => false + t.text "path", :null => false + t.text "from_path" + t.string "from_revision" + t.string "revision" + t.string "branch" + end + + add_index "changes", ["changeset_id"], :name => "changesets_changeset_id" + + create_table "changeset_parents", :id => false, :force => true do |t| + t.integer "changeset_id", :null => false + t.integer "parent_id", :null => false + end + + add_index "changeset_parents", ["changeset_id"], :name => "changeset_parents_changeset_ids" + add_index "changeset_parents", ["parent_id"], :name => "changeset_parents_parent_ids" + + create_table "changesets", :force => true do |t| + t.integer "repository_id", :null => false + t.string "revision", :null => false + t.string "committer" + t.datetime "committed_on", :null => false + t.text "comments" + t.date "commit_date" + t.string "scmid" + t.integer "user_id" + end + + add_index "changesets", ["committed_on"], :name => "index_changesets_on_committed_on" + add_index "changesets", ["repository_id", "revision"], :name => "changesets_repos_rev", :unique => true + add_index "changesets", ["repository_id", "scmid"], :name => "changesets_repos_scmid" + add_index "changesets", ["repository_id"], :name => "index_changesets_on_repository_id" + add_index "changesets", ["user_id"], :name => "index_changesets_on_user_id" + + create_table "changesets_issues", :id => false, :force => true do |t| + t.integer "changeset_id", :null => false + t.integer "issue_id", :null => false + end + + 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 + t.integer "author_id", :default => 0, :null => false + t.text "comments" + t.datetime "created_on", :null => false + t.datetime "updated_on", :null => false + end + + add_index "comments", ["author_id"], :name => "index_comments_on_author_id" + add_index "comments", ["commented_id", "commented_type"], :name => "index_comments_on_commented_id_and_commented_type" + + create_table "contest_notifications", :force => true do |t| + t.text "title" + t.text "content" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "contesting_projects", :force => true do |t| + t.integer "project_id" + t.string "contest_id" + t.integer "user_id" + t.string "description" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "reward" + end + + create_table "contesting_softapplications", :force => true do |t| + t.integer "softapplication_id" + t.integer "contest_id" + t.integer "user_id" + t.string "description" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "reward" + end + + create_table "contestnotifications", :force => true do |t| + t.integer "contest_id" + t.string "title" + t.string "summary" + t.text "description" + t.integer "author_id" + t.integer "notificationcomments_count" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "contests", :force => true do |t| + t.string "name" + t.string "budget", :default => "" + t.integer "author_id" + t.date "deadline" + t.string "description" + t.integer "commit" + t.string "password" + t.datetime "created_on", :null => false + t.datetime "updated_on", :null => false + end + + create_table "course_activities", :force => true do |t| + t.integer "user_id" + t.integer "course_id" + t.integer "course_act_id" + t.string "course_act_type" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "course_attachments", :force => true do |t| + t.string "filename" + t.string "disk_filename" + t.integer "filesize" + t.string "content_type" + t.string "digest" + t.integer "downloads" + t.string "author_id" + t.string "integer" + t.string "description" + t.string "disk_directory" + t.integer "attachtype" + t.integer "is_public" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "container_id", :default => 0 + end + + create_table "course_groups", :force => true do |t| + t.string "name" + t.integer "course_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "course_infos", :force => true do |t| + t.integer "course_id" + t.integer "user_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "course_messages", :force => true do |t| + t.integer "user_id" + t.integer "course_id" + t.integer "course_message_id" + t.string "course_message_type" + t.integer "viewed" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "content" + t.integer "status" + end + + create_table "course_statuses", :force => true do |t| + t.integer "changesets_count" + t.integer "watchers_count" + t.integer "course_id" + t.float "grade", :default => 0.0 + t.integer "course_ac_para", :default => 0 + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "courses", :force => true do |t| + t.integer "tea_id" + t.string "name" + t.integer "state" + t.string "code" + t.integer "time" + t.string "extra" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "location" + t.string "term" + t.string "string" + t.string "password" + t.string "setup_time" + t.string "endup_time" + t.string "class_period" + t.integer "school_id" + t.text "description" + 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 "publish_resource", :default => 0 + end + + create_table "custom_fields", :force => true do |t| + t.string "type", :limit => 30, :default => "", :null => false + t.string "name", :limit => 30, :default => "", :null => false + t.string "field_format", :limit => 30, :default => "", :null => false + t.text "possible_values" + t.string "regexp", :default => "" + t.integer "min_length", :default => 0, :null => false + t.integer "max_length", :default => 0, :null => false + t.boolean "is_required", :default => false, :null => false + t.boolean "is_for_all", :default => false, :null => false + t.boolean "is_filter", :default => false, :null => false + t.integer "position", :default => 1 + t.boolean "searchable", :default => false + t.text "default_value" + t.boolean "editable", :default => true + t.boolean "visible", :default => true, :null => false + t.boolean "multiple", :default => false + end + + add_index "custom_fields", ["id", "type"], :name => "index_custom_fields_on_id_and_type" + + create_table "custom_fields_projects", :id => false, :force => true do |t| + t.integer "custom_field_id", :default => 0, :null => false + t.integer "project_id", :default => 0, :null => false + end + + add_index "custom_fields_projects", ["custom_field_id", "project_id"], :name => "index_custom_fields_projects_on_custom_field_id_and_project_id", :unique => true + + create_table "custom_fields_trackers", :id => false, :force => true do |t| + t.integer "custom_field_id", :default => 0, :null => false + t.integer "tracker_id", :default => 0, :null => false + end + + add_index "custom_fields_trackers", ["custom_field_id", "tracker_id"], :name => "index_custom_fields_trackers_on_custom_field_id_and_tracker_id", :unique => true + + create_table "custom_values", :force => true do |t| + t.string "customized_type", :limit => 30, :default => "", :null => false + t.integer "customized_id", :default => 0, :null => false + t.integer "custom_field_id", :default => 0, :null => false + t.text "value" + end + + add_index "custom_values", ["custom_field_id"], :name => "index_custom_values_on_custom_field_id" + add_index "custom_values", ["customized_type", "customized_id"], :name => "custom_values_customized" + + create_table "delayed_jobs", :force => true do |t| + t.integer "priority", :default => 0, :null => false + t.integer "attempts", :default => 0, :null => false + t.text "handler", :null => false + t.text "last_error" + t.datetime "run_at" + t.datetime "locked_at" + t.datetime "failed_at" + t.string "locked_by" + t.string "queue" + t.datetime "created_at" + t.datetime "updated_at" + end + + 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 + t.string "title", :limit => 60, :default => "", :null => false + t.text "description" + t.datetime "created_on" + t.integer "user_id", :default => 0 + t.integer "is_public", :default => 1 + end + + add_index "documents", ["category_id"], :name => "index_documents_on_category_id" + 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 + t.string "Description" + t.text "PreConditions", :limit => 2147483647 + t.text "TraceInfo", :limit => 2147483647 + t.text "Code", :limit => 2147483647 + t.integer "project_id" + t.datetime "created_at" + t.datetime "updated_at" + t.integer "id", :null => false + end + + create_table "enabled_modules", :force => true do |t| + t.integer "project_id" + t.string "name", :null => false + t.integer "course_id" + end + + add_index "enabled_modules", ["project_id"], :name => "enabled_modules_project_id" + + create_table "enumerations", :force => true do |t| + t.string "name", :limit => 30, :default => "", :null => false + t.integer "position", :default => 1 + t.boolean "is_default", :default => false, :null => false + t.string "type" + t.boolean "active", :default => true, :null => false + t.integer "project_id" + t.integer "parent_id" + t.string "position_name", :limit => 30 + end + + add_index "enumerations", ["id", "type"], :name => "index_enumerations_on_id_and_type" + add_index "enumerations", ["project_id"], :name => "index_enumerations_on_project_id" + + create_table "exercise_answers", :force => true do |t| + t.integer "user_id" + t.integer "exercise_question_id" + t.integer "exercise_choice_id" + t.text "answer_text" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "exercise_choices", :force => true do |t| + t.integer "exercise_question_id" + t.text "choice_text" + t.integer "choice_position" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "exercise_questions", :force => true do |t| + t.text "question_title" + t.integer "question_type" + t.integer "question_number" + t.integer "exercise_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "question_score" + end + + create_table "exercise_standard_answers", :force => true do |t| + t.integer "exercise_question_id" + t.integer "exercise_choice_id" + t.text "answer_text" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "exercise_users", :force => true do |t| + t.integer "user_id" + t.integer "exercise_id" + t.integer "score" + t.datetime "start_at" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.datetime "end_at" + t.integer "status" + end + + create_table "exercises", :force => true do |t| + t.text "exercise_name" + t.text "exercise_description" + t.integer "course_id" + t.integer "exercise_status" + t.integer "user_id" + t.integer "time" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.datetime "publish_time" + t.datetime "end_time" + t.integer "show_result" + end + + create_table "first_pages", :force => true do |t| + t.string "web_title" + t.string "title" + t.text "description" + t.string "page_type" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "sort_type" + t.integer "image_width", :default => 107 + t.integer "image_height", :default => 63 + t.integer "show_course", :default => 1 + t.integer "show_contest", :default => 1 + end + + create_table "forge_activities", :force => true do |t| + t.integer "user_id" + t.integer "project_id" + t.integer "forge_act_id" + t.string "forge_act_type" + t.integer "org_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + add_index "forge_activities", ["forge_act_id"], :name => "index_forge_activities_on_forge_act_id" + + create_table "forge_messages", :force => true do |t| + t.integer "user_id" + t.integer "project_id" + t.integer "forge_message_id" + t.string "forge_message_type" + t.integer "viewed" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "secret_key" + t.integer "status" + end + + create_table "forums", :force => true do |t| + t.string "name", :null => false + t.text "description" + t.integer "topic_count", :default => 0 + t.integer "memo_count", :default => 0 + t.integer "last_memo_id", :default => 0 + t.integer "creator_id", :null => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "sticky" + t.integer "locked" + end + + create_table "groups_users", :id => false, :force => true do |t| + t.integer "group_id", :null => false + t.integer "user_id", :null => false + end + + add_index "groups_users", ["group_id", "user_id"], :name => "groups_users_ids", :unique => true + + 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.string "reward" + t.string "name" + t.text "description" + t.integer "state" + t.integer "project_id", :default => 0 + t.float "score", :default => 0.0 + t.integer "is_teacher_score", :default => 0 + end + + add_index "homework_attaches", ["bid_id"], :name => "index_homework_attaches_on_bid_id" + + create_table "homework_commons", :force => true do |t| + t.string "name" + t.integer "user_id" + t.text "description" + t.date "publish_time" + t.date "end_time" + t.integer "homework_type", :default => 1 + t.string "late_penalty" + t.integer "course_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "teacher_priority", :default => 1 + t.integer "anonymous_comment", :default => 0 + end + + create_table "homework_detail_manuals", :force => true do |t| + t.float "ta_proportion" + t.integer "comment_status" + t.date "evaluation_start" + t.date "evaluation_end" + t.integer "evaluation_num" + t.integer "absence_penalty", :default => 1 + t.integer "homework_common_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "homework_detail_programings", :force => true do |t| + t.string "language" + t.text "standard_code", :limit => 2147483647 + t.integer "homework_common_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.float "ta_proportion", :default => 0.1 + t.integer "question_id" + end + + create_table "homework_evaluations", :force => true do |t| + t.string "user_id" + t.string "homework_attach_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "homework_for_courses", :force => true do |t| + t.integer "course_id" + t.integer "bid_id" + end + + add_index "homework_for_courses", ["bid_id"], :name => "index_homework_for_courses_on_bid_id" + add_index "homework_for_courses", ["course_id"], :name => "index_homework_for_courses_on_course_id" + + create_table "homework_tests", :force => true do |t| + t.text "input" + t.text "output" + t.integer "homework_common_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "result" + t.text "error_msg" + end + + create_table "homework_users", :force => true do |t| + t.string "homework_attach_id" + t.string "user_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "invite_lists", :force => true do |t| + t.integer "project_id" + t.integer "user_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "mail" + end + + create_table "issue_categories", :force => true do |t| + t.integer "project_id", :default => 0, :null => false + t.string "name", :limit => 30, :default => "", :null => false + t.integer "assigned_to_id" + end + + add_index "issue_categories", ["assigned_to_id"], :name => "index_issue_categories_on_assigned_to_id" + add_index "issue_categories", ["project_id"], :name => "issue_categories_project_id" + + create_table "issue_relations", :force => true do |t| + t.integer "issue_from_id", :null => false + t.integer "issue_to_id", :null => false + t.string "relation_type", :default => "", :null => false + t.integer "delay" + end + + add_index "issue_relations", ["issue_from_id", "issue_to_id"], :name => "index_issue_relations_on_issue_from_id_and_issue_to_id", :unique => true + add_index "issue_relations", ["issue_from_id"], :name => "index_issue_relations_on_issue_from_id" + add_index "issue_relations", ["issue_to_id"], :name => "index_issue_relations_on_issue_to_id" + + create_table "issue_statuses", :force => true do |t| + t.string "name", :limit => 30, :default => "", :null => false + t.boolean "is_closed", :default => false, :null => false + t.boolean "is_default", :default => false, :null => false + t.integer "position", :default => 1 + t.integer "default_done_ratio" + end + + add_index "issue_statuses", ["is_closed"], :name => "index_issue_statuses_on_is_closed" + add_index "issue_statuses", ["is_default"], :name => "index_issue_statuses_on_is_default" + add_index "issue_statuses", ["position"], :name => "index_issue_statuses_on_position" + + create_table "issues", :force => true do |t| + t.integer "tracker_id", :null => false + t.integer "project_id", :null => false + t.string "subject", :default => "", :null => false + t.text "description" + t.date "due_date" + t.integer "category_id" + t.integer "status_id", :null => false + t.integer "assigned_to_id" + t.integer "priority_id", :null => false + t.integer "fixed_version_id" + t.integer "author_id", :null => false + t.integer "lock_version", :default => 0, :null => false + t.datetime "created_on" + t.datetime "updated_on" + t.date "start_date" + t.integer "done_ratio", :default => 0, :null => false + t.float "estimated_hours" + t.integer "parent_id" + t.integer "root_id" + t.integer "lft" + t.integer "rgt" + t.boolean "is_private", :default => false, :null => false + t.datetime "closed_on" + t.integer "project_issues_index" + end + + add_index "issues", ["assigned_to_id"], :name => "index_issues_on_assigned_to_id" + add_index "issues", ["author_id"], :name => "index_issues_on_author_id" + add_index "issues", ["category_id"], :name => "index_issues_on_category_id" + add_index "issues", ["created_on"], :name => "index_issues_on_created_on" + add_index "issues", ["fixed_version_id"], :name => "index_issues_on_fixed_version_id" + add_index "issues", ["priority_id"], :name => "index_issues_on_priority_id" + add_index "issues", ["project_id"], :name => "issues_project_id" + add_index "issues", ["root_id", "lft", "rgt"], :name => "index_issues_on_root_id_and_lft_and_rgt" + add_index "issues", ["status_id"], :name => "index_issues_on_status_id" + add_index "issues", ["tracker_id"], :name => "index_issues_on_tracker_id" + + create_table "join_in_competitions", :force => true do |t| + t.integer "user_id" + t.integer "competition_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "join_in_contests", :force => true do |t| + t.integer "user_id" + t.integer "bid_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "journal_details", :force => true do |t| + t.integer "journal_id", :default => 0, :null => false + t.string "property", :limit => 30, :default => "", :null => false + t.string "prop_key", :limit => 30, :default => "", :null => false + t.text "old_value" + t.text "value" + end + + add_index "journal_details", ["journal_id"], :name => "journal_details_journal_id" + + create_table "journal_replies", :id => false, :force => true do |t| + t.integer "journal_id" + t.integer "user_id" + t.integer "reply_id" + end + + add_index "journal_replies", ["journal_id"], :name => "index_journal_replies_on_journal_id" + add_index "journal_replies", ["reply_id"], :name => "index_journal_replies_on_reply_id" + add_index "journal_replies", ["user_id"], :name => "index_journal_replies_on_user_id" + + create_table "journals", :force => true do |t| + t.integer "journalized_id", :default => 0, :null => false + t.string "journalized_type", :limit => 30, :default => "", :null => false + t.integer "user_id", :default => 0, :null => false + t.text "notes" + t.datetime "created_on", :null => false + t.boolean "private_notes", :default => false, :null => false + end + + add_index "journals", ["created_on"], :name => "index_journals_on_created_on" + add_index "journals", ["journalized_id", "journalized_type"], :name => "journals_journalized_id" + add_index "journals", ["journalized_id"], :name => "index_journals_on_journalized_id" + add_index "journals", ["user_id"], :name => "index_journals_on_user_id" + + create_table "journals_for_messages", :force => true do |t| + t.integer "jour_id" + t.string "jour_type" + t.integer "user_id" + t.text "notes" + t.integer "status" + t.integer "reply_id" + t.datetime "created_on", :null => false + t.datetime "updated_on", :null => false + t.string "m_parent_id" + t.boolean "is_readed" + t.integer "m_reply_count" + t.integer "m_reply_id" + t.integer "is_comprehensive_evaluation" + end + + create_table "kindeditor_assets", :force => true do |t| + t.string "asset" + t.integer "file_size" + t.string "file_type" + t.integer "owner_id" + t.string "asset_type" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "owner_type", :default => 0 + end + + create_table "member_roles", :force => true do |t| + t.integer "member_id", :null => false + t.integer "role_id", :null => false + t.integer "inherited_from" + end + + add_index "member_roles", ["member_id"], :name => "index_member_roles_on_member_id" + add_index "member_roles", ["role_id"], :name => "index_member_roles_on_role_id" + + create_table "members", :force => true do |t| + t.integer "user_id", :default => 0, :null => false + t.integer "project_id", :default => 0 + t.datetime "created_on" + t.boolean "mail_notification", :default => false, :null => false + t.integer "course_id", :default => -1 + t.integer "course_group_id", :default => 0 + end + + add_index "members", ["project_id"], :name => "index_members_on_project_id" + add_index "members", ["user_id", "project_id", "course_id"], :name => "index_members_on_user_id_and_project_id", :unique => true + add_index "members", ["user_id"], :name => "index_members_on_user_id" + + create_table "memo_messages", :force => true do |t| + t.integer "user_id" + t.integer "forum_id" + t.integer "memo_id" + t.string "memo_type" + t.integer "viewed" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "memos", :force => true do |t| + t.integer "forum_id", :null => false + t.integer "parent_id" + t.string "subject", :null => false + t.text "content", :null => false + t.integer "author_id", :null => false + t.integer "replies_count", :default => 0 + t.integer "last_reply_id" + t.boolean "lock", :default => false + t.boolean "sticky", :default => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "viewed_count", :default => 0 + end + + create_table "message_alls", :force => true do |t| + t.integer "user_id" + t.integer "message_id" + t.string "message_type" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "messages", :force => true do |t| + t.integer "board_id", :null => false + t.integer "parent_id" + t.string "subject", :default => "", :null => false + t.text "content" + t.integer "author_id" + t.integer "replies_count", :default => 0, :null => false + t.integer "last_reply_id" + t.datetime "created_on", :null => false + t.datetime "updated_on", :null => false + t.boolean "locked", :default => false + t.integer "sticky", :default => 0 + t.integer "reply_id" + end + + add_index "messages", ["author_id"], :name => "index_messages_on_author_id" + add_index "messages", ["board_id"], :name => "messages_board_id" + add_index "messages", ["created_on"], :name => "index_messages_on_created_on" + add_index "messages", ["last_reply_id"], :name => "index_messages_on_last_reply_id" + add_index "messages", ["parent_id"], :name => "messages_parent_id" + + create_table "news", :force => true do |t| + t.integer "project_id" + t.string "title", :limit => 60, :default => "", :null => false + t.string "summary", :default => "" + t.text "description" + t.integer "author_id", :default => 0, :null => false + t.datetime "created_on" + t.integer "comments_count", :default => 0, :null => false + t.integer "course_id" + t.integer "sticky", :default => 0 + end + + add_index "news", ["author_id"], :name => "index_news_on_author_id" + add_index "news", ["created_on"], :name => "index_news_on_created_on" + add_index "news", ["project_id"], :name => "news_project_id" + + create_table "no_uses", :force => true do |t| + t.integer "user_id", :null => false + t.string "no_use_type" + t.integer "no_use_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "notificationcomments", :force => true do |t| + t.string "notificationcommented_type" + t.integer "notificationcommented_id" + t.integer "author_id" + t.text "notificationcomments" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "onclick_times", :force => true do |t| + t.integer "user_id" + t.datetime "onclick_time" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "open_id_authentication_associations", :force => true do |t| + t.integer "issued" + t.integer "lifetime" + t.string "handle" + t.string "assoc_type" + t.binary "server_url" + t.binary "secret" + end + + create_table "open_id_authentication_nonces", :force => true do |t| + t.integer "timestamp", :null => false + t.string "server_url" + t.string "salt", :null => false + end + + create_table "open_source_projects", :force => true do |t| + t.string "name" + t.text "description" + t.integer "commit_count", :default => 0 + t.integer "code_line", :default => 0 + t.integer "users_count", :default => 0 + t.date "last_commit_time" + t.string "url" + t.date "date_collected" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "option_numbers", :force => true do |t| + t.integer "user_id" + t.integer "memo" + t.integer "messages_for_issues" + t.integer "issues_status" + t.integer "replay_for_message" + t.integer "replay_for_memo" + t.integer "follow" + t.integer "tread" + t.integer "praise_by_one" + t.integer "praise_by_two" + t.integer "praise_by_three" + t.integer "tread_by_one" + t.integer "tread_by_two" + t.integer "tread_by_three" + t.integer "changeset" + t.integer "document" + t.integer "attachment" + t.integer "issue_done_ratio" + t.integer "post_issue" + t.integer "score_type" + t.integer "total_score" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "project_id" + end + + create_table "org_activities", :force => true do |t| + t.integer "user_id" + t.integer "org_act_id" + t.string "org_act_type" + t.integer "container_id" + t.string "container_type" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "org_courses", :force => true do |t| + t.integer "organization_id" + t.integer "course_id" + t.datetime "created_at" + end + + create_table "org_document_comments", :force => true do |t| + t.text "title" + t.text "content" + t.integer "organization_id" + t.integer "creator_id" + t.integer "parent_id" + t.integer "reply_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.boolean "locked", :default => false + t.integer "sticky", :default => 0 + end + + create_table "org_member_roles", :force => true do |t| + t.integer "org_member_id" + t.integer "role_id" + end + + create_table "org_members", :force => true do |t| + t.integer "user_id" + t.integer "organization_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "org_projects", :force => true do |t| + t.integer "organization_id" + t.integer "project_id" + t.datetime "created_at" + end + + create_table "organizations", :force => true do |t| + t.string "name" + t.text "description" + t.integer "creator_id" + t.integer "home_id" + t.string "domain" + t.boolean "is_public" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "phone_app_versions", :force => true do |t| + t.string "version" + t.text "description" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "poll_answers", :force => true do |t| + t.integer "poll_question_id" + t.text "answer_text" + t.integer "answer_position" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "poll_questions", :force => true do |t| + t.string "question_title" + t.integer "question_type" + t.integer "is_necessary" + t.integer "poll_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "question_number" + end + + create_table "poll_users", :force => true do |t| + t.integer "user_id" + t.integer "poll_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "poll_votes", :force => true do |t| + t.integer "user_id" + t.integer "poll_question_id" + t.integer "poll_answer_id" + t.text "vote_text" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "polls", :force => true do |t| + t.string "polls_name" + t.string "polls_type" + t.integer "polls_group_id" + t.integer "polls_status" + t.integer "user_id" + t.datetime "published_at" + t.datetime "closed_at" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.text "polls_description" + t.integer "show_result", :default => 1 + end + + create_table "praise_tread_caches", :force => true do |t| + t.integer "object_id", :null => false + t.string "object_type" + t.integer "praise_num" + t.integer "tread_num" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "praise_treads", :force => true do |t| + t.integer "user_id", :null => false + t.integer "praise_tread_object_id" + t.string "praise_tread_object_type" + t.integer "praise_or_tread" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "principal_activities", :force => true do |t| + t.integer "user_id" + t.integer "principal_id" + t.integer "principal_act_id" + t.string "principal_act_type" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "project_infos", :force => true do |t| + t.integer "project_id" + t.integer "user_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "project_scores", :force => true do |t| + t.string "project_id" + t.integer "score" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "issue_num", :default => 0 + t.integer "issue_journal_num", :default => 0 + t.integer "news_num", :default => 0 + t.integer "documents_num", :default => 0 + t.integer "changeset_num", :default => 0 + t.integer "board_message_num", :default => 0 + end + + create_table "project_statuses", :force => true do |t| + t.integer "changesets_count" + t.integer "watchers_count" + t.integer "project_id" + t.integer "project_type" + t.float "grade", :default => 0.0 + t.integer "course_ac_para", :default => 0 + end + + add_index "project_statuses", ["grade"], :name => "index_project_statuses_on_grade" + + create_table "projecting_softapplictions", :force => true do |t| + t.integer "user_id" + t.integer "softapplication_id" + t.integer "project_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "projects", :force => true do |t| + t.string "name", :default => "", :null => false + t.text "description" + t.string "homepage", :default => "" + t.boolean "is_public", :default => true, :null => false + t.integer "parent_id" + t.datetime "created_on" + t.datetime "updated_on" + t.string "identifier" + t.integer "status", :default => 1, :null => false + t.integer "lft" + t.integer "rgt" + t.boolean "inherit_members", :default => false, :null => false + t.integer "project_type" + t.boolean "hidden_repo", :default => false, :null => false + t.integer "attachmenttype", :default => 1 + t.integer "user_id" + t.integer "dts_test", :default => 0 + t.string "enterprise_name" + t.integer "organization_id" + t.integer "project_new_type" + t.integer "gpid" + end + + add_index "projects", ["lft"], :name => "index_projects_on_lft" + add_index "projects", ["rgt"], :name => "index_projects_on_rgt" + + create_table "projects_trackers", :id => false, :force => true do |t| + t.integer "project_id", :default => 0, :null => false + t.integer "tracker_id", :default => 0, :null => false + end + + add_index "projects_trackers", ["project_id", "tracker_id"], :name => "projects_trackers_unique", :unique => true + add_index "projects_trackers", ["project_id"], :name => "projects_trackers_project_id" + + create_table "queries", :force => true do |t| + t.integer "project_id" + t.string "name", :default => "", :null => false + t.text "filters" + t.integer "user_id", :default => 0, :null => false + t.boolean "is_public", :default => false, :null => false + t.text "column_names" + t.text "sort_criteria" + t.string "group_by" + t.string "type" + end + + add_index "queries", ["project_id"], :name => "index_queries_on_project_id" + add_index "queries", ["user_id"], :name => "index_queries_on_user_id" + + create_table "relative_memo_to_open_source_projects", :force => true do |t| + t.integer "osp_id" + t.integer "relative_memo_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "relative_memos", :force => true do |t| + t.integer "osp_id" + t.integer "parent_id" + t.string "subject", :null => false + t.text "content", :limit => 16777215, :null => false + t.integer "author_id" + t.integer "replies_count", :default => 0 + t.integer "last_reply_id" + t.boolean "lock", :default => false + t.boolean "sticky", :default => false + t.boolean "is_quote", :default => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "viewed_count_crawl", :default => 0 + t.integer "viewed_count_local", :default => 0 + t.string "url" + t.string "username" + t.string "userhomeurl" + t.date "date_collected" + t.string "topic_resource" + end + + create_table "repositories", :force => true do |t| + t.integer "project_id", :default => 0, :null => false + t.string "url", :default => "", :null => false + t.string "login", :limit => 60, :default => "" + t.string "password", :default => "" + t.string "root_url", :default => "" + t.string "type" + t.string "path_encoding", :limit => 64 + t.string "log_encoding", :limit => 64 + t.text "extra_info" + t.string "identifier" + t.boolean "is_default", :default => false + t.boolean "hidden", :default => false + end + + add_index "repositories", ["project_id"], :name => "index_repositories_on_project_id" + + create_table "rich_rich_files", :force => true do |t| + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "rich_file_file_name" + t.string "rich_file_content_type" + t.integer "rich_file_file_size" + t.datetime "rich_file_updated_at" + t.string "owner_type" + t.integer "owner_id" + t.text "uri_cache" + t.string "simplified_type", :default => "file" + end + + create_table "roles", :force => true do |t| + t.string "name", :limit => 30, :default => "", :null => false + t.integer "position", :default => 1 + t.boolean "assignable", :default => true + t.integer "builtin", :default => 0, :null => false + t.text "permissions" + t.string "issues_visibility", :limit => 30, :default => "default", :null => false + end + + create_table "schools", :force => true do |t| + t.string "name" + t.string "province" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "logo_link" + t.string "pinyin" + end + + create_table "seems_rateable_cached_ratings", :force => true do |t| + t.integer "cacheable_id", :limit => 8 + t.string "cacheable_type" + t.float "avg", :null => false + t.integer "cnt", :null => false + t.string "dimension" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "seems_rateable_rates", :force => true do |t| + t.integer "rater_id", :limit => 8 + t.integer "rateable_id" + t.string "rateable_type" + t.float "stars", :null => false + t.string "dimension" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "is_teacher_score", :default => 0 + end + + create_table "settings", :force => true do |t| + t.string "name", :default => "", :null => false + t.text "value" + t.datetime "updated_on" + end + + add_index "settings", ["name"], :name => "index_settings_on_name" + + create_table "shares", :force => true do |t| + t.date "created_on" + t.string "url" + t.string "title" + t.integer "share_type" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "project_id" + t.integer "user_id" + t.string "description" + end + + create_table "softapplications", :force => true do |t| + t.string "name" + t.text "description" + t.integer "app_type_id" + t.string "app_type_name" + t.string "android_min_version_available" + t.integer "user_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "contest_id" + t.integer "softapplication_id" + t.integer "is_public" + t.string "application_developers" + t.string "deposit_project_url" + t.string "deposit_project" + t.integer "project_id" + end + + create_table "student_work_tests", :force => true do |t| + t.integer "student_work_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "status", :default => 9 + t.text "results" + t.text "src" + end + + create_table "student_works", :force => true do |t| + t.string "name" + t.text "description", :limit => 2147483647 + t.integer "homework_common_id" + t.integer "user_id" + t.float "final_score" + t.float "teacher_score" + t.float "student_score" + t.float "teaching_asistant_score" + t.integer "project_id", :default => 0 + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "late_penalty", :default => 0 + t.integer "absence_penalty", :default => 0 + t.float "system_score", :default => 0.0 + t.boolean "is_test", :default => false + end + + create_table "student_works_evaluation_distributions", :force => true do |t| + t.integer "student_work_id" + t.integer "user_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "student_works_scores", :force => true do |t| + t.integer "student_work_id" + t.integer "user_id" + t.integer "score" + t.text "comment" + t.integer "reviewer_role" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "students_for_courses", :force => true do |t| + t.integer "student_id" + t.integer "course_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + add_index "students_for_courses", ["course_id"], :name => "index_students_for_courses_on_course_id" + add_index "students_for_courses", ["student_id"], :name => "index_students_for_courses_on_student_id" + + create_table "system_messages", :force => true do |t| + t.integer "user_id" + t.string "content" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.text "description" + t.string "subject" + end + + create_table "taggings", :force => true do |t| + t.integer "tag_id" + t.integer "taggable_id" + t.string "taggable_type" + t.integer "tagger_id" + t.string "tagger_type" + t.string "context", :limit => 128 + t.datetime "created_at" + end + + add_index "taggings", ["tag_id"], :name => "index_taggings_on_tag_id" + add_index "taggings", ["taggable_id", "taggable_type", "context"], :name => "index_taggings_on_taggable_id_and_taggable_type_and_context" + add_index "taggings", ["taggable_type"], :name => "index_taggings_on_taggable_type" + + create_table "tags", :force => true do |t| + t.string "name" + end + + create_table "teachers", :force => true do |t| + t.string "tea_name" + t.string "location" + t.integer "couurse_time" + t.integer "course_code" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "extra" + end + + create_table "time_entries", :force => true do |t| + t.integer "project_id", :null => false + t.integer "user_id", :null => false + t.integer "issue_id" + t.float "hours", :null => false + t.string "comments" + t.integer "activity_id", :null => false + t.date "spent_on", :null => false + t.integer "tyear", :null => false + t.integer "tmonth", :null => false + t.integer "tweek", :null => false + t.datetime "created_on", :null => false + t.datetime "updated_on", :null => false + end + + add_index "time_entries", ["activity_id"], :name => "index_time_entries_on_activity_id" + add_index "time_entries", ["created_on"], :name => "index_time_entries_on_created_on" + add_index "time_entries", ["issue_id"], :name => "time_entries_issue_id" + add_index "time_entries", ["project_id"], :name => "time_entries_project_id" + add_index "time_entries", ["user_id"], :name => "index_time_entries_on_user_id" + + create_table "tokens", :force => true do |t| + t.integer "user_id", :default => 0, :null => false + t.string "action", :limit => 30, :default => "", :null => false + t.string "value", :limit => 40, :default => "", :null => false + t.datetime "created_on", :null => false + end + + add_index "tokens", ["user_id"], :name => "index_tokens_on_user_id" + add_index "tokens", ["value"], :name => "tokens_value", :unique => true + + create_table "trackers", :force => true do |t| + t.string "name", :limit => 30, :default => "", :null => false + t.boolean "is_in_chlog", :default => false, :null => false + t.integer "position", :default => 1 + t.boolean "is_in_roadmap", :default => true, :null => false + t.integer "fields_bits", :default => 0 + end + + create_table "user_activities", :force => true do |t| + t.string "act_type" + t.integer "act_id" + t.string "container_type" + t.integer "container_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "user_id" + end + + create_table "user_extensions", :force => true do |t| + t.integer "user_id", :null => false + t.date "birthday" + t.string "brief_introduction" + t.integer "gender" + t.string "location" + t.string "occupation" + t.integer "work_experience" + t.integer "zip_code" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "technical_title" + t.integer "identity" + t.string "student_id" + t.string "teacher_realname" + t.string "student_realname" + t.string "location_city" + t.integer "school_id" + t.string "description", :default => "" + end + + create_table "user_feedback_messages", :force => true do |t| + t.integer "user_id" + t.integer "journals_for_message_id" + t.string "journals_for_message_type" + t.integer "viewed" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "user_grades", :force => true do |t| + t.integer "user_id", :null => false + t.integer "project_id", :null => false + t.float "grade", :default => 0.0 + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + add_index "user_grades", ["grade"], :name => "index_user_grades_on_grade" + add_index "user_grades", ["project_id"], :name => "index_user_grades_on_project_id" + add_index "user_grades", ["user_id"], :name => "index_user_grades_on_user_id" + + create_table "user_levels", :force => true do |t| + t.integer "user_id" + t.integer "level" + end + + create_table "user_preferences", :force => true do |t| + t.integer "user_id", :default => 0, :null => false + t.text "others" + t.boolean "hide_mail", :default => false + t.string "time_zone" + end + + add_index "user_preferences", ["user_id"], :name => "index_user_preferences_on_user_id" + + create_table "user_score_details", :force => true do |t| + t.integer "current_user_id" + t.integer "target_user_id" + t.string "score_type" + t.string "score_action" + t.integer "user_id" + t.integer "old_score" + t.integer "new_score" + t.integer "current_user_level" + t.integer "target_user_level" + t.integer "score_changeable_obj_id" + t.string "score_changeable_obj_type" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + 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 + end + + create_table "user_statuses", :force => true do |t| + t.integer "changesets_count" + t.integer "watchers_count" + t.integer "user_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.float "grade", :default => 0.0 + end + + add_index "user_statuses", ["changesets_count"], :name => "index_user_statuses_on_changesets_count" + add_index "user_statuses", ["grade"], :name => "index_user_statuses_on_grade" + add_index "user_statuses", ["watchers_count"], :name => "index_user_statuses_on_watchers_count" + + create_table "users", :force => true do |t| + t.string "login", :default => "", :null => false + t.string "hashed_password", :limit => 40, :default => "", :null => false + t.string "firstname", :limit => 30, :default => "", :null => false + t.string "lastname", :default => "", :null => false + t.string "mail", :limit => 60, :default => "", :null => false + t.boolean "admin", :default => false, :null => false + t.integer "status", :default => 1, :null => false + t.datetime "last_login_on" + t.string "language", :limit => 5, :default => "" + t.integer "auth_source_id" + t.datetime "created_on" + t.datetime "updated_on" + t.string "type" + t.string "identity_url" + t.string "mail_notification", :default => "", :null => false + t.string "salt", :limit => 64 + t.integer "gid" + end + + add_index "users", ["auth_source_id"], :name => "index_users_on_auth_source_id" + add_index "users", ["id", "type"], :name => "index_users_on_id_and_type" + add_index "users", ["type"], :name => "index_users_on_type" + + create_table "versions", :force => true do |t| + t.integer "project_id", :default => 0, :null => false + t.string "name", :default => "", :null => false + t.string "description", :default => "" + t.date "effective_date" + t.datetime "created_on" + t.datetime "updated_on" + t.string "wiki_page_title" + t.string "status", :default => "open" + t.string "sharing", :default => "none", :null => false + end + + add_index "versions", ["project_id"], :name => "versions_project_id" + add_index "versions", ["sharing"], :name => "index_versions_on_sharing" + + create_table "visitors", :force => true do |t| + t.integer "user_id" + t.integer "master_id" + t.datetime "updated_on" + t.datetime "created_on" + end + + add_index "visitors", ["master_id"], :name => "index_visitors_master_id" + add_index "visitors", ["updated_on"], :name => "index_visitors_updated_on" + add_index "visitors", ["user_id"], :name => "index_visitors_user_id" + + create_table "watchers", :force => true do |t| + t.string "watchable_type", :default => "", :null => false + t.integer "watchable_id", :default => 0, :null => false + t.integer "user_id" + end + + add_index "watchers", ["user_id", "watchable_type"], :name => "watchers_user_id_type" + add_index "watchers", ["user_id"], :name => "index_watchers_on_user_id" + add_index "watchers", ["watchable_id", "watchable_type"], :name => "index_watchers_on_watchable_id_and_watchable_type" + + create_table "web_footer_companies", :force => true do |t| + t.string "name" + t.string "logo_size" + t.string "url" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "web_footer_oranizers", :force => true do |t| + t.string "name" + t.text "description" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "wiki_content_versions", :force => true do |t| + t.integer "wiki_content_id", :null => false + t.integer "page_id", :null => false + t.integer "author_id" + t.binary "data", :limit => 2147483647 + t.string "compression", :limit => 6, :default => "" + t.string "comments", :default => "" + t.datetime "updated_on", :null => false + t.integer "version", :null => false + end + + add_index "wiki_content_versions", ["updated_on"], :name => "index_wiki_content_versions_on_updated_on" + add_index "wiki_content_versions", ["wiki_content_id"], :name => "wiki_content_versions_wcid" + + create_table "wiki_contents", :force => true do |t| + t.integer "page_id", :null => false + t.integer "author_id" + t.text "text", :limit => 2147483647 + t.string "comments", :default => "" + t.datetime "updated_on", :null => false + t.integer "version", :null => false + end + + add_index "wiki_contents", ["author_id"], :name => "index_wiki_contents_on_author_id" + add_index "wiki_contents", ["page_id"], :name => "wiki_contents_page_id" + + create_table "wiki_pages", :force => true do |t| + t.integer "wiki_id", :null => false + t.string "title", :null => false + t.datetime "created_on", :null => false + t.boolean "protected", :default => false, :null => false + t.integer "parent_id" + end + + add_index "wiki_pages", ["parent_id"], :name => "index_wiki_pages_on_parent_id" + add_index "wiki_pages", ["wiki_id", "title"], :name => "wiki_pages_wiki_id_title" + add_index "wiki_pages", ["wiki_id"], :name => "index_wiki_pages_on_wiki_id" + + create_table "wiki_redirects", :force => true do |t| + t.integer "wiki_id", :null => false + t.string "title" + t.string "redirects_to" + t.datetime "created_on", :null => false + end + + add_index "wiki_redirects", ["wiki_id", "title"], :name => "wiki_redirects_wiki_id_title" + add_index "wiki_redirects", ["wiki_id"], :name => "index_wiki_redirects_on_wiki_id" + + create_table "wikis", :force => true do |t| + t.integer "project_id", :null => false + t.string "start_page", :null => false + t.integer "status", :default => 1, :null => false + end + + add_index "wikis", ["project_id"], :name => "wikis_project_id" + + create_table "workflows", :force => true do |t| + t.integer "tracker_id", :default => 0, :null => false + t.integer "old_status_id", :default => 0, :null => false + t.integer "new_status_id", :default => 0, :null => false + t.integer "role_id", :default => 0, :null => false + t.boolean "assignee", :default => false, :null => false + t.boolean "author", :default => false, :null => false + t.string "type", :limit => 30 + t.string "field_name", :limit => 30 + t.string "rule", :limit => 30 + end + + add_index "workflows", ["new_status_id"], :name => "index_workflows_on_new_status_id" + add_index "workflows", ["old_status_id"], :name => "index_workflows_on_old_status_id" + add_index "workflows", ["role_id", "tracker_id", "old_status_id"], :name => "wkfs_role_tracker_old_status" + add_index "workflows", ["role_id"], :name => "index_workflows_on_role_id" + + create_table "works_categories", :force => true do |t| + t.string "category" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "zip_packs", :force => true do |t| + t.integer "user_id" + t.integer "homework_id" + t.string "file_digest" + t.string "file_path" + t.integer "pack_times", :default => 1 + t.integer "pack_size", :default => 0 + t.text "file_digests" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + +end