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