mirror of
https://github.com/fspc/bike-database.git
synced 2026-09-16 08:31:39 -04:00
Louis | Adds page which shows freecyclery bikes that are ready for pickup
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user