From f36412223152185039340e8eff44d5cf1cef1078 Mon Sep 17 00:00:00 2001 From: Joel Yin Date: Mon, 11 Jun 2012 17:23:14 -0400 Subject: [PATCH 1/7] still working on it --- .../project_questions/_attribution.html.erb | 29 ++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/app/views/project_questions/_attribution.html.erb b/app/views/project_questions/_attribution.html.erb index 9f3aada..cc1020e 100644 --- a/app/views/project_questions/_attribution.html.erb +++ b/app/views/project_questions/_attribution.html.erb @@ -7,5 +7,32 @@ <% # Replace with code to print attribution for all of the given questions %> +<% @question_ids.each do |id| %> + <% question = Question.find_by_id(id) %> + <% collaborators = question.question_collaborators %> -<%= @question_ids %> + <%= question_id_link(question) %>
+ Question ID: <%= question.id %> + + <% author_names = collaborator_names(collaborators.select{|c| c.is_author}) %> + <% copyright_names = collaborator_names(collaborators.select{|c| c.is_copyright_holder}) %> + + <% if author_names == copyright_names %> + © <%= author_names %>. + <% else %> + Written by <%= author_names %>, © <%= copyright_names %>. + <% end %> + Licensed under <%= question.license_id.nil? ? "[unspecified]" : link_to(question.license.short_name, question.license.url) %>. + + <% if question.is_derivation? %> + <% source_question = question.source_question %> + <% source_collaborators = source_question.question_collaborators %> +
Derived from <%= question_id_link(source_question) %> by + <%= collaborator_names(source_collaborators.select{|c| c.is_author}) %>. + <% end %> + <% if question.is_published? %> + <%= link_to "Version History", + question_history_path(question) %>. + <% end %> +

+<% end %> From b381c998541823dcbdd7744c5415012146109478 Mon Sep 17 00:00:00 2001 From: Joel Yin Date: Thu, 14 Jun 2012 18:02:23 -0400 Subject: [PATCH 2/7] got rid of question.id --- app/views/project_questions/_attribution.html.erb | 1 - 1 file changed, 1 deletion(-) diff --git a/app/views/project_questions/_attribution.html.erb b/app/views/project_questions/_attribution.html.erb index cc1020e..c09ee60 100644 --- a/app/views/project_questions/_attribution.html.erb +++ b/app/views/project_questions/_attribution.html.erb @@ -12,7 +12,6 @@ <% collaborators = question.question_collaborators %> <%= question_id_link(question) %>
- Question ID: <%= question.id %> <% author_names = collaborator_names(collaborators.select{|c| c.is_author}) %> <% copyright_names = collaborator_names(collaborators.select{|c| c.is_copyright_holder}) %> From cc2a533008c6022183defd120697c40b759ddc02 Mon Sep 17 00:00:00 2001 From: Joel Yin Date: Sat, 16 Jun 2012 10:09:08 -0400 Subject: [PATCH 3/7] attributes are nicer to multipart questions, includes non-derived, borrowed questions --- app/models/multipart_question.rb | 3 --- app/models/question.rb | 2 +- app/models/simple_question.rb | 1 + .../project_questions/_attribution.html.erb | 19 +++++++++++++++---- .../project_questions/_sub_attribute.html.erb | 0 .../project_questions/attribution.html.erb | 3 ++- .../project_questions/attribution.js.erb | 3 ++- app/views/questions/_attribution.html.erb | 9 +++++++++ 8 files changed, 30 insertions(+), 10 deletions(-) create mode 100644 app/views/project_questions/_sub_attribute.html.erb diff --git a/app/models/multipart_question.rb b/app/models/multipart_question.rb index 932fb95..6a4de92 100644 --- a/app/models/multipart_question.rb +++ b/app/models/multipart_question.rb @@ -198,9 +198,6 @@ def check_and_unlock_setup! end end - def is_multipart? - true - end protected diff --git a/app/models/question.rb b/app/models/question.rb index 5033c03..34bd54d 100644 --- a/app/models/question.rb +++ b/app/models/question.rb @@ -341,7 +341,7 @@ def is_draft_in_multipart? end def is_multipart? - false + question_type == "MultipartQuestion" end def modified_at diff --git a/app/models/simple_question.rb b/app/models/simple_question.rb index d8a65aa..be93b5e 100644 --- a/app/models/simple_question.rb +++ b/app/models/simple_question.rb @@ -46,6 +46,7 @@ def variate!(variator) super(variator) answer_choices.each {|ac| ac.variate!(variator)} end + protected diff --git a/app/views/project_questions/_attribution.html.erb b/app/views/project_questions/_attribution.html.erb index c09ee60..a39dabe 100644 --- a/app/views/project_questions/_attribution.html.erb +++ b/app/views/project_questions/_attribution.html.erb @@ -7,11 +7,12 @@ <% # Replace with code to print attribution for all of the given questions %> -<% @question_ids.each do |id| %> + +<% question_ids.each do |id| %> <% question = Question.find_by_id(id) %> <% collaborators = question.question_collaborators %> - <%= question_id_link(question) %>
+ <%= question_id_link(question) %><% if first_call %>
<% end %> <% author_names = collaborator_names(collaborators.select{|c| c.is_author}) %> <% copyright_names = collaborator_names(collaborators.select{|c| c.is_copyright_holder}) %> @@ -26,12 +27,22 @@ <% if question.is_derivation? %> <% source_question = question.source_question %> <% source_collaborators = source_question.question_collaborators %> -
Derived from <%= question_id_link(source_question) %> by + <% if first_call %>
<% end %> + Derived from <%= question_id_link(source_question) %> by <%= collaborator_names(source_collaborators.select{|c| c.is_author}) %>. <% end %> + + <% if question.is_multipart? && first_call %> + <% question.child_question_parts.each do |cq| %> +
--> <%= render :partial => 'project_questions/attribution', + :locals => {:question_ids => [cq.child_question_id], + :first_call => false} %> + <% end %> + <% end %> + <% if question.is_published? %> <%= link_to "Version History", question_history_path(question) %>. <% end %> -

