fix: explantion data parse (#260)

This commit is contained in:
connorhaugh
2023-03-02 09:20:37 -05:00
committed by GitHub
parent 4a24d25f22
commit 7a8a182d5a
3 changed files with 23 additions and 19 deletions

View File

@@ -330,10 +330,12 @@ export class OLXParser {
return { text, children };
}
getSolutionExplanation() {
if (!_.has(this.problem, 'solution')) { return null; }
getSolutionExplanation(problemType) {
if (!_.has(this.problem, `${problemType}.solution`)) { return null; }
const stack = [this.problem.solution];
const solution = _.get(this.problem, `${problemType}.solution`);
const stack = [solution];
const texts = [];
let currentNode;
@@ -401,7 +403,7 @@ export class OLXParser {
const problemType = this.getProblemType();
const hints = this.getHints();
const question = this.parseQuestions(problemType);
const solutionExplanation = this.getSolutionExplanation();
const solutionExplanation = this.getSolutionExplanation(problemType);
switch (problemType) {
case ProblemTypeKeys.DROPDOWN: