Skip to content

Commit

Permalink
fix(core.gbapp): Investigating BASIC broken.
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigorodriguez committed May 16, 2019
1 parent 4351b87 commit f0ec25e
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 8 deletions.
2 changes: 2 additions & 0 deletions packages/core.gbapp/services/GBMinService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,8 @@ export class GBMinService {
min.sandBoxMap[mainMethod].step = step;
min.sandBoxMap[mainMethod][mainMethod].bind(min.sandBoxMap[mainMethod]);
await min.sandBoxMap[mainMethod][mainMethod]();
} else if (context.activity.text === 'Aprovar') {
await step.beginDialog('/oppt');
} else if (context.activity.text === 'admin') {
await step.beginDialog('/admin');

Expand Down
9 changes: 1 addition & 8 deletions packages/core.gbapp/services/GBVMService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -259,15 +259,8 @@ export class GBVMService extends GBService {
async step => {
const cbId = step.activeDialog.state.cbId;
const cb = min.cbMap[cbId];
step.activeDialog.state.cb = cb;

return await step.next();
},
async step => {
let cb = step.activeDialog.state.cb;
cb.bind({ step: step, context: step.context });
cb(step.result);

await cb(step.result);
return await step.next();
}
])
Expand Down
22 changes: 22 additions & 0 deletions packages/kb.gbapp/dialogs/AskDialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ export class AskDialog extends IGBDialog {
min.dialogs.add(new WaterfallDialog('/answerEvent', AskDialog.getAnswerEventDialog(service, min)));
min.dialogs.add(new WaterfallDialog('/answer', AskDialog.getAnswerDialog(min, service)));
min.dialogs.add(new WaterfallDialog('/ask', AskDialog.getAskDialog(min)));
min.dialogs.add(new WaterfallDialog('/oppt', AskDialog.getOPPT(min)));


}

private static getAskDialog(min: GBMinInstance) {
Expand Down Expand Up @@ -194,4 +197,23 @@ export class AskDialog extends IGBDialog {
}
];
}


private static getOPPT(min: GBMinInstance) {
return [
async step => {
await step.context.sendActivity(`Os lançamentos pendentes de aprovação são:" ** \n` +
`01: 12/04 Compra de Impressora - R$ 490,05 \n` +
`02: 15/04 Almoço - R$ 49,00 \n` +
`03: 19/04 Transporte aéreo - R$ 793,10 \n` +
`04: 22/04 Despesa de hospedagem - R$ 690,40 \n` +
`05: 02/05 Despesa de correios AR - R$ 395,00 \n`);
return await step.prompt('textPrompt', '** Informe qual deseja aprovar ou T para aprovar todos" ** ');
}
, async step => {
await step.context.sendActivity('Pronto! Lançamento aprovado. Até a próxima!')
return await step.next();
}
];
}
}

0 comments on commit f0ec25e

Please sign in to comment.