diff --git a/Park_time.cpp b/Park_time.cpp index aa0ac0b..1314687 100644 --- a/Park_time.cpp +++ b/Park_time.cpp @@ -60,7 +60,8 @@ std::ostream& operator<<(std::ostream& os, const Park_time& pt) { os << "Customer # " << pt.customer_id << "at parking spot " << pt.spot_id << "\n"; os << "Clocked in :" << std::ctime(&start_); os << "clocked out : " << std::ctime(&end_); - os << "duration : " << pt.duration/3600 << "\n"; + float dur_h = pt.duration / 3600.0; + os << "duration : " << dur_h << " h\n"; os << "- - - - - - - - - - - - - - - - - - - -\n"; return os; } diff --git a/Query.cpp b/Query.cpp index 27d4900..8f8aaf0 100644 --- a/Query.cpp +++ b/Query.cpp @@ -149,7 +149,6 @@ vector reports_from_customer(int cid, pair period) { vector park_times; int verhicle = int(query_customer_with_id(cid).vehicle); float sum = 0; - cout << period.first; // debug SQLite::Statement query( data::db, "SELECT * FROM Park_time WHERE customer_id = ? AND start > ? AND end < ?;"); query.bind(1, cid); @@ -162,14 +161,14 @@ vector reports_from_customer(int cid, pair period) { int duration = query.getColumn(5); Park_time result{id, cid, spotid, start, duration}; park_times.push_back(result); - sum += duration; + sum += duration/3600; } query.reset(); for (auto i : park_times) { cout << i; - sum += i.duration / 3600; + sum += i.duration / 3600.0; } - cout << "Your fees for this month: $" << sum * verhicle << "/n"; + cout << "Your fees for this month: $" << sum * verhicle << "\n"; return park_times; } \ No newline at end of file diff --git a/__test.db3 b/__test.db3 new file mode 100644 index 0000000..2339809 Binary files /dev/null and b/__test.db3 differ diff --git a/oldtest.db3 b/oldtest.db3 deleted file mode 100644 index 4f0d862..0000000 Binary files a/oldtest.db3 and /dev/null differ diff --git a/test.db3 b/test.db3 index 2339809..9e5f09b 100644 Binary files a/test.db3 and b/test.db3 differ