mirror of
https://gitlab.com/spaceti-app/integrations/acs/colnod-connector.git
synced 2026-07-12 10:50:38 +02:00
Add handle of init new tokens
This commit is contained in:
parent
1945e7e002
commit
53697249c6
@ -99,7 +99,7 @@ bool SyncManager::startSynchronization()
|
||||
qInfo(syncmanager) << "PROCESSING DATA -> FINISHED";
|
||||
qInfo(syncmanager) << equals;
|
||||
|
||||
updateLastUpdate(syncBegin);
|
||||
updateLastUpdate(syncBegin); // TODO: change to update all attrinutes
|
||||
connect(this, &SyncManager::syncFinished, [=](){
|
||||
if (database->isValid() && colnod->isValid()) {
|
||||
database->setLastSync(syncBegin);
|
||||
@ -168,6 +168,9 @@ std::unique_ptr<PreparedData> SyncManager::prepareDataNew(const std::shared_ptr<
|
||||
qInfo(syncmanager) << dash;
|
||||
|
||||
for (const auto &databaseToken : databaseData->updatedTokens) {
|
||||
if (databaseToken->name().isEmpty()) {
|
||||
initNewToken(databaseToken);
|
||||
}
|
||||
|
||||
// restriction cauesed by colnod rest api
|
||||
if (databaseToken->description() != "mobile") {
|
||||
@ -199,6 +202,16 @@ std::unique_ptr<PreparedData> SyncManager::prepareDataNew(const std::shared_ptr<
|
||||
return preparedData;
|
||||
}
|
||||
|
||||
void SyncManager::initNewToken(std::shared_ptr<Token> token)
|
||||
{
|
||||
qint16 num = database->getNumOfTokensOfSubject(token->subjectId());
|
||||
token->setName(database->getSubjectNameByTokenId(token->id()) + "_mobile_" + QString::number(num + 1));
|
||||
token->setDescription("mobile");
|
||||
token->setTokenData(token->tokenData().toUpper());
|
||||
|
||||
qInfo(syncmanager).noquote() << Message::massageTemplate("Inicializing new", "token", "sync manager", token->name());
|
||||
}
|
||||
|
||||
bool SyncManager::downloadData()
|
||||
{
|
||||
bool res = true;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user