[admin][bug] fix stats directory

This commit is contained in:
Andrea Vos 2022-12-31 16:02:19 +01:00
parent d34fe58acb
commit dcc418bc98
2 changed files with 3 additions and 3 deletions

View File

@ -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}))

View File

@ -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({