@ejfdelgado/ejflab-common 1.9.1 → 1.10.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/package.json
CHANGED
|
@@ -18,8 +18,18 @@ class CommandTimelineNext extends CommandBasic {
|
|
|
18
18
|
}
|
|
19
19
|
// Compute advance percentage
|
|
20
20
|
const percentage = (timeline.t - timeline.start) / (timeline.end - timeline.start);
|
|
21
|
-
SimpleObj.recreate(this.context.data,
|
|
22
|
-
|
|
21
|
+
SimpleObj.recreate(this.context.data, `scope.progress.${timeLineId}`, Math.ceil(percentage * 100));
|
|
22
|
+
// Compute the overall advance
|
|
23
|
+
const allProgress = SimpleObj.getValue(this.context.data, `scope.progress`, {});
|
|
24
|
+
const keysProgress = Object.keys(allProgress);
|
|
25
|
+
let sum = 0;
|
|
26
|
+
for (let i = 0; i < keysProgress.length; i++) {
|
|
27
|
+
const oneKey = keysProgress[i];
|
|
28
|
+
const progress = allProgress[oneKey];
|
|
29
|
+
sum += progress;
|
|
30
|
+
}
|
|
31
|
+
const average = sum / keysProgress.length;
|
|
32
|
+
SimpleObj.recreate(this.context.data, `scope.progressAvg`, Math.ceil(average));
|
|
23
33
|
}
|
|
24
34
|
}
|
|
25
35
|
|