From 3d5b437832c69e6e940346527b90e3ee74240c54 Mon Sep 17 00:00:00 2001 From: Louis Knapp Date: Tue, 5 Jan 2016 14:16:24 -0600 Subject: [PATCH] lk | shows bikes in client wait list --- app/models/client.rb | 7 +++---- app/views/clients/index.html.haml | 2 ++ 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/models/client.rb b/app/models/client.rb index a5b523a..12e0f62 100644 --- a/app/models/client.rb +++ b/app/models/client.rb @@ -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 diff --git a/app/views/clients/index.html.haml b/app/views/clients/index.html.haml index 07f3a46..88ea750 100644 --- a/app/views/clients/index.html.haml +++ b/app/views/clients/index.html.haml @@ -13,6 +13,7 @@ %th Height %th Application Date %th Agency + %th Bike %th %tbody - @waiting_list.each_with_index do |client, index| @@ -23,6 +24,7 @@ %td= client.height %td= client.application_date %td= client.agency.agency_name if client.agency + %td= client.bike_id ? Bike.find(client.bike_id).name : "None" %td= link_to 'Edit', edit_client_path(client) %br