+ <% if first_call %>

<% end %> <% end %> diff --git a/app/views/project_questions/_sub_attribute.html.erb b/app/views/project_questions/_sub_attribute.html.erb new file mode 100644 index 0000000..e69de29 diff --git a/app/views/project_questions/attribution.html.erb b/app/views/project_questions/attribution.html.erb index 8bd387b..7a78164 100644 --- a/app/views/project_questions/attribution.html.erb +++ b/app/views/project_questions/attribution.html.erb @@ -4,4 +4,5 @@ <%= pageHeading("Attribution") %> <%= render :partial => 'project_questions/attribution', - :locals => {:question_ids => @question_ids} %> + :locals => {:question_ids => @question_ids, + :first_call => true} %> diff --git a/app/views/project_questions/attribution.js.erb b/app/views/project_questions/attribution.js.erb index 4649ebc..f76801d 100644 --- a/app/views/project_questions/attribution.js.erb +++ b/app/views/project_questions/attribution.js.erb @@ -3,6 +3,7 @@ $("#attribution_dialog").html("<%= escape_javascript( render :partial => 'project_questions/attribution', - :locals => {:question_ids => @question_ids}) %>"); + :locals => {:question_ids => @question_ids, + :first_call => true}) %>"); $("#attribution_dialog").dialog('open'); diff --git a/app/views/questions/_attribution.html.erb b/app/views/questions/_attribution.html.erb index b1a289f..aa085f7 100644 --- a/app/views/questions/_attribution.html.erb +++ b/app/views/questions/_attribution.html.erb @@ -20,6 +20,15 @@ Licensed under <%= question.license_id.nil? ? "[unspecified]" : link_to(question
Derived from <%= question_id_link(source_question) %> by <%= collaborator_names(source_collaborators.select{|c| c.is_author}) %>. <% end %> + +<% if question.is_multipart?%> + <% question.child_question_parts.each do |cq| %> +
--> <%= render :partial => 'project_questions/attribution', + :locals => {:question_ids => [cq.child_question_id], + :first_call => false} %> + <% end %> + <% end %> + <% if question.is_published? %> <%= link_to "Version History", question_history_path(question) %>. From 7c95daa9e992b595ade5a785ea89f138952ac9eb Mon Sep 17 00:00:00 2001 From: Joel Yin Date: Wed, 27 Jun 2012 12:34:33 -0400 Subject: [PATCH 4/7] merged issues 48 and 17, should display attributes correctly --- app/views/project_questions/_sub_attribute.html.erb | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 app/views/project_questions/_sub_attribute.html.erb diff --git a/app/views/project_questions/_sub_attribute.html.erb b/app/views/project_questions/_sub_attribute.html.erb deleted file mode 100644 index e69de29..0000000 From ae7f2e726b7ef36b2caf4a9b0f55288fbdad4169 Mon Sep 17 00:00:00 2001 From: Joel Yin Date: Sat, 30 Jun 2012 04:01:39 -0400 Subject: [PATCH 5/7] added missing symbols --- app/views/project_questions/_attribution.html.erb | 9 +++++---- app/views/questions/_attribution.html.erb | 11 ++++++----- app/views/questions/_show.html.erb | 3 ++- app/views/simple_questions/_show.jsonify | 3 ++- 4 files changed, 15 insertions(+), 11 deletions(-) diff --git a/app/views/project_questions/_attribution.html.erb b/app/views/project_questions/_attribution.html.erb index a39dabe..a198e63 100644 --- a/app/views/project_questions/_attribution.html.erb +++ b/app/views/project_questions/_attribution.html.erb @@ -32,6 +32,11 @@ <%= collaborator_names(source_collaborators.select{|c| c.is_author}) %>. <% end %> + <% if question.is_published? %> + <%= link_to "Version History", + question_history_path(question) %>. + <% end %> + <% if question.is_multipart? && first_call %> <% question.child_question_parts.each do |cq| %>
--> <%= render :partial => 'project_questions/attribution', @@ -40,9 +45,5 @@ <% end %> <% end %> - <% if question.is_published? %> - <%= link_to "Version History", - question_history_path(question) %>. - <% end %> <% if first_call %>

