testilo 33.0.1 → 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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/rescore.js +20 -7
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "testilo",
3
- "version": "33.0.1",
3
+ "version": "33.0.3",
4
4
  "description": "Prepares and processes Testaro reports",
5
5
  "main": "call.js",
6
6
  "scripts": {
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,8 +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.
34
- console.log(`ERROR: Report includes only tools ${Array.from(reportToolIDs).join(', ')}`);
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}`);
35
41
  }
36
42
  }
37
43
  // Otherwise, if issues are restricted:
@@ -93,16 +99,23 @@ exports.rescore = (scorer, report, restrictionType, includedIDs) => {
93
99
  }
94
100
  // Otherwise, i.e. if neither tools nor issues are restricted:
95
101
  else {
96
- // Report this.
97
- console.log('ERROR: Neither tools nor issues are restricted');
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}`);
98
107
  }
99
108
  // Add rescoring data to the report.
100
109
  report.rescore = {
101
110
  originalID: id,
102
111
  timeStamp: getNowStamp(),
103
112
  restrictionType,
104
- includedIDs
113
+ includedIDs,
114
+ result
115
+ }
116
+ // If rescoring was not aborted:
117
+ if (result.success) {
118
+ // Rescore the revised report.
119
+ scorer(report);
105
120
  }
106
- // Score the revised report.
107
- scorer(report);
108
121
  }