still no clue

This commit is contained in:
MassiveAtoms
2019-07-01 15:12:15 -03:00
parent 5fa84e866f
commit c6ce3c821f
6 changed files with 67 additions and 43 deletions

View File

@ -25,6 +25,10 @@ vector<Park_time> query_parktimes_for_customer(int cid) {
return park_times;
}
//--------------------------------------------- customers
vector<Customer> query_customer_with_name(string name) {
/*
We use this instead of plain customers because:
@ -71,6 +75,22 @@ Customer query_customer_with_id(int id) {
}
}
Customer* get_customer_ptr_for_parkspot(int id) {
if (!id) {
return 0;
}
for (int i = 0; i < park_customers.size(); i++) {
if (park_customers[i].id == id) {
return &park_customers[i];
}
}
return 0;
}
// -------------- paroking spots
void query_all_parking_spots() {
SQLite::Statement query(data::db, "SELECT * FROM Park_spot WHERE id > ?;");
query.bind(1, 0);
@ -79,20 +99,9 @@ void query_all_parking_spots() {
int taken = query.getColumn(1);
int cid = query.getColumn(2);
park_customers.push_back(query_customer_with_id(cid));
parking_spots.push_back(
Park_spot{get_customer_ptr_for_parkspot(cid), id, bool(taken)});
parking_spots.push_back({id, taken, get_customer_ptr_for_parkspot(cid)});
// parking_spots.push_back(temp);
}
cout << "WUT?";
}
Customer* get_customer_ptr_for_parkspot(int id) {
if (!id) {
return nullptr;
}
for (int i = 0; i < park_customers.size(); i++) {
if (park_customers[i].id == id) {
return &park_customers[i];
}
}
return nullptr;
}