Browse Source

lk | removes completion date field

master
Louis Knapp 9 years ago
parent
commit
20b4c36f23
  1. 1
      app/controllers/bikes_controller.rb
  2. 5
      app/models/bike.rb
  3. 5
      db/migrate/20151013231450_remove_completion_date_from_bikes.rb
  4. 4
      db/schema.rb
  5. 1
      lib/tasks/dummydata.rake
  6. 2
      notes.txt

1
app/controllers/bikes_controller.rb

@ -91,7 +91,6 @@ class BikesController < ApplicationController
:serial_number,
:tag_info,
:mechanic,
:completion_date,
:price,
:top_tube_size,
:seat_tube_size,

5
app/models/bike.rb

@ -30,8 +30,7 @@ class Bike < ActiveRecord::Base
end
def ready_for_pickup?
client = self.client
client && self.completion_date && !client.application_voided && self.date_sold.nil?
self.client && !client.application_voided && self.date_sold.nil?
end
def self.bikes_ready_for_pickup
@ -40,7 +39,7 @@ class Bike < ActiveRecord::Base
def self.available_for_freecyclery
assigned_bikes = Client.all.select{|c| !c.bike_id.nil?}.map(&:bike)
all_freecyclery_bikes = Bike.order(log_number: :desc).select{|bike| bike.completion_date && (bike.purpose == "Freecyclery")}
all_freecyclery_bikes = Bike.order(log_number: :desc).select{|bike| bike.purpose == "Freecyclery"}
all_freecyclery_bikes - assigned_bikes
end

5
db/migrate/20151013231450_remove_completion_date_from_bikes.rb

@ -0,0 +1,5 @@
class RemoveCompletionDateFromBikes < ActiveRecord::Migration
def change
remove_column :bikes, :completion_date
end
end

4
db/schema.rb

@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20150930005913) do
ActiveRecord::Schema.define(version: 20151013231450) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@ -36,7 +36,6 @@ ActiveRecord::Schema.define(version: 20150930005913) do
t.string "serial_number"
t.text "work_done"
t.text "new_parts"
t.string "completion_date"
t.string "price"
t.datetime "created_at"
t.datetime "updated_at"
@ -57,7 +56,6 @@ ActiveRecord::Schema.define(version: 20150930005913) do
t.integer "age"
t.boolean "helmet"
t.boolean "lock"
t.date "completion_date"
t.datetime "created_at"
t.datetime "updated_at"
t.integer "bike_id"

1
lib/tasks/dummydata.rake

@ -57,7 +57,6 @@ namespace :db do
serial_number: Faker::Number.number(10),
notes: Faker::Lorem.sentence,
tag_info: Faker::Lorem.sentence,
completion_date: rand(100.days).ago,
price: rand(400) + 50,
seat_tube_size: rand(45),
top_tube_size: rand(45),

2
notes.txt

@ -1,5 +1,3 @@
make sure you can mark bike completion dates
Freecyclery Receipts
convert to bootstrap-less

Loading…
Cancel
Save