Louis | Adds page which shows freecyclery bikes that are ready for pickup

This commit is contained in:
Loos
2014-10-07 21:01:29 -04:00
parent 090edd24e3
commit 77e7109b9e
6 changed files with 41 additions and 0 deletions
+13
View File
@@ -10,4 +10,17 @@ class Bike < ActiveRecord::Base
self.brand + ' ' + self.model
end
def client
client = Client.find_by bike_id: self.id
end
def ready_for_pickup?
client = self.client
client && self.completion_date && !client.application_voided
end
def self.bikes_ready_for_pickup
Bike.all.select{|bike| bike.ready_for_pickup?}
end
end
+4
View File
@@ -9,4 +9,8 @@ class Client < ActiveRecord::Base
waiting_list = incomplete_clients.sort_by!{|client| client.application_date}
end
def name
self.first_name + ' ' + self.last_name
end
end