Make key of customer/invoice mapping a customer

The key was the customer name before, but then it's not possible
to use any other information of the customer model anymore.
This commit is contained in:
Paul van Tilburg 2014-10-25 18:02:32 +02:00
parent fccfcc0ee8
commit da8db07e94
1 changed files with 5 additions and 5 deletions

View File

@ -1377,7 +1377,7 @@ module StopTime::Controllers
Customer.all.each do |customer| Customer.all.each do |customer|
invoices = customer.invoices invoices = customer.invoices
next if invoices.empty? next if invoices.empty?
@invoices[customer.name] = invoices @invoices[customer] = invoices
invoices.each do |i| invoices.each do |i|
@input["paid_#{i.number}"] = true if i.paid? @input["paid_#{i.number}"] = true if i.paid?
end end
@ -2020,10 +2020,10 @@ module StopTime::Views
else else
div.row do div.row do
div.span7 do div.span7 do
@invoices.keys.sort.each do |key| @invoices.keys.sort.each do |customer|
next if @invoices[key].empty? next if @invoices[customer].empty?
h3 { key } h3 { customer.name }
_invoice_list(@invoices[key]) _invoice_list(@invoices[customer])
end end
end end
end end