Check for automatic update and add a hint in SEND-LAST-MESSAGE.

This commit is contained in:
Gerhard Hoffmann 2024-01-19 13:40:24 +01:00
parent 41392a98e3
commit 6b3ebde2b5
2 changed files with 16 additions and 5 deletions

View File

@ -270,12 +270,14 @@ void Worker::privateUpdate() {
m_ismasTriggerActive = false;
m_updateNotNecessary = false;
QDateTime const &current = QDateTime::currentDateTime();
m_automaticUpdate = (current.time().hour() < 4);
m_ismasTriggerActive = updateTriggerSet();
if (m_ismasTriggerActive == false) {
if (QDir(m_customerRepository).exists()) { // ignore a possibly corrupted repository
m_versionInfo = m_gc.gitShowReason(m_branchName);
QDateTime const &current = QDateTime::currentDateTime();
if (current.time().hour() < 4) { // update has been triggered within [00:00:00, 00:03:59]
if (m_automaticUpdate) { // update has been triggered within [00:00:00, 00:03:59]
m_updateNotNecessary = true;
m_ismasTriggerStatusMessage = QStringList(QString("NO UPDATE NECESSARY (%1)").arg(current.toString(Qt::ISODate)));
m_lastFailedUpdateStep = UPDATE_STEP::NONE;

View File

@ -160,6 +160,7 @@ class Worker : public QThread{
bool m_repairClone = false;
bool m_ismasTriggerActive = false;
bool m_updateNotNecessary = false;
bool m_automaticUpdate = false;
QStringList m_ismasTriggerStatusMessage;
MainWindow *m_mainWindow;
@ -207,7 +208,6 @@ class Worker : public QThread{
if (m_worker->m_lastFailedUpdateStep == UPDATE_STEP::NONE) {
if (m_worker->m_updateNotNecessary) {
// m_ismasTriggerStatusMessage = QStringList(QString("NO UPDATE NECESSARY (%1)").arg(current.toString(Qt::ISODate)));
QStringList lst = m_worker->m_ismasTriggerStatusMessage;
m_worker->GUI(lst) << (m_worker->CONSOLE(lst) << (m_worker->ISMAS(lst) << UPDATE_STEP::UPDATE_NOT_NECESSARY));
} else {
@ -229,8 +229,17 @@ class Worker : public QThread{
m_worker->GUI(lst) << (m_worker->CONSOLE(lst) << (m_worker->ISMAS(lst) << UPDATE_STEP::UPDATE_FAILED));
}
m_worker->ISMAS() << (m_worker->GUI() << (m_worker->CONSOLE()
<< UPDATE_STEP::SEND_LAST_VERSION));
if (m_worker->m_automaticUpdate) {
QStringList lst = (QStringList() << "AUTOMATIC UPDATE");
if (m_worker->m_updateNotNecessary) {
lst << "UPDATE NOT NECESSARY";
}
m_worker->ISMAS(lst) << (m_worker->GUI(lst) << (m_worker->CONSOLE(lst)
<< UPDATE_STEP::SEND_LAST_VERSION));
} else {
m_worker->ISMAS() << (m_worker->GUI() << (m_worker->CONSOLE()
<< UPDATE_STEP::SEND_LAST_VERSION));
}
m_worker->stopProgressLoop();
m_worker->m_updateProcessRunning = false;