diff --git a/app/controllers/concepts_controller.rb b/app/controllers/concepts_controller.rb index 9b09135..b95a10b 100644 --- a/app/controllers/concepts_controller.rb +++ b/app/controllers/concepts_controller.rb @@ -40,10 +40,6 @@ def modify_level progress = ConceptProgress.where(concept_id: @concept.id, enrollment_id: enrollment.id).first - - comment = Comment.create(content: params[:comment], - commenter_name: current_student.full_name) - elsif teacher_signed_in? enrollment = Enrollment.where(student_id: params[:student_id], @@ -51,12 +47,8 @@ def modify_level progress = ConceptProgress.where(concept_id: @concept.id, enrollment_id: enrollment.id).first - - comment = Comment.create(content: params[:comment], - commenter_name: current_teacher.full_name) end - progress.add_comment(comment) progress.change_level(params[:level]) redirect_to @concept if progress.save diff --git a/app/models/comment.rb b/app/models/comment.rb deleted file mode 100644 index 6eaf1a9..0000000 --- a/app/models/comment.rb +++ /dev/null @@ -1,7 +0,0 @@ -class Comment < ActiveRecord::Base - - belongs_to :concept_progress - - validates_presence_of :content - validates_presence_of :commenter_name -end diff --git a/app/models/concept_progress.rb b/app/models/concept_progress.rb index 3f241da..d85bfd1 100644 --- a/app/models/concept_progress.rb +++ b/app/models/concept_progress.rb @@ -6,7 +6,6 @@ class ConceptProgress < ActiveRecord::Base belongs_to :enrollment belongs_to :concept - has_many :comments validates_presence_of :level, :type_of_error, :next_steps @@ -21,8 +20,4 @@ def init def change_level(lev) self.level = lev end - - def add_comment(com) - self.comments << com - end end diff --git a/app/views/concepts/_modify_level_form.html.erb b/app/views/concepts/_modify_level_form.html.erb index 94aa4b9..81b9958 100644 --- a/app/views/concepts/_modify_level_form.html.erb +++ b/app/views/concepts/_modify_level_form.html.erb @@ -1,11 +1,6 @@ <%= form_tag concepts_modify_level_path, id:"levelForm", method: 'post' do %>
- <%= label_tag :comment %> - <%= text_area_tag :comment, nil, - size: "50x5", - class: "form-control" %>
- You must leave a comment.
<%= label_tag :level %> <%= select_tag :level, options_for_select([1,2,3,4]), @@ -14,20 +9,8 @@ <%= hidden_field_tag 'student_id', params[:student_id]%>
<%= button_tag "Change Level", - id:"levelButton", - class:"btn btn-default", - "data-dismiss" => "modal" %> + id:"levelButton", + class:"btn btn-default", + "data-dismiss" => "modal" %>
-<%end%> - - +<% end %> diff --git a/app/views/concepts/_student.html.erb b/app/views/concepts/_student.html.erb index 495cf4b..75c5517 100644 --- a/app/views/concepts/_student.html.erb +++ b/app/views/concepts/_student.html.erb @@ -1,8 +1,6 @@ - - <%= render 'student_progress' %>
LevelCommentCommented By
diff --git a/app/views/concepts/_student_progress.html.erb b/app/views/concepts/_student_progress.html.erb index c1efcb8..ec2983e 100644 --- a/app/views/concepts/_student_progress.html.erb +++ b/app/views/concepts/_student_progress.html.erb @@ -3,14 +3,6 @@ <% new_progress %> <% else %> - - <% end %> - - <% if @concept.unit.course.enrollments.empty? %> -
There are currently no students enrolled.
- <% else %> - <%= render 'teacher_progress' %> - <% end %>
<%= current_student.current_progress(@concept.unit.course).level%> - <%= current_student.current_progress(@concept.unit.course).comments.last.content if !current_student.current_progress(@concept.unit.course).comments.last.nil? %> - - <%= current_student.current_progress(@concept.unit.course). - comments.last.commenter_name if !current_student.current_progress( - @concept.unit.course).comments.last.nil? %> - <%= link_to "Edit Concept", '#levelModal', diff --git a/app/views/concepts/_teacher.html.erb b/app/views/concepts/_teacher.html.erb index cbecc3e..9ee77bc 100644 --- a/app/views/concepts/_teacher.html.erb +++ b/app/views/concepts/_teacher.html.erb @@ -2,18 +2,12 @@
Student LevelLatest CommentCommented By
diff --git a/app/views/concepts/_teacher_progress.html.erb b/app/views/concepts/_teacher_progress.html.erb index 724d91c..760feee 100644 --- a/app/views/concepts/_teacher_progress.html.erb +++ b/app/views/concepts/_teacher_progress.html.erb @@ -1,28 +1,20 @@ <% @concept.unit.course.enrollments.each do |e| %> <% e.concept_progresses.each do |p| %> - > - <%= e.student.full_name %> - <%= p.level %> - - <%= p.comments.last.content if !p.comments.last.nil?%> - - - <%= p.comments.last.commenter_name if !p.comments.last.nil? %> - - - <%= link_to "Edit", '#levelModal', - :class => "btn btn-primary btn-sm changebutton", - :data => { :toggle => "modal" }, - :id => e.student.id %> - - <% end %> - - + > + <%= e.student.full_name %> + <%= p.level %> + + <%= link_to "Edit", '#levelModal', + :class => "btn btn-primary btn-sm changebutton", + :data => { :toggle => "modal" }, + :id => e.student.id %> + + <% end %> - +<% end %> diff --git a/db/migrate/20131011034751_remove_comments.rb b/db/migrate/20131011034751_remove_comments.rb new file mode 100644 index 0000000..82d04de --- /dev/null +++ b/db/migrate/20131011034751_remove_comments.rb @@ -0,0 +1,5 @@ +class RemoveComments < ActiveRecord::Migration + def change + drop_table :comments + end +end diff --git a/db/schema.rb b/db/schema.rb index 6114a2c..da7487a 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,17 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20131008095946) do - - create_table "comments", force: true do |t| - t.string "content" - t.string "commenter_name" - t.integer "concept_progress_id" - t.datetime "created_at" - t.datetime "updated_at" - end - - add_index "comments", ["created_at"], name: "index_comments_on_created_at" +ActiveRecord::Schema.define(version: 20131011034751) do create_table "concept_progresses", force: true do |t| t.datetime "created_at" diff --git a/spec/factories.rb b/spec/factories.rb index 6449382..4460bba 100644 --- a/spec/factories.rb +++ b/spec/factories.rb @@ -50,10 +50,5 @@ enrollment_id 1 level 1 end - - factory :comment do - content "This is why I modified my LT" - commenter_name "Person Name" - end end diff --git a/spec/features/concept_show_spec.rb b/spec/features/concept_show_spec.rb index 4b203e6..59e15ba 100644 --- a/spec/features/concept_show_spec.rb +++ b/spec/features/concept_show_spec.rb @@ -32,27 +32,6 @@ end it { should have_content @student.full_name } - - it "should not allow level changes without a comment" do - click_link "Edit" - - select "2", from: "level" - - click_link "Edit" - - page.should have_css('div.fade') #modal form should remain active - page.should have_content("You must leave a comment.") - end - - it "should allow level changes with a comment" do - click_link "Edit" - fill_in "Comment", with: "This is why I changed the level." - select "2", from: "level" - - click_link "Edit" - - page.should have_content("This is why I changed the level.") - end end end diff --git a/spec/models/comment_spec.rb b/spec/models/comment_spec.rb deleted file mode 100644 index 1894f33..0000000 --- a/spec/models/comment_spec.rb +++ /dev/null @@ -1,23 +0,0 @@ -require 'spec_helper' - -describe Comment do - let (:comment) { FactoryGirl.create(:comment) } - - subject { comment } - - describe "attributes" do - - it { should respond_to :content } - it { should belong_to :concept_progress } - end - - describe "with no content" do - before {comment.content = nil } - it { should_not be_valid } - end - - describe "with no commenter name" do - before { comment.commenter_name = nil } - it { should_not be_valid } - end -end diff --git a/spec/models/concept_progress_spec.rb b/spec/models/concept_progress_spec.rb index 4ee84b2..08aef3b 100644 --- a/spec/models/concept_progress_spec.rb +++ b/spec/models/concept_progress_spec.rb @@ -11,8 +11,6 @@ it { should belong_to :enrollment } it { should belong_to :concept} - it { should have_many :comments } - it { should respond_to :enrollment_id } it { should respond_to :concept_id }