Browse files

added status to student_assignments

  • Loading branch information...
1 parent 40174cc commit b267d91c2fb7d3983761882eeee6160617bb13a8 @felixtsai committed Sep 26, 2012
View
2 app/models/grade_level.rb
@@ -6,7 +6,7 @@ class GradeLevel < ActiveRecord::Base
has_many :assignments
validates_uniqueness_of :year
- validates_inclusion_of :year, :in => ["6th Grade - A", "6th Grade - B" , "7th Grade", "8th Grade"]
+ validates_inclusion_of :year, :in => ["6th Grade", "6th Grade - DI" , "7th Grade", "8th Grade"]
#Do not ever change the drop down menu for the grade because there is no vaidation of inclusion.
def self.order_by_year
View
2 app/models/student_assignment.rb
@@ -1,5 +1,5 @@
class StudentAssignment < ActiveRecord::Base
- attr_accessible :assignment_id, :completion_time, :student_id
+ attr_accessible :assignment_id, :completion_time, :student_id, :status
belongs_to :student
belongs_to :assignment
delegate :due_date, to: :assignment
View
8 app/views/assignments/index.html.haml
@@ -11,13 +11,13 @@
%th % Complete
%tr
%th.grade{:colspan => 6}
- 6th Grade - A
- = render :partial => 'assignment', :collection => @assignments.select {|a| a.grade_level.year == "6th Grade - A"}
+ 6th Grade
+ = render :partial => 'assignment', :collection => @assignments.select {|a| a.grade_level.year == "6th Grade"}
%thead
%tr
%th.grade{:colspan => 6}
- 6th Grade - B
- = render :partial => 'assignment', :collection => @assignments.select {|a| a.grade_level.year == "6th Grade - B"}
+ 6th Grade - DI
+ = render :partial => 'assignment', :collection => @assignments.select {|a| a.grade_level.year == "6th Grade - DI"}
%thead
%tr
%th.grade{:colspan => 6}
View
6 app/views/students/_student.html.haml
@@ -20,8 +20,8 @@
= s_a.assignment.subject.name
%td
= s_a.assignment.description
- %td
- %span.label.label-important
- = link_to "",student_assignment_path(s_a), :class => "icon-trash", method: :delete, data: {confirm: "Are you sure?"}, :remote => true
+ / %td
+ / %span.label.label-important
+ / = link_to "",student_assignment_path(s_a), :class => "icon-trash", method: :delete, data: {confirm: "Are you sure?"}, :remote => true
View
5 db/migrate/20120926183803_add_status_to_student_assignment.rb
@@ -0,0 +1,5 @@
+class AddStatusToStudentAssignment < ActiveRecord::Migration
+ def change
+ add_column :student_assignments, :status, :string
+ end
+end
View
3 db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20120914004314) do
+ActiveRecord::Schema.define(:version => 20120926183803) do
create_table "admins", :force => true do |t|
t.string "email", :default => "", :null => false
@@ -92,6 +92,7 @@
t.integer "assignment_id"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
+ t.string "status"
end
add_index "student_assignments", ["assignment_id"], :name => "index_student_assignments_on_assignment_id"
View
4 db/seeds.rb
@@ -6,8 +6,8 @@
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
# Mayor.create(name: 'Emanuel', city: cities.first)
-GradeLevel.find_or_create_by_year("6th Grade - A")
-GradeLevel.find_or_create_by_year("6th Grade - B")
+GradeLevel.find_or_create_by_year("6th Grade")
+GradeLevel.find_or_create_by_year("6th Grade - DI")
GradeLevel.find_or_create_by_year("7th Grade")
GradeLevel.find_or_create_by_year("8th Grade")

0 comments on commit b267d91

Please sign in to comment.