From c13ea1918c0c66836948e83b038f85c39b2cbf82 2017-08-16 12:52:39
From: mperrinel <mperrinel@itlink.fr>
Date: 2017-08-16 12:52:39
Subject: [PATCH] Correction for MR
---

diff --git a/core/src/Variable/VariableController.cpp b/core/src/Variable/VariableController.cpp
index 103a895..a7a67df 100644
--- a/core/src/Variable/VariableController.cpp
+++ b/core/src/Variable/VariableController.cpp
@@ -263,8 +263,7 @@ void VariableController::onDataProvided(QUuid vIdentifier, const SqpRange &range
                                         const SqpRange &cacheRangeRequested,
                                         QVector<AcquisitionDataPacket> dataAcquired)
 {
-    auto var = impl->findVariable(vIdentifier);
-    if (var != nullptr) {
+    if (auto var = impl->findVariable(vIdentifier)) {
         var->setRange(rangeRequested);
         var->setCacheRange(cacheRangeRequested);
         qCDebug(LOG_VariableController()) << tr("1: onDataProvided") << rangeRequested;
@@ -284,8 +283,7 @@ void VariableController::onDataProvided(QUuid vIdentifier, const SqpRange &range
 
 void VariableController::onVariableRetrieveDataInProgress(QUuid identifier, double progress)
 {
-    auto var = impl->findVariable(identifier);
-    if (var != nullptr) {
+    if (auto var = impl->findVariable(identifier)) {
         impl->m_VariableModel->setDataProgress(var, progress);
     }
     else {
@@ -331,14 +329,14 @@ void VariableController::onAddSynchronized(std::shared_ptr<Variable> variable,
 {
     qCDebug(LOG_VariableController()) << "TORM: VariableController::onAddSynchronized"
                                       << synchronizationGroupId;
-    auto vToVIdit = impl->m_VariableToIdentifierMap.find(variable);
-    if (vToVIdit != impl->m_VariableToIdentifierMap.cend()) {
-        auto itSynchroGroup
+    auto varToVarIdIt = impl->m_VariableToIdentifierMap.find(variable);
+    if (varToVarIdIt != impl->m_VariableToIdentifierMap.cend()) {
+        auto groupIdToVSGIt
             = impl->m_GroupIdToVariableSynchronizationGroupMap.find(synchronizationGroupId);
-        if (itSynchroGroup != impl->m_GroupIdToVariableSynchronizationGroupMap.cend()) {
+        if (groupIdToVSGIt != impl->m_GroupIdToVariableSynchronizationGroupMap.cend()) {
             impl->m_VariableIdGroupIdMap.insert(
-                std::make_pair(vToVIdit->second, synchronizationGroupId));
-            itSynchroGroup->second->addVariableId(vToVIdit->second);
+                std::make_pair(varToVarIdIt->second, synchronizationGroupId));
+            groupIdToVSGIt->second->addVariableId(varToVarIdIt->second);
         }
         else {
             qCCritical(LOG_VariableController())
@@ -359,13 +357,13 @@ void VariableController::onRequestDataLoading(QVector<std::shared_ptr<Variable> 
 {
     // NOTE: oldRange isn't really necessary since oldRange == variable->range().
 
-    qCInfo(LOG_VariableController()) << "VariableController::onRequestDataLoading"
-                                     << QThread::currentThread()->objectName();
+    qCDebug(LOG_VariableController()) << "VariableController::onRequestDataLoading"
+                                      << QThread::currentThread()->objectName();
     // we want to load data of the variable for the dateTime.
     // First we check if the cache contains some of them.
     // For the other, we ask the provider to give them.
 
-    foreach (auto var, variables) {
+    for (const auto &var : variables) {
         qCDebug(LOG_VariableController()) << "processRequest for" << var->name();
         impl->processRequest(var, range);
     }
@@ -373,9 +371,9 @@ void VariableController::onRequestDataLoading(QVector<std::shared_ptr<Variable> 
     if (synchronise) {
         // Get the group ids
         qCDebug(LOG_VariableController())
-            << "VariableController::onRequestDataLoading for synchro var ENABLE";
+            << "TORM VariableController::onRequestDataLoading for synchro var ENABLE";
         auto groupIds = std::set<QUuid>();
-        foreach (auto var, variables) {
+        for (const auto &var : variables) {
             auto varToVarIdIt = impl->m_VariableToIdentifierMap.find(var);
             if (varToVarIdIt != impl->m_VariableToIdentifierMap.cend()) {
                 auto vId = varToVarIdIt->second;
@@ -391,7 +389,7 @@ void VariableController::onRequestDataLoading(QVector<std::shared_ptr<Variable> 
         }
 
         // We assume here all group ids exist
-        foreach (auto gId, groupIds) {
+        for (const auto &gId : groupIds) {
             auto vSynchronizationGroup = impl->m_GroupIdToVariableSynchronizationGroupMap.at(gId);
             auto vSyncIds = vSynchronizationGroup->getIds();
             qCDebug(LOG_VariableController()) << "Var in synchro group ";
diff --git a/plugins/amda/src/AmdaProvider.cpp b/plugins/amda/src/AmdaProvider.cpp
index 9f90d82..baa2b00 100644
--- a/plugins/amda/src/AmdaProvider.cpp
+++ b/plugins/amda/src/AmdaProvider.cpp
@@ -62,7 +62,9 @@ void AmdaProvider::requestDataLoading(QUuid acqIdentifier, const DataProviderPar
     const auto data = parameters.m_Data;
     for (const auto &dateTime : qAsConst(times)) {
         this->retrieveData(acqIdentifier, dateTime, data);
-        QThread::msleep(200);
+
+        // TORM
+        // QThread::msleep(200);
     }
 }
 
@@ -92,7 +94,7 @@ void AmdaProvider::retrieveData(QUuid token, const SqpRange &dateTime, const QVa
     auto endDate = dateFormat(dateTime.m_TEnd);
 
     auto url = QUrl{QString{AMDA_URL_FORMAT}.arg(startDate, endDate, productId)};
-    qCInfo(LOG_AmdaProvider()) << tr("AmdaProvider::retrieveData url:") << url;
+    qCInfo(LOG_AmdaProvider()) << tr("TORM AmdaProvider::retrieveData url:") << url;
     auto tempFile = std::make_shared<QTemporaryFile>();
 
     // LAMBDA
@@ -128,8 +130,8 @@ void AmdaProvider::retrieveData(QUuid token, const SqpRange &dateTime, const QVa
                   auto downloadFileUrl = QUrl{QString{reply->readAll()}};
 
 
-                  qCInfo(LOG_AmdaProvider()) << tr("AmdaProvider::retrieveData downloadFileUrl:")
-                                             << downloadFileUrl;
+                  qCInfo(LOG_AmdaProvider())
+                      << tr("TORM AmdaProvider::retrieveData downloadFileUrl:") << downloadFileUrl;
                   // Executes request for downloading file //
 
                   // Creates destination file