Skip to content

Commit

Permalink
Log out total entries from visma, aswell as total repacked entries
Browse files Browse the repository at this point in the history
  • Loading branch information
runely committed Jun 15, 2022
1 parent 7807d83 commit 628a07f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/Visma/get-visma-data.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const { writeFileSync } = require('fs')
const { logger } = require('@vtfk/logger')
const getVismaData = require('./get-data')
const convertToJson = require('../convert-xml-to-json')
const repack = require('./repack-visma-data')
Expand All @@ -14,7 +15,9 @@ module.exports = async (options = {}) => {
if (debug) writeFileSync(`./data/debug/visma_raw_${env}.json`, JSON.stringify(vismaJson, null, 2), 'utf8')

const persons = Array.isArray(vismaJson.personsXML?.person || vismaJson.person) ? vismaJson.personsXML?.person || vismaJson.person : [vismaJson.personsXML?.person || vismaJson.person]
logger('info', ['get-visma-data', 'total entries', persons.length])
const repacked = repack(persons)
logger('info', ['get-visma-data', 'repacked entries', repacked.length])
if (!DEMO) writeFileSync(`./data/visma_${env}.json`, JSON.stringify(repacked, null, 2), 'utf8')
else writeFileSync(`./data/demo/visma_${env}.json`, JSON.stringify(repacked, null, 2), 'utf8')
return repacked
Expand Down

0 comments on commit 628a07f

Please sign in to comment.