Skip to content

Commit

Permalink
Merge pull request #5 from vACDM/bugfix/tobt_tsat
Browse files Browse the repository at this point in the history
fix unintended reset of TSAT
  • Loading branch information
svengcz authored Apr 19, 2023
2 parents b1563a9 + e63cbcc commit a40372a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions com/Airport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,14 @@ void Airport::updateTobt(const std::string& callsign, const std::chrono::utc_clo

auto it = this->m_flights.find(callsign);
if (it != this->m_flights.end() && it->second[FlightServer].callsign == callsign) {
bool resetTsat = (tobt == types::defaultTime && true == manualTobt) || tobt >= it->second[FlightConsolidated].tsat;
Json::Value root;

root["callsign"] = callsign;
root["vacdm"] = Json::Value();
root["vacdm"]["tobt"] = Airport::timestampToIsoString(tobt);
root["vacdm"]["tsat"] = Airport::timestampToIsoString(types::defaultTime);
if (true == resetTsat)
root["vacdm"]["tsat"] = Airport::timestampToIsoString(types::defaultTime);
if (false == manualTobt)
root["vacdm"]["tobt_state"] = "NOW";
root["vacdm"]["ttot"] = root["vacdm"]["tsat"].asString();
Expand All @@ -165,7 +167,8 @@ void Airport::updateTobt(const std::string& callsign, const std::chrono::utc_clo

it->second[FlightEuroscope].lastUpdate = std::chrono::utc_clock::now();
it->second[FlightConsolidated].tobt = tobt;
it->second[FlightConsolidated].tsat = types::defaultTime;
if (true == resetTsat)
it->second[FlightConsolidated].tsat = types::defaultTime;
it->second[FlightConsolidated].ttot = types::defaultTime;
it->second[FlightConsolidated].exot = types::defaultTime;
it->second[FlightConsolidated].asat = types::defaultTime;
Expand Down

0 comments on commit a40372a

Please sign in to comment.