fix(core.gbapp): End of dialog is now OK.

This commit is contained in:
Rodrigo Rodriguez 2020-11-09 21:28:14 -03:00
parent 743987ef2b
commit 8e668c28cd
2 changed files with 13 additions and 15 deletions

View file

@ -123,10 +123,10 @@ class SysClass {
.get(); .get();
let document = res.value.filter(m => { let document = res.value.filter(m => {
return m.name === file; return m.name.toLowerCase() === file.toLowerCase();
}); });
if (document === undefined) { if (!document || document.length === 0) {
throw `File '${file}' specified on save GBasic command SET not found. Check the .gbdata or the .gbdialog associated.`; throw `File '${file}' specified on save GBasic command SET not found. Check the .gbdata or the .gbdialog associated.`;
} }
@ -165,7 +165,7 @@ class SysClass {
.get(); .get();
let document = res.value.filter(m => { let document = res.value.filter(m => {
return m.name === file; return m.name.toLowerCase() === file.toLowerCase();
}); });
await client await client
@ -174,7 +174,7 @@ class SysClass {
) )
.post({}); .post({});
if (document === undefined) { if (!document || document.length === 0) {
throw `File '${file}' specified on save GBasic command SAVE not found. Check the .gbdata or the .gbdialog associated.`; throw `File '${file}' specified on save GBasic command SAVE not found. Check the .gbdata or the .gbdialog associated.`;
} }
if (args.length > 27) { if (args.length > 27) {
@ -219,7 +219,7 @@ class SysClass {
// Performs validation. // Performs validation.
let document = res.value.filter(m => { let document = res.value.filter(m => {
return m.name === file; return m.name.toLowerCase() === file.toLowerCase();
}); });
if (!document || document.length === 0) { if (!document || document.length === 0) {
@ -237,7 +237,6 @@ class SysClass {
let val = results.text[0][0]; let val = results.text[0][0];
GBLog.info(`BASIC: Getting '${file}' (GET). Value= ${val}.`); GBLog.info(`BASIC: Getting '${file}' (GET). Value= ${val}.`);
return val; return val;
} catch (error) { } catch (error) {
GBLog.error(error); GBLog.error(error);
} }
@ -264,10 +263,10 @@ class SysClass {
// Performs validation. // Performs validation.
let document = res.value.filter(m => { let document = res.value.filter(m => {
return m.name === file; return m.name.toLowerCase() === file.toLowerCase();
}); });
if (document === undefined) { if (!document || document.length === 0) {
throw `File '${file}' specified on save GBasic command FIND not found. Check the .gbdata or the .gbdialog associated.`; throw `File '${file}' specified on save GBasic command FIND not found. Check the .gbdata or the .gbdialog associated.`;
} }
if (args.length > 1) { if (args.length > 1) {
@ -336,10 +335,10 @@ class SysClass {
// Performs validation. // Performs validation.
let document = res.value.filter(m => { let document = res.value.filter(m => {
return m.name === file; return m.name.toLowerCase() === file.toLowerCase();
}); });
if (document === undefined) { if (!document || document.length === 0) {
throw `File '${file}' specified on save GBasic command FIND not found. Check the .gbdata or the .gbdialog associated.`; throw `File '${file}' specified on save GBasic command FIND not found. Check the .gbdata or the .gbdialog associated.`;
} }
if (args.length > 1) { if (args.length > 1) {
@ -360,7 +359,7 @@ class SysClass {
let columnIndex = 0; let columnIndex = 0;
const header = results.text[0]; const header = results.text[0];
for (; columnIndex < header.length; columnIndex++) { for (; columnIndex < header.length; columnIndex++) {
if (header[columnIndex] === columnName) { if (header[columnIndex].toLowerCase() === columnName.toLowerCase()) {
break; break;
} }
} }
@ -368,7 +367,7 @@ class SysClass {
let array = []; let array = [];
let foundIndex = 0; let foundIndex = 0;
for (; foundIndex < results.text.length; foundIndex++) { for (; foundIndex < results.text.length; foundIndex++) {
if (results.text[foundIndex][columnIndex] === value) { if (results.text[foundIndex][columnIndex].toLowerCase() === value.toLowerCase()) {
let output = {}; let output = {};
const row = results.text[foundIndex]; const row = results.text[foundIndex];
for (let colIndex = 0; colIndex < row.length; colIndex++) { for (let colIndex = 0; colIndex < row.length; colIndex++) {
@ -539,7 +538,6 @@ export class DialogClass {
// TODO: Choose Fuse with country code or consent IP. // TODO: Choose Fuse with country code or consent IP.
} }
public async sendFile(step, filename, caption) { public async sendFile(step, filename, caption) {
if (filename.indexOf('.md') > -1) { if (filename.indexOf('.md') > -1) {
GBLog.info(`BASIC: Sending the contents of ${filename} markdown to mobile.`); GBLog.info(`BASIC: Sending the contents of ${filename} markdown to mobile.`);

View file

@ -391,9 +391,9 @@ export class GBVMService extends GBService {
return await step.replaceDialog('/ask', { isReturning: true }); return await step.replaceDialog('/ask', { isReturning: true });
} }
} else { } else {
GBLog.warn(`BASIC callback dialog called with no map for cbId: ${cbId}`); await step.replaceDialog('/ask', { isReturning: true });
} }
} }
]) ])
); );
} }