ui/map: fix wrong remaining time (#28960)

This commit is contained in:
Dean Lee
2023-07-15 20:28:21 +08:00
committed by GitHub
parent 187696977e
commit 53934c7fee
+2 -3
View File
@@ -548,9 +548,8 @@ void MapETA::updateETA(float s, float s_typical, float d) {
: std::array{eta_t.toString("h:mm a").split(' ')[0], eta_t.toString("a")};
// Remaining time
auto time_t = QDateTime::fromTime_t(s);
auto remaining = s < 3600 ? std::array{time_t.toString("m"), tr("min")}
: std::array{time_t.toString("h:mm"), tr("hr")};
auto remaining = s < 3600 ? std::array{QString::number(int(s / 60)), tr("min")}
: std::array{QString("%1:%2").arg((int)s / 3600).arg(((int)s % 3600) / 60, 2, 10, QLatin1Char('0')), tr("hr")};
QString color = "#25DA6E";
if (s / s_typical > 1.5) color = "#DA3025";
else if (s / s_typical > 1.2) color = "#DAA725";