<% end %> <% end %> diff --git a/app/views/questions/_attribution.html.erb b/app/views/questions/_attribution.html.erb index aa085f7..a86bb50 100644 --- a/app/views/questions/_attribution.html.erb +++ b/app/views/questions/_attribution.html.erb @@ -21,7 +21,12 @@ Licensed under <%= question.license_id.nil? ? "[unspecified]" : link_to(question <%= collaborator_names(source_collaborators.select{|c| c.is_author}) %>. <% end %> -<% if question.is_multipart?%> +<% if question.is_published? %> + <%= link_to "Version History", + question_history_path(question) %>. +<% end %> + +<% if question.is_multipart? && first_call %> <% question.child_question_parts.each do |cq| %>
--> <%= render :partial => 'project_questions/attribution', :locals => {:question_ids => [cq.child_question_id], @@ -29,8 +34,4 @@ Licensed under <%= question.license_id.nil? ? "[unspecified]" : link_to(question <% end %> <% end %> -<% if question.is_published? %> - <%= link_to "Version History", - question_history_path(question) %>. -<% end %> diff --git a/app/views/questions/_show.html.erb b/app/views/questions/_show.html.erb index 0fe2b73..6a999f9 100644 --- a/app/views/questions/_show.html.erb +++ b/app/views/questions/_show.html.erb @@ -5,4 +5,5 @@ :locals => {:question => question} %>

<%= render :partial => 'questions/attribution', - :locals => {:question => question }%> + :locals => {:question => question, + :first_call => true }%> diff --git a/app/views/simple_questions/_show.jsonify b/app/views/simple_questions/_show.jsonify index 2d0b6bb..365dab3 100644 --- a/app/views/simple_questions/_show.jsonify +++ b/app/views/simple_questions/_show.jsonify @@ -20,6 +20,7 @@ json.simple_question do if !skip_attribution json.ingest! (render :partial => 'questions/attribution', - :locals => {:question => question}) + :locals => {:question => question, + :first_call => true}) end end \ No newline at end of file From 5f54192b833b90e18f35364a6a9ba9a34dd3a998 Mon Sep 17 00:00:00 2001 From: Joel Yin Date: Thu, 12 Jul 2012 16:46:36 -0400 Subject: [PATCH 6/7] made requested line changes --- app/models/multipart_question.rb | 1 - app/models/simple_question.rb | 1 - .../project_questions/_attribution.html.erb | 11 +- .../project_questions/attribution.html.erb | 3 +- .../project_questions/attribution.js.erb | 3 +- app/views/questions/_attribution.html.erb | 5 +- app/views/questions/_show.html.erb | 3 +- app/views/simple_questions/_show.jsonify | 3 +- db/schema.rb | 129 +++++++++--------- 9 files changed, 77 insertions(+), 82 deletions(-) diff --git a/app/models/multipart_question.rb b/app/models/multipart_question.rb index 6a4de92..db3303f 100644 --- a/app/models/multipart_question.rb +++ b/app/models/multipart_question.rb @@ -198,7 +198,6 @@ def check_and_unlock_setup! end end - protected def set_question_setup!(qs) diff --git a/app/models/simple_question.rb b/app/models/simple_question.rb index be93b5e..d8a65aa 100644 --- a/app/models/simple_question.rb +++ b/app/models/simple_question.rb @@ -46,7 +46,6 @@ def variate!(variator) super(variator) answer_choices.each {|ac| ac.variate!(variator)} end - protected diff --git a/app/views/project_questions/_attribution.html.erb b/app/views/project_questions/_attribution.html.erb index a198e63..9594bd7 100644 --- a/app/views/project_questions/_attribution.html.erb +++ b/app/views/project_questions/_attribution.html.erb @@ -8,11 +8,12 @@ <% # Replace with code to print attribution for all of the given questions %> +<% child_question ||= false %> <% question_ids.each do |id| %> <% question = Question.find_by_id(id) %> <% collaborators = question.question_collaborators %> - <%= question_id_link(question) %><% if first_call %>
<% end %> + <%= question_id_link(question) %><% unless child_question %>
<% end %> <% author_names = collaborator_names(collaborators.select{|c| c.is_author}) %> <% copyright_names = collaborator_names(collaborators.select{|c| c.is_copyright_holder}) %> @@ -27,7 +28,7 @@ <% if question.is_derivation? %> <% source_question = question.source_question %> <% source_collaborators = source_question.question_collaborators %> - <% if first_call %>
<% end %> + <% if !child_question %>
<% end %> Derived from <%= question_id_link(source_question) %> by <%= collaborator_names(source_collaborators.select{|c| c.is_author}) %>. <% end %> @@ -37,13 +38,13 @@ question_history_path(question) %>. <% end %> - <% if question.is_multipart? && first_call %> + <% if question.is_multipart? && !child_question %> <% question.child_question_parts.each do |cq| %>
--> <%= render :partial => 'project_questions/attribution', :locals => {:question_ids => [cq.child_question_id], - :first_call => false} %> + :child_question => true} %> <% end %> <% end %> - <% if first_call %>

<% end %> + <% if !child_question %>

<% end %> <% end %> diff --git a/app/views/project_questions/attribution.html.erb b/app/views/project_questions/attribution.html.erb index 7a78164..8bd387b 100644 --- a/app/views/project_questions/attribution.html.erb +++ b/app/views/project_questions/attribution.html.erb @@ -4,5 +4,4 @@ <%= pageHeading("Attribution") %> <%= render :partial => 'project_questions/attribution', - :locals => {:question_ids => @question_ids, - :first_call => true} %> + :locals => {:question_ids => @question_ids} %> diff --git a/app/views/project_questions/attribution.js.erb b/app/views/project_questions/attribution.js.erb index f76801d..4649ebc 100644 --- a/app/views/project_questions/attribution.js.erb +++ b/app/views/project_questions/attribution.js.erb @@ -3,7 +3,6 @@ $("#attribution_dialog").html("<%= escape_javascript( render :partial => 'project_questions/attribution', - :locals => {:question_ids => @question_ids, - :first_call => true}) %>"); + :locals => {:question_ids => @question_ids}) %>"); $("#attribution_dialog").dialog('open'); diff --git a/app/views/questions/_attribution.html.erb b/app/views/questions/_attribution.html.erb index a86bb50..df2f51d 100644 --- a/app/views/questions/_attribution.html.erb +++ b/app/views/questions/_attribution.html.erb @@ -1,6 +1,7 @@ <%# Copyright 2011-2012 Rice University. Licensed under the Affero General Public License version 3 or later. See the COPYRIGHT file for details. %> +<% child_question ||= false %> <% collaborators = question.question_collaborators %> <% author_names = collaborator_names(collaborators.select{|c| c.is_author}) %> @@ -26,11 +27,11 @@ Licensed under <%= question.license_id.nil? ? "[unspecified]" : link_to(question question_history_path(question) %>. <% end %> -<% if question.is_multipart? && first_call %> +<% if question.is_multipart? && !child_question %> <% question.child_question_parts.each do |cq| %>
--> <%= render :partial => 'project_questions/attribution', :locals => {:question_ids => [cq.child_question_id], - :first_call => false} %> + :child_question => true} %> <% end %> <% end %> diff --git a/app/views/questions/_show.html.erb b/app/views/questions/_show.html.erb index 6a999f9..0fe2b73 100644 --- a/app/views/questions/_show.html.erb +++ b/app/views/questions/_show.html.erb @@ -5,5 +5,4 @@ :locals => {:question => question} %>

