-
-
Notifications
You must be signed in to change notification settings - Fork 223
Added server storage functionality to assess questions #122
Conversation
…hen using Runestone Services
Getting latest updates from master
|
One thing that I don't see, but that we need to add takes into consideration the following scenario.
|
Getting latest updates from master
runestone/assess/js/mchoice.js
Outdated
| var answers = arr[0].split(","); | ||
| MultipleChoice.prototype.repopulateFromStorage = function (data, status, whatever) { | ||
| if (data !== "") { | ||
| var dataEval = JSON.parse(data); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is strange, because in my setup data is already pre-parsed when it comes from a jquery request. data has a timestamp an answer and a correct attribute. Trying to JSON.parse it causes an error.
|
That's interesting. I'll take a look at it later tonight/tomorrow when I'm in a place with wifi (I'm on my phone). I know that I changed the way that data is passed into the database, so I can see that if your data follows the old format, it wouldn't work. I didn't think about this backwards compatibility problem. |
|
Its probably safest to have the select statement select the columns explicitly and in the order you need them rather than using |
|
I made the changes to how querying is done (commit added to the server repo). I'm having trouble understanding how/why your data is pre-parsed after a JSON request. Would you be able to send me some details about your test environment? I'm also unsure about how answer is "T" and correct is "c"--it seems pretty clear in ajax.py (in the server repo) that it "answer" should correspond to the database "answer." I did just change how querying is done, though, to make it safer as you said, so if that was messing up the order, it might be fixed now. Let me know if it's still an issue. |
|
The changes to the queries look great. I'm using version 2.5.1 of web2py, and the jquery.min version that is part of runestone 1.7.2 I'm curious what version of web2py you are testing with. I think it may be more web2py related... If an ajax response sets the header so that the content type is correctly specified as application/json then the data passed to the success function is pre-parsed. I ran into this with Paul R. as well when we were working on another feature. I think the best thing to do is to use jquery.getJSON and remove the call to JSON.parse. |
|
I'll make those changes to the files and get them in a commit--I'm using version 2.14.6 of web2py. I'm unable to find a different version, as the source code and github repo pointed to by their website https://github.com/web2py/web2py is currently version 2.14.6. How did you get version 2.5.1? |
Multiple choice, FITB, drag-n-drop, clickable area, and timed exams now all check the server first to load from, then if the server doesn't return anything, they proceed to load from local storage as they always have.