Update not necessary between 0:00 - 4:00.

This commit is contained in:
Gerhard Hoffmann 2025-02-21 12:33:39 +01:00
parent 8c66e03ea3
commit 5d3849dcf3

View File

@ -15,6 +15,7 @@
#include <QRegularExpression>
#include <QFile>
#include <QTextStream>
#include <QDateTime>
#include <optional>
@ -119,16 +120,25 @@ int main(int argc, char **argv) {
for (QString const &m : d.object().keys()) { // request ack
if (!m.contains("FileUpload", Qt::CaseInsensitive)) continue;
QJsonObject o = d.object()[m].toObject();
QJsonObject o2 = d.object()[m].toObject();
QJsonObject::const_iterator it = o.find("TRG");
if (it == o.constEnd()) break;
QJsonObject::const_iterator it2 = o2.find("TRG");
if (it2 == o2.constEnd()) break;
QString const &v = it->toString();
if (v == "WAIT") {
QString const &v2 = it2->toString();
if (v2 == "WAIT") {
updateRequestStatus = internal::UPDATE_REQUESTED;
} else {
// the customer-repository does exist, and the ISMAS-trigger is
// *NOT* "WAIT", but from 00:00:00 - 00:03:59 this counts as an
// automatic update
QDateTime const &current = QDateTime::currentDateTime();
if (current.time().hour() < 4) {
updateRequestStatus = internal::UPDATE_NOT_NECESSARY;
} else {
updateRequestStatus = internal::UPDATE_NOT_REQUESTED;
exitCode = -2;
}
}
break;
}
@ -149,7 +159,5 @@ int main(int argc, char **argv) {
debug.noquote() << connectionStatus;
}
qCritical() << __func__ << ":" << __LINE__ << exitCode;
return exitCode;
}