Skip to content

Commit

Permalink
Parameters is a string on SdmGoalMessage
Browse files Browse the repository at this point in the history
  • Loading branch information
cdupuis committed Feb 12, 2020
1 parent 1eac2e8 commit 969bc8f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/handlers/events/delivery/goals/SetGoalsOnSkillOutput.ts
Expand Up @@ -138,9 +138,13 @@ export class SetGoalsOnSkillOutput implements HandleEvent<OnAnySkillOutput.Subsc
function addSkillOutputAsInputEnrichGoal(skillOutput: SkillOutput,
delegate: EnrichGoal = async g => g): EnrichGoal {
return async (goal, pli) => {
const input: Array<{ classifier: string }> = (goal.parameters || {})[CacheInputGoalDataKey] || [];
const parameters = !!goal.parameters ? JSON.parse(goal.parameters) : {};

const input: Array<{ classifier: string }> = parameters[CacheInputGoalDataKey] || [];
input.push({ classifier: skillOutput.classifier });
goal.parameters[CacheInputGoalDataKey] = input;

parameters[CacheInputGoalDataKey] = input;
goal.parameters = JSON.stringify(parameters);
return delegate(goal, pli);
}
}

0 comments on commit 969bc8f

Please sign in to comment.