lk | adds tests & validations to client

This commit is contained in:
Loos
2015-04-16 09:12:55 -05:00
parent 9e1f397fd7
commit 6b2a824f66
4 changed files with 24 additions and 5 deletions
+3 -2
View File
@@ -1,12 +1,13 @@
class Client < ActiveRecord::Base
validates :application_date, presence: true
has_one :bike
belongs_to :agency
def self.waiting_list
clients = Client.all
non_voided_clients = clients.select{|client| !client.application_voided}
incomplete_clients = non_voided_clients.select{|client| !client.completion_date}
waiting_list = incomplete_clients.sort_by!{|client| client.application_date}
waiting_list = non_voided_clients.select{|client| !client.completion_date}
waiting_list.sort_by!{|client| client.application_date}
end
def name