diff --git a/server/stats.js b/server/stats.js index 47f92d905..b1e84d0c4 100644 --- a/server/stats.js +++ b/server/stats.js @@ -9,7 +9,7 @@ const util = require('util'); async function calculate() { const db = await dbConnection(); - const stats = await calculateStats(db, buildLocaleList(null, true)); + const stats = await calculateStats(db, buildLocaleList(null, true), __dirname + '/..'); await db.close(); console.log(util.inspect(stats, {showHidden: false, depth: null, colors: true})) diff --git a/src/stats.js b/src/stats.js index 197124078..639f2d62f 100644 --- a/src/stats.js +++ b/src/stats.js @@ -110,7 +110,7 @@ const checkHeartbeat = async () => { return heartbeat; } -module.exports.calculateStats = async (db, allLocales) => { +module.exports.calculateStats = async (db, allLocales, projectDir) => { const id = ulid(); const heartbeat = await checkHeartbeat(); @@ -137,7 +137,7 @@ module.exports.calculateStats = async (db, allLocales) => { for (let locale in allLocales) { if (!allLocales.hasOwnProperty(locale)) { continue; } - const translations = new Suml().parse(fs.readFileSync(`./locale/${locale}/translations.suml`).toString()); + const translations = new Suml().parse(fs.readFileSync(`${projectDir}/locale/${locale}/translations.suml`).toString()); const missingTranslations = expectedTranslations.filter(key => deepGet(translations, key) === undefined).length; stats.push({