heavily simplified imports and using directives
This commit is contained in:
@ -1,6 +1,4 @@
|
||||
#include"headers/Park_time.h"
|
||||
#include <iostream>
|
||||
#include <ctime>
|
||||
|
||||
|
||||
Park_time::Park_time(int c_id, int s_id)
|
||||
@ -13,15 +11,19 @@ Park_time::Park_time(int c_id, int s_id)
|
||||
save_db();
|
||||
}
|
||||
|
||||
Park_time::~Park_time(){
|
||||
update_db();
|
||||
}
|
||||
|
||||
void Park_time::clock_out(int c_id, int s_id)
|
||||
{
|
||||
|
||||
if (c_id != customer_id) {
|
||||
std::cout << "wrong customer id, you are at the wrong location";
|
||||
cout << "wrong customer id, you are at the wrong location";
|
||||
return;
|
||||
}
|
||||
if (s_id != spot_id) {
|
||||
std::cout << "Wrong spot id, you're at the wrong location";
|
||||
cout << "Wrong spot id, you're at the wrong location";
|
||||
return;
|
||||
}
|
||||
|
||||
@ -31,7 +33,7 @@ void Park_time::clock_out(int c_id, int s_id)
|
||||
update_db();
|
||||
|
||||
} else {
|
||||
std::cout << "Already clocked out. Something is wrong \n";
|
||||
cout << "Already clocked out. Something is wrong \n";
|
||||
}
|
||||
}
|
||||
|
||||
@ -50,7 +52,7 @@ std::ostream& operator<<(std::ostream& os, const Park_time & pt){
|
||||
|
||||
int Park_time::start_to_int(){
|
||||
auto start_to_epoch = start.time_since_epoch();
|
||||
auto start_value = std::chrono::duration_cast<std::chrono::seconds>(start_to_epoch);
|
||||
auto start_value = duration_cast<seconds>(start_to_epoch);
|
||||
int start_seconds = start_value.count();
|
||||
return start_seconds;
|
||||
}
|
||||
@ -74,7 +76,7 @@ void Park_time::save_db() {
|
||||
|
||||
void Park_time::update_db() {
|
||||
string statement = "UPDATE Park_time SET end = , duration = where id = '';";
|
||||
statement.insert(53, std::to_string(id));
|
||||
statement.insert(53, to_string(id));
|
||||
statement.insert(40, to_string(duration));
|
||||
statement.insert(27, to_string(start_to_int() + duration));
|
||||
data::db.exec(statement);
|
||||
|
Reference in New Issue
Block a user