Merge branch 'develop' of https://git.trustie.net/jacknudt/trustieforge into develop

This commit is contained in:
cxt 2015-12-31 17:58:59 +08:00
commit 7f751cfc63
2 changed files with 234 additions and 50 deletions

View File

@ -229,7 +229,11 @@ class AttachmentsController < ApplicationController
@attachment.container.init_journal(User.current)
end
if @attachment.container
@attachment.container.attachments.delete(@attachment)
if @attachment.container_type == "Issue"
@attachment.destroy
else
@attachment.container.attachments.delete(@attachment)
end
else
@attachment.destroy
end

View File

@ -11,8 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20151102090519) do
ActiveRecord::Schema.define(:version => 20151231023610) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
@ -67,6 +66,41 @@ ActiveRecord::Schema.define(:version => 20151102090519) do
t.datetime "updated_at", :null => false
end
create_table "at_messages", :force => true do |t|
t.integer "user_id"
t.integer "at_message_id"
t.string "at_message_type"
t.boolean "viewed", :default => false
t.string "container_type"
t.integer "container_id"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.integer "sender_id"
end
add_index "at_messages", ["user_id"], :name => "index_at_messages_on_user_id"
create_table "attachment_histories", :force => true do |t|
t.integer "container_id"
t.string "container_type"
t.string "filename", :default => ""
t.string "disk_filename", :default => ""
t.integer "filesize", :default => 0
t.string "content_type", :default => ""
t.string "digest", :limit => 40, :default => ""
t.integer "downloads", :default => 0
t.integer "author_id"
t.datetime "created_on"
t.string "description"
t.string "disk_directory"
t.integer "attachtype"
t.integer "is_public"
t.integer "copy_from"
t.integer "quotes"
t.integer "version"
t.integer "attachment_id"
end
create_table "attachments", :force => true do |t|
t.integer "container_id"
t.string "container_type", :limit => 30
@ -384,6 +418,20 @@ ActiveRecord::Schema.define(:version => 20151102090519) do
t.integer "container_id", :default => 0
end
create_table "course_contributor_scores", :force => true do |t|
t.integer "course_id"
t.integer "user_id"
t.integer "message_num"
t.integer "message_reply_num"
t.integer "news_reply_num"
t.integer "resource_num"
t.integer "journal_num"
t.integer "journal_reply_num"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.integer "total_score"
end
create_table "course_groups", :force => true do |t|
t.string "name"
t.integer "course_id"
@ -427,8 +475,8 @@ ActiveRecord::Schema.define(:version => 20151102090519) do
t.string "code"
t.integer "time"
t.string "extra"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.string "location"
t.string "term"
t.string "string"
@ -438,14 +486,16 @@ ActiveRecord::Schema.define(:version => 20151102090519) do
t.string "class_period"
t.integer "school_id"
t.text "description"
t.integer "status", :default => 1
t.integer "attachmenttype", :default => 2
t.integer "status", :default => 1
t.integer "attachmenttype", :default => 2
t.integer "lft"
t.integer "rgt"
t.integer "is_public", :limit => 1, :default => 1
t.integer "inherit_members", :limit => 1, :default => 1
t.integer "open_student", :default => 0
t.integer "outline", :default => 0
t.integer "is_public", :limit => 1, :default => 1
t.integer "inherit_members", :limit => 1, :default => 1
t.integer "open_student", :default => 0
t.integer "outline", :default => 0
t.integer "publish_resource", :default => 0
t.integer "is_delete", :default => 0
t.integer "end_time"
t.string "end_term"
end
@ -532,23 +582,32 @@ ActiveRecord::Schema.define(:version => 20151102090519) 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 "editor_of_documents", :force => true do |t|
t.integer "editor_id"
t.integer "org_document_comment_id"
t.datetime "created_at"
end
create_table "enabled_modules", :force => true do |t|
@ -573,6 +632,66 @@ ActiveRecord::Schema.define(:version => 20151102090519) 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.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"
@ -662,6 +781,19 @@ ActiveRecord::Schema.define(:version => 20151102090519) do
t.integer "anonymous_comment", :default => 0
end
add_index "homework_commons", ["course_id", "id"], :name => "index_homework_commons_on_course_id_and_id"
create_table "homework_detail_groups", :force => true do |t|
t.integer "homework_common_id"
t.integer "min_num"
t.integer "max_num"
t.integer "base_on_project"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
add_index "homework_detail_groups", ["homework_common_id"], :name => "index_homework_detail_groups_on_homework_common_id"
create_table "homework_detail_manuals", :force => true do |t|
t.float "ta_proportion"
t.integer "comment_status"
@ -818,16 +950,6 @@ ActiveRecord::Schema.define(:version => 20151102090519) 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"
@ -947,6 +1069,7 @@ ActiveRecord::Schema.define(:version => 20151102090519) do
t.boolean "locked", :default => false
t.integer "sticky", :default => 0
t.integer "reply_id"
t.integer "quotes"
end
add_index "messages", ["author_id"], :name => "index_messages_on_author_id"
@ -964,6 +1087,7 @@ ActiveRecord::Schema.define(:version => 20151102090519) 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"
@ -1049,10 +1173,46 @@ ActiveRecord::Schema.define(:version => 20151102090519) do
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
t.integer "org_subfield_id"
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.string "role"
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|
@ -1212,27 +1372,30 @@ ActiveRecord::Schema.define(:version => 20151102090519) do
end
create_table "projects", :force => true do |t|
t.string "name", :default => "", :null => false
t.string "name", :default => "", :null => false
t.text "description"
t.string "homepage", :default => ""
t.boolean "is_public", :default => true, :null => false
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 "status", :default => 1, :null => false
t.integer "lft"
t.integer "rgt"
t.boolean "inherit_members", :default => false, :null => false
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.boolean "hidden_repo", :default => false, :null => false
t.integer "attachmenttype", :default => 1
t.integer "user_id"
t.integer "dts_test", :default => 0
t.integer "dts_test", :default => 0
t.string "enterprise_name"
t.integer "organization_id"
t.integer "project_new_type"
t.integer "gpid"
t.integer "forked_from_project_id"
t.integer "forked_count"
t.integer "commits_count", :default => 0
end
add_index "projects", ["lft"], :name => "index_projects_on_lft"
@ -1397,6 +1560,21 @@ ActiveRecord::Schema.define(:version => 20151102090519) do
t.integer "project_id"
end
create_table "student_work_projects", :force => true do |t|
t.integer "homework_common_id"
t.integer "student_work_id"
t.integer "project_id"
t.integer "user_id"
t.integer "is_leader"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
add_index "student_work_projects", ["homework_common_id"], :name => "index_student_work_projects_on_homework_common_id"
add_index "student_work_projects", ["project_id"], :name => "index_student_work_projects_on_project_id"
add_index "student_work_projects", ["student_work_id"], :name => "index_student_work_projects_on_student_work_id"
add_index "student_work_projects", ["user_id"], :name => "index_student_work_projects_on_user_id"
create_table "student_work_tests", :force => true do |t|
t.integer "student_work_id"
t.datetime "created_at", :null => false
@ -1424,6 +1602,8 @@ ActiveRecord::Schema.define(:version => 20151102090519) do
t.boolean "is_test", :default => false
end
add_index "student_works", ["homework_common_id", "user_id"], :name => "index_student_works_on_homework_common_id_and_user_id"
create_table "student_works_evaluation_distributions", :force => true do |t|
t.integer "student_work_id"
t.integer "user_id"