diff --git a/worker.cpp b/worker.cpp index f143a96..a0d17dc 100644 --- a/worker.cpp +++ b/worker.cpp @@ -132,6 +132,8 @@ void Worker::privateUpdate() { QDir customerRepository(m_customerRepository); if (!customerRepository.exists()) { if (m_gc.gitCloneAndCheckoutBranch()) { + emit appendText("\nInitializing customer environment", UPDATE_STEP_DONE); + m_updateStatus = UpdateStatus(UPDATE_STATUS::UPDATE_PROCESS_SUCCESS, QString("CLONED AND CHECKED OUT: ") + m_customerRepository); @@ -144,13 +146,17 @@ void Worker::privateUpdate() { QString("#M=APISM#C=CMD_EVENT#J=") + m_ismasClient.updateOfPSASucceeded("")); - emit setProgress(95); - m_ismasClient.setProgressInPercent(95); + emit appendText(QString(""), UPDATE_STEP_SUCCESS); + + emit setProgress(100); + m_ismasClient.setProgressInPercent(100); IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT, QString("#M=APISM#C=CMD_EVENT#J=") + m_ismasClient.updateOfPSAActivated()); + m_returnCode = 0; } } else { + qCritical() << "CHECKOUT BRANCH..."; // checkout branch if (m_gc.gitCheckoutBranch()) { int progress = 10; @@ -228,23 +234,19 @@ void Worker::privateUpdate() { m_returnCode = -1; } } + + emit setProgress(100); + m_ismasClient.setProgressInPercent(100); + if (!sentIsmasLastVersionNotification) { // try even if the backend is not connected - emit setProgress(100); - m_ismasClient.setProgressInPercent(100); - - if (m_returnCode == 0) { - IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT, - QString("#M=APISM#C=CMD_EVENT#J=") + - m_ismasClient.updateOfPSASucceeded("")); - emit appendText(QString(""), UPDATE_STEP_SUCCESS); - } else { - emit appendText(QString(""), UPDATE_STEP_FAIL); - } - sendIsmasLastVersionNotification(); } + if (m_returnCode != 0) { + emit appendText(QString("Update process "), UPDATE_STEP_FAIL); + } + m_updateProcessRunning = false; emit enableExit(); emit restartExitTimer();