Merge pull request #12816 from overleaf/bg-recurly-scripts-cleanup

sort recurly script JSON outputs for consistency

GitOrigin-RevId: e5dc789fd834e9864912e3ef14ac3e6bf8eb7d99
This commit is contained in:
Brian Gough 2023-04-26 14:25:22 +01:00 committed by Copybot
parent 46fb6f7c83
commit c3ad6645fe
2 changed files with 3 additions and 3 deletions

View file

@ -46,7 +46,7 @@ function computePrices(plan) {
unitAmount: parseInt(prices[currency], 10), unitAmount: parseInt(prices[currency], 10),
}) })
} }
return result return _.sortBy(result, 'currency')
} }
// Handle prices for license add-ons associated with group plans // Handle prices for license add-ons associated with group plans
@ -106,7 +106,7 @@ function generate(inputFile, outputFile) {
const input = fs.readFileSync(inputFile, 'utf8') const input = fs.readFileSync(inputFile, 'utf8')
const rawRecords = csv.parse(input, { columns: true }) const rawRecords = csv.parse(input, { columns: true })
// transform the raw records into the output format // transform the raw records into the output format
const plans = rawRecords.map(transformRecordToPlan) const plans = _.sortBy(rawRecords, 'plan_code').map(transformRecordToPlan)
const output = JSON.stringify(plans, null, 2) const output = JSON.stringify(plans, null, 2)
fs.writeFileSync(outputFile, output) fs.writeFileSync(outputFile, output)
} }

View file

@ -35,7 +35,7 @@ async function getRecurlyPlans() {
} }
result.push(plan) result.push(plan)
} }
return result return _.sortBy(result, 'code')
} }
async function getRecurlyPlanAddOns(plan) { async function getRecurlyPlanAddOns(plan) {