testilo 33.0.2 → 33.1.0

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/README.md CHANGED
@@ -875,11 +875,12 @@ A user can invoke `track()` in one of these ways:
875
875
  ```javaScript
876
876
  node call track ttp99a 'main competitors'
877
877
  node call track ttp99a 'main competitors' 241016
878
+ node call track ttp99a 'main competitors' '' 'ABC Foundation'
878
879
  node call track ttp99a 'main competitors' 241016 'ABC Foundation'
879
880
  ```
880
881
 
881
882
  When a user invokes `track()` in this example, the `call` module:
882
- - gets the summary report from the last file in the `summarized` subdirectory of the `REPORTDIR` directory, or if the third argument to `call()` exists the last one whose name begins with `'241016'`.
883
+ - gets the summary report from the last file in the `summarized` subdirectory of the `REPORTDIR` directory, or if the third argument to `call()` exists and is not empty the last one whose name begins with `'241016'`.
883
884
  - selects the summarized data for all results in the summary report, or if the fourth argument to `call()` exists from all results whose `target.what` property has the value `'ABC Foundation'`.
884
885
  - uses tracker `ttp99a` to create a tracking report that identifies “main competitors” as its subject.
885
886
  - assigns an ID to the tracking report.
package/call.js CHANGED
@@ -60,18 +60,24 @@ const getSummaryReport = async selector => {
60
60
  const summaryReportNames = await fs.readdir(summaryDir);
61
61
  let summaryReportName;
62
62
  if (summaryReportNames && summaryReportNames.length) {
63
- summaryReportName = summaryReportNames.findLast(reportName => reportName.startsWith(selector));
64
- }
65
- else {
66
- summaryReportName = summaryReportNames.pop();
67
- }
68
- if (summaryReportName) {
69
- const summaryReportJSON = await fs.readFile(`${summaryDir}/${summaryReportName}`, 'utf8');
70
- const summaryReport = JSON.parse(summaryReportJSON);
71
- return summaryReport;
63
+ if (selector) {
64
+ summaryReportName = summaryReportNames
65
+ .findLast(reportName => reportName.startsWith(selector));
66
+ }
67
+ else {
68
+ summaryReportName = summaryReportNames.pop();
69
+ }
70
+ if (summaryReportName) {
71
+ const summaryReportJSON = await fs.readFile(`${summaryDir}/${summaryReportName}`, 'utf8');
72
+ const summaryReport = JSON.parse(summaryReportJSON);
73
+ return summaryReport;
74
+ }
75
+ else {
76
+ throw new Error('ERROR: Requested summary report not found');
77
+ }
72
78
  }
73
79
  else {
74
- throw new Error(`ERROR: No summary report name starts with ${selector}`);
80
+ throw new Error('ERROR: No summary reports exist');
75
81
  }
76
82
  };
77
83
  // Converts a target list to a batch.
@@ -518,7 +524,7 @@ else if (fn === 'compare' && fnArgs.length === 3) {
518
524
  console.log('Execution completed');
519
525
  });
520
526
  }
521
- else if (fn === 'track' && fnArgs.length > 2 && fnArgs.length < 6) {
527
+ else if (fn === 'track' && fnArgs.length > 1 && fnArgs.length < 5) {
522
528
  callTrack(... fnArgs)
523
529
  .then(() => {
524
530
  console.log('Execution completed');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "testilo",
3
- "version": "33.0.2",
3
+ "version": "33.1.0",
4
4
  "description": "Prepares and processes Testaro reports",
5
5
  "main": "call.js",
6
6
  "scripts": {
@@ -46,16 +46,17 @@
46
46
  Plot.lineY(graphData, {
47
47
  x: 'time',
48
48
  y: 'score',
49
- stroke: 'target'
49
+ stroke: 'target',
50
+ marker: 'circle-stroke'
50
51
  }),
51
- Plot.text(graphData, Plot.selectLast({
52
+ Plot.text(graphData, {
52
53
  x: 'time',
53
54
  y: 'score',
54
55
  z: 'target',
55
56
  text: 'target',
56
57
  textAnchor: 'start',
57
58
  dx: 3
58
- }))
59
+ })
59
60
  ]
60
61
  });
61
62
  document.getElementById('graph').insertAdjacentElement('beforeend', svg);
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 quit.
34
- console.log(`ERROR: Report includes only tools ${Array.from(reportToolIDs).join(', ')}`);
35
- return;
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 quit.
98
- console.log('ERROR: Neither tools nor issues are restricted');
99
- return;
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
  }