Commit 715a2c20 authored by Roque's avatar Roque

erp5_officejs_drone_simulator: changes to make "test drone flight" work

See merge request nexedi/erp5!1804
parents 4174385c 93ddab76
Pipeline #29235 failed with stage
in 0 seconds
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
unparam: true */ unparam: true */
var GAMEPARAMETERS = {}; var GAMEPARAMETERS = {};
//for DEBUG/TEST mode
var baseLogFunction = console.log, console_log = "";
/******************************* DRONE MANAGER ********************************/ /******************************* DRONE MANAGER ********************************/
var DroneManager = /** @class */ (function () { var DroneManager = /** @class */ (function () {
...@@ -549,6 +551,15 @@ var GameManager = /** @class */ (function () { ...@@ -549,6 +551,15 @@ var GameManager = /** @class */ (function () {
FixedWingDroneAPI: FixedWingDroneAPI, FixedWingDroneAPI: FixedWingDroneAPI,
DroneLogAPI: DroneLogAPI DroneLogAPI: DroneLogAPI
}; };
if (this._game_parameters_json.debug_test_mode) {
console.log = function () {
baseLogFunction.apply(console, arguments);
var args = Array.prototype.slice.call(arguments);
for (var i = 0;i < args.length;i++) {
console_log += args[i] + "\n";
}
};
}
} }
Object.defineProperty(GameManager.prototype, "gameParameter", { Object.defineProperty(GameManager.prototype, "gameParameter", {
...@@ -563,7 +574,11 @@ var GameManager = /** @class */ (function () { ...@@ -563,7 +574,11 @@ var GameManager = /** @class */ (function () {
var gadget = this; var gadget = this;
return gadget._init() return gadget._init()
.push(function () { .push(function () {
return gadget._flight_log; return {
'message': gadget._result_message,
'content': gadget._flight_log,
'console_log': console_log
};
}); });
}; };
......
...@@ -240,7 +240,7 @@ ...@@ -240,7 +240,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>1009.36979.45339.6075</string> </value> <value> <string>1010.3592.54606.53538</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -260,7 +260,7 @@ ...@@ -260,7 +260,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1688635184.98</float> <float>1690478004.4</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -555,9 +555,9 @@ ...@@ -555,9 +555,9 @@
.push(function (result) { .push(function (result) {
var a, blob, div, key, log, log_content; var a, blob, div, key, log, log_content;
i = 0; i = 0;
for (key in result) { for (key in result.content) {
if (result.hasOwnProperty(key)) { if (result.content.hasOwnProperty(key)) {
log_content = result[key].join('\n').replaceAll(",", ";"); log_content = result.content[key].join('\n').replaceAll(",", ";");
blob = new Blob([log_content], {type: 'text/plain'}); blob = new Blob([log_content], {type: 'text/plain'});
a = domsugar('a', { a = domsugar('a', {
text: 'Download Simulation LOG ' + i, text: 'Download Simulation LOG ' + i,
......
...@@ -246,7 +246,7 @@ ...@@ -246,7 +246,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>1009.22574.47206.13909</string> </value> <value> <string>1009.59163.16294.47701</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -266,7 +266,7 @@ ...@@ -266,7 +266,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1687785962.67</float> <float>1690477710.21</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </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