Skip to content

Commit

Permalink
add a commitment field for how often a host plans to host
Browse files Browse the repository at this point in the history
  • Loading branch information
Jennifer Tilton committed Feb 9, 2017
1 parent f94f5c9 commit 12aac05
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/models/city.rb
Expand Up @@ -51,7 +51,7 @@ def pending_approval?
def hosts
User.hosts.where(home_city: [self] + proxy_cities)
end

def hosts_by_status
users = User.hosts.where(home_city: self.id).includes(:host_detail).group_by {|h| h.host_detail.activity_status }
# Return empty array if there are no users in that group
Expand Down
9 changes: 9 additions & 0 deletions db/migrate/20170203195548_add_commitment_to_host_details.rb
@@ -0,0 +1,9 @@
class AddCommitmentToHostDetails < ActiveRecord::Migration
def up
add_column :host_details, :commitment, :integer
end

def down
remove_column :host_details, :commitment, :integer
end
end
3 changes: 2 additions & 1 deletion db/schema.rb
Expand Up @@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 20161001202222) do
ActiveRecord::Schema.define(version: 20170203195548) do

# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
Expand Down Expand Up @@ -77,6 +77,7 @@
t.integer "activity_status", default: 0
t.datetime "created_at"
t.datetime "updated_at"
t.integer "commitment"
end

create_table "proxy_cities", force: true do |t|
Expand Down

0 comments on commit 12aac05

Please sign in to comment.