Commit 45db5641 authored by Léo-Paul Géneau's avatar Léo-Paul Géneau 👾

erp5_officejs_drone_capture_flag: add simulation duration

Display simulation duration as it is a performance criterion required for scripts post analysis.
parent 0236f68b
......@@ -801,6 +801,8 @@ var GameManager = /** @class */ (function () {
.push(function () {
return {
'message': gadget._result_message,
'score': gadget._result_score,
'duration': gadget._simulation_duration,
'content': gadget._flight_log,
'console_log': console_log
};
......@@ -1135,7 +1137,8 @@ var GameManager = /** @class */ (function () {
GameManager.prototype._finish = function () {
console.log("Simulation finished");
this._result_message += " User score: " + this._calculateUserScore();
this._result_score = this._calculateUserScore();
this._simulation_duration = Math.round(this._game_duration) / 1000;
this._canUpdate = false;
return this.finish_deferred.resolve();
};
......
......@@ -246,7 +246,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>1020.30714.54302.56558</string> </value>
<value> <string>1020.55118.1496.6587</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -266,7 +266,7 @@
</tuple>
<state>
<tuple>
<float>1730822107.38</float>
<float>1732286429.36</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -851,11 +851,23 @@ var OperatorAPI = /** @class */ (function () {
.push(function (result) {
var a, blob, div, key, log, log_content, label;
i = 0;
div = domsugar('div', { text: result.message });
div = domsugar('div', { id: 'result_div' });
label = domsugar('label', { text: "Results" });
label.classList.add("item-label");
document.querySelector('.container').parentNode.appendChild(label);
document.querySelector('.container').parentNode.appendChild(div);
document.querySelector('#result_div').parentNode.appendChild(
domsugar('p', { text: result.message, id: 'result_message' })
);
document.querySelector('#result_div').parentNode.appendChild(
domsugar('p', { text: "User score: " + result.score, id: 'result_score' })
);
document.querySelector('#result_div').parentNode.appendChild(
domsugar('p', {
text: "Simulation duration: " + result.duration + " seconds",
id: 'simulation_duration'
})
);
for (key in result.content) {
if (result.content.hasOwnProperty(key)) {
log_content = result.content[key].join('\n').replaceAll(",", ";");
......
......@@ -246,7 +246,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>1020.51982.55228.2918</string> </value>
<value> <string>1020.55119.22877.43810</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -266,7 +266,7 @@
</tuple>
<state>
<tuple>
<float>1732098322.73</float>
<float>1732286476.76</float>
<string>UTC</string>
</tuple>
</state>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment