lk | shows bikes in client wait list

This commit is contained in:
Louis Knapp
2016-01-05 14:16:24 -06:00
parent 071734cac5
commit 3d5b437832
2 changed files with 5 additions and 4 deletions
+3 -4
View File
@@ -6,10 +6,9 @@ class Client < ActiveRecord::Base
def self.waiting_list
clients = Client.all
non_voided_clients = clients.select{|client| !client.application_voided}
waiting_list_with_null_application_dates = non_voided_clients.select{|client| !client.pickup_date}
clients_with_bikes = Client.all.select{|c| !c.bike_id.nil?}
waiting_list = waiting_list_with_null_application_dates.select{|client| !client.application_date.nil?} - clients_with_bikes
nonvoided_clients = clients.select{|client| !client.application_voided}
active_nonvoided_clients = nonvoided_clients.select{|client| !client.pickup_date}
waiting_list = active_nonvoided_clients.select{|client| !client.application_date.nil?}
waiting_list.sort_by!{|client| client.application_date}
end