testilo 6.1.2 → 6.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/score.js +3 -4
package/package.json
CHANGED
package/score.js
CHANGED
|
@@ -27,8 +27,7 @@ const reportDirScored = process.env.REPORTDIR_SCORED || 'reports/scored';
|
|
|
27
27
|
// Score the specified reports and return their count.
|
|
28
28
|
exports.score = async (scoreProcID, reportIDStart) => {
|
|
29
29
|
// Identify the reports to be scored.
|
|
30
|
-
|
|
31
|
-
let reportFileNames = await fs.readdir(reportDirRawAbs);
|
|
30
|
+
let reportFileNames = await fs.readdir(reportDirRaw);
|
|
32
31
|
reportFileNames = reportFileNames.filter(fileName => fileName.endsWith('.json'));
|
|
33
32
|
if (reportIDStart) {
|
|
34
33
|
reportFileNames = reportFileNames.filter(fileName => fileName.startsWith(reportIDStart));
|
|
@@ -37,13 +36,13 @@ exports.score = async (scoreProcID, reportIDStart) => {
|
|
|
37
36
|
const {scorer} = require(`./procs/score/${scoreProcID}`);
|
|
38
37
|
for (const fileName of reportFileNames) {
|
|
39
38
|
// Score it.
|
|
40
|
-
const reportJSON = await fs.readFile(`${
|
|
39
|
+
const reportJSON = await fs.readFile(`${reportDirRaw}/${fileName}`, 'utf8');
|
|
41
40
|
const report = JSON.parse(reportJSON);
|
|
42
41
|
await scorer(report);
|
|
43
42
|
report.scoreProcID = scoreProcID;
|
|
44
43
|
// Write it to a file.
|
|
45
44
|
const scoredReportJSON = JSON.stringify(report, null, 2);
|
|
46
|
-
await fs.writeFile(`${
|
|
45
|
+
await fs.writeFile(`${reportDirScored}/${fileName}`, `${scoredReportJSON}\n`);
|
|
47
46
|
console.log(`Report ${fileName.slice(0, -5)} scored and saved`);
|
|
48
47
|
};
|
|
49
48
|
return reportFileNames.length;
|