From f309e42a343cf35805e0cc6bf9dfb2965f67a623 Mon Sep 17 00:00:00 2001 From: IoTcat Date: Sun, 26 May 2019 20:29:35 +0800 Subject: [PATCH] fix several bugs --- lib/ovo.h | 3 +++ src/main.cpp | 2 ++ src/park.cpp | 2 +- src/park.h | 2 +- 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/ovo.h b/lib/ovo.h index f15bb53..b0eb3b4 100644 --- a/lib/ovo.h +++ b/lib/ovo.h @@ -714,6 +714,7 @@ namespace ovo{ if(indexList["_isExist"] == "NO"){ return o; } + indexList.clear("_isExist"); if(indexList["__TABLE_INDEX__" + index] == "undefined"){ return o; } @@ -741,6 +742,7 @@ namespace ovo{ if(indexList["_isExist"] == "NO"){ return o; } + indexList.clear("_isExist"); d.forEach([&](string index, string val){ @@ -763,6 +765,7 @@ namespace ovo{ return o; } + indexList.clear("_isExist"); for(auto i : indexList){ o.push_back(this->getData(i.first)); diff --git a/src/main.cpp b/src/main.cpp index bb29e5c..a9de9ea 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -450,6 +450,7 @@ int main(int argc, char const* argv[]) { cin >> t_Type; Plot pp = p->getPlot(t_PlotID); + cout << pp.showAll(); if (!p->updatePlot(pp, t_Type)) { cout << endl << "Update Failure!!!" << endl; @@ -709,6 +710,7 @@ void manualIni(Park& p) { cout << "The " << ii << "th hour = "; cin >> fee[ii]; } + feeTable[i] = fee; } p.updateFeeTable(feeTable); diff --git a/src/park.cpp b/src/park.cpp index 7dfbbd5..d28ab62 100644 --- a/src/park.cpp +++ b/src/park.cpp @@ -229,7 +229,7 @@ const bool Park::newCar(const string& licenseNum, const string& type, return false; } - if (this->isGoodType(type)) { + if (!this->isGoodType(type)) { msg += "Car " + licenseNum + " Wrong Type!!!"; return false; } diff --git a/src/park.h b/src/park.h index 21b8e93..7b8905d 100644 --- a/src/park.h +++ b/src/park.h @@ -253,7 +253,7 @@ private: }; inline const bool isGoodType(const string& type) const { - return (bool)(find(this->_types.begin(), this->_types.end(), type) == + return (bool)(find(this->_types.begin(), this->_types.end(), type) != this->_types.end()); }; };