Merge pull request #4813 from overleaf/jpa-debug-non-pro

[web] check_institution_users: add option for debugging non pro users

GitOrigin-RevId: 11743e10a8be567028611d7e109c0450b08e11fc
This commit is contained in:
Jakob Ackermann 2021-08-18 16:56:07 +02:00 committed by Copybot
parent cd8518b9de
commit 75a602ec29
2 changed files with 7 additions and 2 deletions

View file

@ -70,7 +70,7 @@ async function _checkUsersFeatures(userIds) {
return result
}
async function checkInstitutionUsers(institutionId) {
async function checkInstitutionUsers(institutionId, emitNonProUserIds) {
/*
v1 has affiliation data. Via getInstitutionAffiliationsCounts, v1 will send
lapsed_user_ids, which includes all user types
@ -178,6 +178,9 @@ async function checkInstitutionUsers(institutionId) {
result.emailUsers.nonPro[userType]++
}
})
if (emitNonProUserIds) {
result.nonProUserIds = nonProUserIds
}
return result
}

View file

@ -4,6 +4,7 @@ const InstitutionsManager = require('../app/src/Features/Institutions/Institutio
const institutionId = parseInt(process.argv[2])
if (isNaN(institutionId)) throw new Error('No institution id')
console.log('Checking users of institution', institutionId)
const emitNonProUserIds = process.argv.includes('--emit-non-pro-user-ids')
waitForDb()
.then(main)
@ -14,7 +15,8 @@ waitForDb()
async function main() {
const usersSummary = await InstitutionsManager.promises.checkInstitutionUsers(
institutionId
institutionId,
emitNonProUserIds
)
console.log(usersSummary)
process.exit()