testilo 33.0.3 → 33.2.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 +2 -1
- package/call.js +17 -11
- package/package.json +1 -1
- package/procs/track/ttp40/index.html +27 -5
- package/procs/track/ttp40/index.js +1 -4
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
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
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(
|
|
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 >
|
|
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
|
@@ -33,7 +33,8 @@
|
|
|
33
33
|
const graphData = [];
|
|
34
34
|
summaryReport.summaries.forEach(result => {
|
|
35
35
|
graphData.push({
|
|
36
|
-
|
|
36
|
+
targetID: result.sources.target.id,
|
|
37
|
+
targetWhat: result.sources.target.what,
|
|
37
38
|
time: new Date(`20${result.endTime}Z`),
|
|
38
39
|
score: result.score
|
|
39
40
|
});
|
|
@@ -46,15 +47,36 @@
|
|
|
46
47
|
Plot.lineY(graphData, {
|
|
47
48
|
x: 'time',
|
|
48
49
|
y: 'score',
|
|
49
|
-
stroke: '
|
|
50
|
+
stroke: 'targetWhat'
|
|
50
51
|
}),
|
|
52
|
+
Plot.dot(graphData, {
|
|
53
|
+
x: 'time',
|
|
54
|
+
y: 'score',
|
|
55
|
+
z: 'targetID',
|
|
56
|
+
r: 9
|
|
57
|
+
}),
|
|
58
|
+
Plot.text(graphData, {
|
|
59
|
+
x: 'time',
|
|
60
|
+
y: 'score',
|
|
61
|
+
z: 'targetID',
|
|
62
|
+
text: 'targetID',
|
|
63
|
+
textAnchor: 'middle'
|
|
64
|
+
}),
|
|
65
|
+
Plot.text(graphData, Plot.selectFirst({
|
|
66
|
+
x: 'time',
|
|
67
|
+
y: 'score',
|
|
68
|
+
z: 'targetID',
|
|
69
|
+
text: 'targetWhat',
|
|
70
|
+
textAnchor: 'start',
|
|
71
|
+
dx: 15
|
|
72
|
+
})),
|
|
51
73
|
Plot.text(graphData, Plot.selectLast({
|
|
52
74
|
x: 'time',
|
|
53
75
|
y: 'score',
|
|
54
|
-
z: '
|
|
55
|
-
text: '
|
|
76
|
+
z: 'targetID',
|
|
77
|
+
text: 'targetWhat',
|
|
56
78
|
textAnchor: 'start',
|
|
57
|
-
dx:
|
|
79
|
+
dx: 15
|
|
58
80
|
}))
|
|
59
81
|
]
|
|
60
82
|
});
|
|
@@ -28,11 +28,8 @@ const populateQuery = async (id, what, summaryReport, query) => {
|
|
|
28
28
|
query.tp = trackerID;
|
|
29
29
|
query.dateISO = getNowDate();
|
|
30
30
|
query.dateSlash = getNowDateSlash();
|
|
31
|
-
// JSON of
|
|
31
|
+
// JSON of summary report.
|
|
32
32
|
const {summaries} = summaryReport;
|
|
33
|
-
summaries.forEach(result => {
|
|
34
|
-
delete result.sources.target.id;
|
|
35
|
-
});
|
|
36
33
|
query.summaryReportJSON = JSON.stringify(summaryReport);
|
|
37
34
|
// For each score:
|
|
38
35
|
const rows = [];
|