Skip to content
This repository has been archived by the owner on Jun 7, 2023. It is now read-only.

Add restoring local student answer for hparsons directive #1386

Merged
merged 3 commits into from
Feb 17, 2023

Conversation

amy21206
Copy link
Contributor

Implemented checkLocalStorage(), setLocalStorage(), and restoreAnswers() for hparsons directive.

Server implementation might be needed for restoring server-side answers. Documentation included in restoreAnswers().

@bnmnetp bnmnetp merged commit cb879da into RunestoneInteractive:master Feb 17, 2023
@bnmnetp
Copy link
Member

bnmnetp commented Feb 23, 2023

Working with localStorage but not with data from the server.

Here is the object that the server returns, but

serverData
{id: 5, timestamp: '2023-02-23T01:55:22.625929', div_id: 'test_hparsons_block_1', sid: 'testuser1', correct: true, …}
answer: blocks: (4) ['SELECT', '*', 'FROM', 'test']
[[Prototype]]: Object
correct: true
course_name: "overview"
div_id: "test_hparsons_block_1"
id: 5
percent: 1
sid: "testuser1"
timestamp: "2023-02-23T01:55:22.625929"

Also, there is no reason to log the fact that we restored the answer. None of the other components log that action.

@bnmnetp
Copy link
Member

bnmnetp commented Feb 23, 2023

@amy21206 I changed my code so that it now calls

this.hparsonsInput.restoreAnswer(serverData.answer.blocks);

But I'm still not getting a restore to work with server data.

Its hard to debug because I only have the minified version of the microparsons. How do you have your development environment set up so that you can make changes to microparsons and then incorporate them into runestone without doing a release and npm update on the runestone side?

@bnmnetp
Copy link
Member

bnmnetp commented Feb 23, 2023

OK, I figured out a workflow....

I changed the imports in hparsons and copied everything from bin/ to the hparsons/js folder.

Now I am able to step through everything with the debugger. And it appears that it is working....

I also re-updated the micro-parsons package with npm and with my small change it now appears to work either way.... So I don't think you need to do anything at the moment, but I would suggest eliminating the log message about restoring.

@amy21206
Copy link
Contributor Author

Sorry I just saw the message! I just changed my settings for github email notification so I can get the messages in time in the future. I will remove the log message about restoring, and let me know if there's anything else!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants