From 9c81a2b241c953ff2d5e1dc1a0c5f9a305ad0afc Mon Sep 17 00:00:00 2001 From: Guille Date: Tue, 23 Apr 2024 06:28:03 +0200 Subject: [PATCH] now windows it's selected based on id not in focus --- workflows/retrofit/module/module.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/workflows/retrofit/module/module.js b/workflows/retrofit/module/module.js index 074068d..d700fb4 100644 --- a/workflows/retrofit/module/module.js +++ b/workflows/retrofit/module/module.js @@ -2,6 +2,8 @@ const { dialog, BrowserWindow } = require ("electron"); const dotenv = require('dotenv') const session_start = 'https://nextgenerations-cities.encs.concordia.ca/api/v1.4/session/start' const retrofit_results = 'https://nextgenerations-cities.encs.concordia.ca/api/v1.4/persistence/retrofit-results' +//const session_start = 'http://127.0.0.1:15789/v1.4/session/start' +//const retrofit_results = 'http://127.0.0.1:15789/v1.4/persistence/retrofit-results' exports.run = async (application, buildings, tmp_path) => { @@ -24,6 +26,7 @@ exports.run = async (application, buildings, tmp_path) => { const application_response = await response.json() const session_id = response.headers.get('session_id') let token = response.headers.get('token') + console.log(`token: ${token}`) request = { 'scenarios': [] } application_response.scenarios.forEach((scenario) => { scenario_request = {} @@ -40,7 +43,8 @@ exports.run = async (application, buildings, tmp_path) => { 'accept': 'application/json' }, body: JSON.stringify(request) - }) + }, 600000) + console.log(`response: ${response.status}`) if (response.status == 200) { results = await response.json() @@ -184,7 +188,7 @@ exports.run = async (application, buildings, tmp_path) => { `${operational_co2_header}\n${operational_co2_lines.join('\n')}`, function (err) { console.log(err ? err : 'operational_co2 saved') } ) - BrowserWindow.getFocusedWindow().webContents.send('task-completed', 'meb
costs
operational_co2') + BrowserWindow.fromId(1).webContents.send('task-completed', 'meb
costs
operational_co2') } else { console.log('unautorized retrofit')