Verbessere die Statusverarbeitung in der Methode spyIn, indem die Zuweisung des Status aus dem JSON-Objekt optimiert wird. Verwende nun die get-Methode für eine klarere und sicherere Zuweisung.
This commit is contained in:
committed by
Torsten (PC)
parent
8ba4566d23
commit
8b9ff9793c
@@ -110,8 +110,11 @@ nlohmann::json UndergroundWorker::spyIn(int performerId,int victimId,const json&
|
|||||||
}
|
}
|
||||||
std::string status = "pending";
|
std::string status = "pending";
|
||||||
if(result.is_object()){
|
if(result.is_object()){
|
||||||
if(auto s = result.find("status"); s!=result.end() && s->is_string()) status = *s;
|
if(auto s = result.find("status"); s!=result.end() && s->is_string()) {
|
||||||
else status = "done";
|
status = s->get<std::string>();
|
||||||
|
} else {
|
||||||
|
status = "done";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
activities.push_back({
|
activities.push_back({
|
||||||
{"id", std::stoi(r.at("id"))},
|
{"id", std::stoi(r.at("id"))},
|
||||||
|
|||||||
Reference in New Issue
Block a user