[cash] minor fix due to a copypasta error

This commit is contained in:
giomba 2019-04-13 09:28:54 +02:00
parent 2fb95798df
commit 0343edb42c

View File

@ -16,6 +16,15 @@
#define MAX_CUSTOMERS 20 #define MAX_CUSTOMERS 20
typedef struct user_invoice
{
uint8_t n_prods;
float total_sum;
uint8_t customer_id;
uint8_t empty;
linkaddr_t* address_basket;
}user_invoice;
PROCESS(cassa_main_process, "Cassa process"); PROCESS(cassa_main_process, "Cassa process");
@ -68,7 +77,8 @@ static void input_callback(const void* data, uint16_t len, const linkaddr_t* sou
invoices[index].n_prods = basket->n_products; invoices[index].n_prods = basket->n_products;
invoices[index].total_sum = 0; invoices[index].total_sum = 0;
invoices[index].customer_id = basket->customer_id; invoices[index].customer_id = basket->customer_id;
invoices[index].address_basket = source_address; memcpy(&invoices[index].address_basket, source_address, sizeof(*source_address));
// invoices[index].address_basket = source_address;
msg start_sending_list; msg start_sending_list;
start_sending_list.msg_type = START_OF_LIST_PRODUCTS_MSG; start_sending_list.msg_type = START_OF_LIST_PRODUCTS_MSG;
@ -89,7 +99,7 @@ static void input_callback(const void* data, uint16_t len, const linkaddr_t* sou
uint8_t index = invoice_index(product->customer_id, invoices); uint8_t index = invoice_index(product->customer_id, invoices);
if (index != -1) { if (index != -1) {
if (invoices[index].n_prods > 0) { if (invoices[index].n_prods > 0) {
invoices[index].total_sum += product->prize; invoices[index].total_sum += product->price;
invoices[index].n_prods--; invoices[index].n_prods--;
} }
if (invoices[index].n_prods == 0) { if (invoices[index].n_prods == 0) {