Skip to content

Commit

Permalink
fix(core.gbapp): End of dialog is now OK.
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigorodriguez committed Nov 10, 2020
1 parent 743987e commit 8e668c2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 15 deletions.
24 changes: 11 additions & 13 deletions packages/core.gbapp/services/GBAPIService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,10 @@ class SysClass {
.get();

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.`;
}

Expand Down Expand Up @@ -165,7 +165,7 @@ class SysClass {
.get();

let document = res.value.filter(m => {
return m.name === file;
return m.name.toLowerCase() === file.toLowerCase();
});

await client
Expand All @@ -174,7 +174,7 @@ class SysClass {
)
.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.`;
}
if (args.length > 27) {
Expand Down Expand Up @@ -219,7 +219,7 @@ class SysClass {
// Performs validation.

let document = res.value.filter(m => {
return m.name === file;
return m.name.toLowerCase() === file.toLowerCase();
});

if (!document || document.length === 0) {
Expand All @@ -237,7 +237,6 @@ class SysClass {
let val = results.text[0][0];
GBLog.info(`BASIC: Getting '${file}' (GET). Value= ${val}.`);
return val;

} catch (error) {
GBLog.error(error);
}
Expand All @@ -264,10 +263,10 @@ class SysClass {
// Performs validation.

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.`;
}
if (args.length > 1) {
Expand Down Expand Up @@ -336,10 +335,10 @@ class SysClass {
// Performs validation.

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.`;
}
if (args.length > 1) {
Expand All @@ -360,15 +359,15 @@ class SysClass {
let columnIndex = 0;
const header = results.text[0];
for (; columnIndex < header.length; columnIndex++) {
if (header[columnIndex] === columnName) {
if (header[columnIndex].toLowerCase() === columnName.toLowerCase()) {
break;
}
}

let array = [];
let foundIndex = 0;
for (; foundIndex < results.text.length; foundIndex++) {
if (results.text[foundIndex][columnIndex] === value) {
if (results.text[foundIndex][columnIndex].toLowerCase() === value.toLowerCase()) {
let output = {};
const row = results.text[foundIndex];
for (let colIndex = 0; colIndex < row.length; colIndex++) {
Expand Down Expand Up @@ -539,7 +538,6 @@ export class DialogClass {
// TODO: Choose Fuse with country code or consent IP.
}


public async sendFile(step, filename, caption) {
if (filename.indexOf('.md') > -1) {
GBLog.info(`BASIC: Sending the contents of ${filename} markdown to mobile.`);
Expand Down
4 changes: 2 additions & 2 deletions packages/core.gbapp/services/GBVMService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -391,9 +391,9 @@ export class GBVMService extends GBService {
return await step.replaceDialog('/ask', { isReturning: true });
}
} else {
GBLog.warn(`BASIC callback dialog called with no map for cbId: ${cbId}`);
await step.replaceDialog('/ask', { isReturning: true });
}
}
}
])
);
}
Expand Down

0 comments on commit 8e668c2

Please sign in to comment.