<%= render :partial => 'questions/attribution', - :locals => {:question => question, - :first_call => true }%> + :locals => {:question => question }%> diff --git a/app/views/simple_questions/_show.jsonify b/app/views/simple_questions/_show.jsonify index 365dab3..2d0b6bb 100644 --- a/app/views/simple_questions/_show.jsonify +++ b/app/views/simple_questions/_show.jsonify @@ -20,7 +20,6 @@ json.simple_question do if !skip_attribution json.ingest! (render :partial => 'questions/attribution', - :locals => {:question => question, - :first_call => true}) + :locals => {:question => question}) end end \ No newline at end of file diff --git a/db/schema.rb b/db/schema.rb index 9a5fd96..3f91387 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -18,16 +18,16 @@ t.text "subject" t.text "body" t.boolean "force" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at" + t.datetime "updated_at" end create_table "answer_choices", :force => true do |t| t.integer "question_id" t.text "content" t.decimal "credit" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at" + t.datetime "updated_at" t.text "content_html", :limit => 255 end @@ -37,16 +37,16 @@ t.integer "attachment_file_size" t.datetime "attachment_updated_at" t.integer "uploader_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at" + t.datetime "updated_at" end create_table "attachable_assets", :force => true do |t| t.integer "attachable_id" t.integer "asset_id" t.string "local_name" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at" + t.datetime "updated_at" t.text "description" t.string "attachable_type" end @@ -54,16 +54,16 @@ create_table "comment_thread_subscriptions", :force => true do |t| t.integer "comment_thread_id" t.integer "user_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at" + t.datetime "updated_at" t.integer "unread_count", :default => 0 end create_table "comment_threads", :force => true do |t| t.string "commentable_type" t.integer "commentable_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at" + t.datetime "updated_at" end create_table "comments", :force => true do |t| @@ -71,23 +71,23 @@ t.text "message" t.integer "creator_id" t.boolean "is_log" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at" + t.datetime "updated_at" end create_table "deputizations", :force => true do |t| t.integer "deputizer_id" t.integer "deputy_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at" + t.datetime "updated_at" end create_table "licenses", :force => true do |t| t.string "short_name" t.string "long_name" t.string "url" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at" + t.datetime "updated_at" t.string "agreement_partial_name" t.boolean "is_default" end @@ -96,8 +96,8 @@ t.string "name" t.integer "number" t.text "summary" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at" + t.datetime "updated_at" t.boolean "always_required" end @@ -107,8 +107,8 @@ t.text "code" t.text "minified_code" t.boolean "deprecated" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at" + t.datetime "updated_at" end create_table "logics", :force => true do |t| @@ -116,8 +116,8 @@ t.string "variables" t.string "logicable_type" t.integer "logicable_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at" + t.datetime "updated_at" t.text "cached_code" t.string "variables_array" t.string "required_logic_library_version_ids" @@ -125,29 +125,29 @@ create_table "messages", :force => true do |t| t.string "subject" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at" + t.datetime "updated_at" end create_table "project_members", :force => true do |t| t.integer "project_id" t.integer "user_id" t.boolean "is_default" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at" + t.datetime "updated_at" end create_table "project_questions", :force => true do |t| t.integer "project_id" t.integer "question_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at" + t.datetime "updated_at" end create_table "projects", :force => true do |t| t.string "name" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at" + t.datetime "updated_at" end create_table "question_collaborators", :force => true do |t| @@ -156,8 +156,8 @@ t.integer "position" t.boolean "is_author", :default => false t.boolean "is_copyright_holder", :default => false - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at" + t.datetime "updated_at" t.integer "question_role_requests_count", :default => 0 end @@ -165,24 +165,24 @@ t.integer "independent_question_id" t.integer "dependent_question_id" t.string "kind" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at" + t.datetime "updated_at" end create_table "question_derivations", :force => true do |t| t.integer "derived_question_id" t.integer "source_question_id" t.integer "deriver_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at" + t.datetime "updated_at" end create_table "question_parts", :force => true do |t| t.integer "multipart_question_id" t.integer "child_question_id" t.integer "order" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at" + t.datetime "updated_at" end create_table "question_role_requests", :force => true do |t| @@ -190,16 +190,16 @@ t.boolean "toggle_is_author" t.boolean "toggle_is_copyright_holder" t.integer "requestor_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at" + t.datetime "updated_at" t.boolean "is_approved", :default => false t.boolean "is_accepted", :default => false end create_table "question_setups", :force => true do |t| t.text "content" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at" + t.datetime "updated_at" t.text "content_html", :limit => 255 end @@ -209,8 +209,8 @@ t.string "question_type" t.text "content" t.integer "question_setup_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at" + t.datetime "updated_at" t.integer "license_id" t.text "content_html", :limit => 255 t.integer "locked_by", :default => -1 @@ -225,8 +225,8 @@ t.integer "creator_id" t.text "content" t.integer "question_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at" + t.datetime "updated_at" t.text "content_html" t.text "explanation" t.boolean "is_visible" @@ -253,37 +253,36 @@ t.integer "user_id" t.boolean "project_member_email", :default => true t.boolean "role_request_email", :default => true - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at" + t.datetime "updated_at" t.boolean "announcement_email" t.boolean "auto_author_subscribe", :default => true end create_table "users", :force => true do |t| - t.string "email", :default => "", :null => false - t.string "encrypted_password", :default => "", :null => false + t.string "email", :default => "", :null => false + t.string "encrypted_password", :limit => 128, :default => "", :null => false t.string "reset_password_token" - t.datetime "reset_password_sent_at" t.datetime "remember_created_at" - t.integer "sign_in_count", :default => 0 + t.integer "sign_in_count", :default => 0 t.datetime "current_sign_in_at" t.datetime "last_sign_in_at" t.string "current_sign_in_ip" t.string "last_sign_in_ip" + t.integer "failed_attempts", :default => 0 + t.string "unlock_token" + t.datetime "locked_at" t.string "confirmation_token" t.datetime "confirmed_at" t.datetime "confirmation_sent_at" - t.integer "failed_attempts", :default => 0 - t.string "unlock_token" - t.datetime "locked_at" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at" + t.datetime "updated_at" t.string "first_name" t.string "last_name" - t.boolean "is_administrator", :default => false + t.boolean "is_administrator", :default => false t.string "username" t.datetime "disabled_at" - t.integer "unread_message_count", :default => 0 + t.integer "unread_message_count", :default => 0 end add_index "users", ["confirmation_token"], :name => "index_users_on_confirmation_token", :unique => true @@ -296,16 +295,16 @@ t.boolean "thumbs_up" t.string "votable_type" t.integer "votable_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at" + t.datetime "updated_at" end create_table "website_configurations", :force => true do |t| t.string "name" t.string "value" t.string "value_type" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at" + t.datetime "updated_at" end end From 5256266f681c86888adf11e39f9c9f82ae34267f Mon Sep 17 00:00:00 2001 From: Joel Yin Date: Fri, 20 Jul 2012 17:22:26 -0400 Subject: [PATCH 7/7] fixed schema --- db/schema.rb | 129 ++++++++++++++++++++++++++------------------------- 1 file changed, 65 insertions(+), 64 deletions(-) diff --git a/db/schema.rb b/db/schema.rb index 3f91387..9a5fd96 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -18,16 +18,16 @@ t.text "subject" t.text "body" t.boolean "force" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false end create_table "answer_choices", :force => true do |t| t.integer "question_id" t.text "content" t.decimal "credit" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false t.text "content_html", :limit => 255 end @@ -37,16 +37,16 @@ t.integer "attachment_file_size" t.datetime "attachment_updated_at" t.integer "uploader_id" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false end create_table "attachable_assets", :force => true do |t| t.integer "attachable_id" t.integer "asset_id" t.string "local_name" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false t.text "description" t.string "attachable_type" end @@ -54,16 +54,16 @@ create_table "comment_thread_subscriptions", :force => true do |t| t.integer "comment_thread_id" t.integer "user_id" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false t.integer "unread_count", :default => 0 end create_table "comment_threads", :force => true do |t| t.string "commentable_type" t.integer "commentable_id" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false end create_table "comments", :force => true do |t| @@ -71,23 +71,23 @@ t.text "message" t.integer "creator_id" t.boolean "is_log" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false end create_table "deputizations", :force => true do |t| t.integer "deputizer_id" t.integer "deputy_id" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false end create_table "licenses", :force => true do |t| t.string "short_name" t.string "long_name" t.string "url" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false t.string "agreement_partial_name" t.boolean "is_default" end @@ -96,8 +96,8 @@ t.string "name" t.integer "number" t.text "summary" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false t.boolean "always_required" end @@ -107,8 +107,8 @@ t.text "code" t.text "minified_code" t.boolean "deprecated" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false end create_table "logics", :force => true do |t| @@ -116,8 +116,8 @@ t.string "variables" t.string "logicable_type" t.integer "logicable_id" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false t.text "cached_code" t.string "variables_array" t.string "required_logic_library_version_ids" @@ -125,29 +125,29 @@ create_table "messages", :force => true do |t| t.string "subject" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false end create_table "project_members", :force => true do |t| t.integer "project_id" t.integer "user_id" t.boolean "is_default" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false end create_table "project_questions", :force => true do |t| t.integer "project_id" t.integer "question_id" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false end create_table "projects", :force => true do |t| t.string "name" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false end create_table "question_collaborators", :force => true do |t| @@ -156,8 +156,8 @@ t.integer "position" t.boolean "is_author", :default => false t.boolean "is_copyright_holder", :default => false - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false t.integer "question_role_requests_count", :default => 0 end @@ -165,24 +165,24 @@ t.integer "independent_question_id" t.integer "dependent_question_id" t.string "kind" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false end create_table "question_derivations", :force => true do |t| t.integer "derived_question_id" t.integer "source_question_id" t.integer "deriver_id" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false end create_table "question_parts", :force => true do |t| t.integer "multipart_question_id" t.integer "child_question_id" t.integer "order" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false end create_table "question_role_requests", :force => true do |t| @@ -190,16 +190,16 @@ t.boolean "toggle_is_author" t.boolean "toggle_is_copyright_holder" t.integer "requestor_id" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false t.boolean "is_approved", :default => false t.boolean "is_accepted", :default => false end create_table "question_setups", :force => true do |t| t.text "content" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false t.text "content_html", :limit => 255 end @@ -209,8 +209,8 @@ t.string "question_type" t.text "content" t.integer "question_setup_id" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false t.integer "license_id" t.text "content_html", :limit => 255 t.integer "locked_by", :default => -1 @@ -225,8 +225,8 @@ t.integer "creator_id" t.text "content" t.integer "question_id" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false t.text "content_html" t.text "explanation" t.boolean "is_visible" @@ -253,36 +253,37 @@ t.integer "user_id" t.boolean "project_member_email", :default => true t.boolean "role_request_email", :default => true - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false t.boolean "announcement_email" t.boolean "auto_author_subscribe", :default => true end create_table "users", :force => true do |t| - t.string "email", :default => "", :null => false - t.string "encrypted_password", :limit => 128, :default => "", :null => false + t.string "email", :default => "", :null => false + t.string "encrypted_password", :default => "", :null => false t.string "reset_password_token" + t.datetime "reset_password_sent_at" t.datetime "remember_created_at" - t.integer "sign_in_count", :default => 0 + t.integer "sign_in_count", :default => 0 t.datetime "current_sign_in_at" t.datetime "last_sign_in_at" t.string "current_sign_in_ip" t.string "last_sign_in_ip" - t.integer "failed_attempts", :default => 0 - t.string "unlock_token" - t.datetime "locked_at" t.string "confirmation_token" t.datetime "confirmed_at" t.datetime "confirmation_sent_at" - t.datetime "created_at" - t.datetime "updated_at" + t.integer "failed_attempts", :default => 0 + t.string "unlock_token" + t.datetime "locked_at" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false t.string "first_name" t.string "last_name" - t.boolean "is_administrator", :default => false + t.boolean "is_administrator", :default => false t.string "username" t.datetime "disabled_at" - t.integer "unread_message_count", :default => 0 + t.integer "unread_message_count", :default => 0 end add_index "users", ["confirmation_token"], :name => "index_users_on_confirmation_token", :unique => true @@ -295,16 +296,16 @@ t.boolean "thumbs_up" t.string "votable_type" t.integer "votable_id" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false end create_table "website_configurations", :force => true do |t| t.string "name" t.string "value" t.string "value_type" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false end end