Skip to content

Commit 10a64d0

Browse files
fix: Proper evaluation function response and answer parsing and passing
Co-authored-by: Manav Sankriti <[email protected]>
1 parent 8664bae commit 10a64d0

File tree

2 files changed

+4
-11
lines changed

2 files changed

+4
-11
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@lambda-feedback-segp-sandbox/sandbox-addon",
3-
"version": "0.6.14",
3+
"version": "0.6.15",
44
"description": "lambda feedback sandbox addon",
55
"keywords": [
66
"storybook-addons",

src/components/Evaluate.tsx

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,24 +31,17 @@ export function Evaluate() {
3131
const studentInput = sessionStorage.getItem("student.input");
3232

3333
// Safely parse the wizard input if it exists, otherwise use a fallback value
34-
let answer: { defaultAnswer: string } = { defaultAnswer: '' }; // Default value for answer
34+
let answer: string | object = ""; // Default value for answer
3535

3636
try {
3737
const wizardInput = sessionStorage.getItem("wizard.input");
3838

3939
// Safely parse the wizard input if it exists, otherwise use a fallback value
40-
if (wizardInput) {
41-
const parsedWizardInput = JSON.parse(wizardInput);
42-
43-
// Ensure that parsedWizardInput.answer is a string or use fallback
44-
answer = parsedWizardInput?.answer ?
45-
{ defaultAnswer: String(parsedWizardInput.answer) } :
46-
{ defaultAnswer: '' }; // Fallback value if wizard.input is malformed
47-
}
40+
answer = wizardInput ? JSON.parse(wizardInput).answer : "";
4841
} catch (error) {}
4942

5043
// Safely parse the student input if it exists, otherwise use a fallback value
51-
const response = studentInput ? parseStoredString(studentInput) : { defaultResponse: '' }; // Fallback value if student.input is null
44+
const response = studentInput ? parseStoredString(studentInput) : ""; // Fallback value if student.input is null
5245

5346
console.log("remote eval");
5447
console.log("url", url);

0 commit comments

Comments
 (0)