specific reasource syncing fixes

This commit is contained in:
mrfry 2023-04-28 08:23:07 +02:00
parent 6d02af2fe1
commit 2f24f214b2

View file

@ -693,7 +693,12 @@ function setup(data: SubmoduleData): Submodule {
logger.Log(
`\tSyncing: ${
syncAll ? 'everything' : Object.keys(syncAll).join(', ')
syncAll
? 'everything'
: Object.entries(shouldSync)
.filter(([_key, value]) => value)
.map(([key]) => key)
.join(', ')
}`,
'green'
)
@ -719,7 +724,7 @@ function setup(data: SubmoduleData): Submodule {
})
logger.Log(`\tLast sync with peers:`)
logger.logTable([['', 'Date'], ...lastSyncInfos], {
colWidth: [15],
colWidth: [20],
rowPrefix: '\t',
})
@ -827,13 +832,13 @@ function setup(data: SubmoduleData): Submodule {
const syncResults: SyncResult[] = []
const userData = getData('users')
if (userData) {
if (userData && userData.length > 0) {
const res = await syncUsers(userData, syncStart)
syncResults.push(res)
}
const questionData = getData('questions')
if (userData) {
if (questionData && questionData.length > 0) {
const res = await syncQuestions(questionData, syncStart)
syncResults.push(res)
}
@ -915,7 +920,7 @@ function setup(data: SubmoduleData): Submodule {
['Added total', newUserCount - oldUserCount],
['Final', newUserCount],
],
{ colWidth: [15], rowPrefix: '\t' }
{ colWidth: [20], rowPrefix: '\t' }
)
}
logger.Log(`Successfully synced users!`, 'green')
@ -975,7 +980,7 @@ function setup(data: SubmoduleData): Submodule {
logger.logTable(
[['', 'QDBs', 'Subjs', 'Questions'], ...recievedDataCounts],
{
colWidth: [15],
colWidth: [20],
rowPrefix: '\t',
}
)
@ -1105,7 +1110,7 @@ function setup(data: SubmoduleData): Submodule {
],
['Final', newQuestionDbCount, newSubjCount, newQuestionCount],
],
{ colWidth: [15], rowPrefix: '\t' }
{ colWidth: [20], rowPrefix: '\t' }
)
logger.Log(`Successfully synced questions!`, 'green')