testilo 33.0.2 → 33.0.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/rescore.js +20 -9
package/package.json
CHANGED
package/rescore.js
CHANGED
|
@@ -17,6 +17,9 @@ const {getNowStamp} = require('./procs/util');
|
|
|
17
17
|
|
|
18
18
|
// Rescores a report.
|
|
19
19
|
exports.rescore = (scorer, report, restrictionType, includedIDs) => {
|
|
20
|
+
const result = {
|
|
21
|
+
success: true
|
|
22
|
+
};
|
|
20
23
|
// If tools are restricted:
|
|
21
24
|
const {acts, id, score} = report;
|
|
22
25
|
if (restrictionType === 'tools') {
|
|
@@ -30,9 +33,11 @@ exports.rescore = (scorer, report, restrictionType, includedIDs) => {
|
|
|
30
33
|
}
|
|
31
34
|
// Otherwise, i.e. if any tool included by the restriction is not in the report:
|
|
32
35
|
else {
|
|
33
|
-
// Report this and
|
|
34
|
-
|
|
35
|
-
|
|
36
|
+
// Report this and abort rescoring.
|
|
37
|
+
const message = `Report includes only tools ${Array.from(reportToolIDs).join(', ')}`;
|
|
38
|
+
result.success = false;
|
|
39
|
+
result.error = message;
|
|
40
|
+
console.log(`ERROR: ${message}`);
|
|
36
41
|
}
|
|
37
42
|
}
|
|
38
43
|
// Otherwise, if issues are restricted:
|
|
@@ -94,17 +99,23 @@ exports.rescore = (scorer, report, restrictionType, includedIDs) => {
|
|
|
94
99
|
}
|
|
95
100
|
// Otherwise, i.e. if neither tools nor issues are restricted:
|
|
96
101
|
else {
|
|
97
|
-
// Report this and
|
|
98
|
-
|
|
99
|
-
|
|
102
|
+
// Report this and abort rescoring.
|
|
103
|
+
const message = 'Neither tools nor issues are restricted';
|
|
104
|
+
result.success = false;
|
|
105
|
+
result.error = message;
|
|
106
|
+
console.log(`ERROR: ${message}`);
|
|
100
107
|
}
|
|
101
108
|
// Add rescoring data to the report.
|
|
102
109
|
report.rescore = {
|
|
103
110
|
originalID: id,
|
|
104
111
|
timeStamp: getNowStamp(),
|
|
105
112
|
restrictionType,
|
|
106
|
-
includedIDs
|
|
113
|
+
includedIDs,
|
|
114
|
+
result
|
|
115
|
+
}
|
|
116
|
+
// If rescoring was not aborted:
|
|
117
|
+
if (result.success) {
|
|
118
|
+
// Rescore the revised report.
|
|
119
|
+
scorer(report);
|
|
107
120
|
}
|
|
108
|
-
// Score the revised report.
|
|
109
|
-
scorer(report);
|
|
110
121
|
}
|