Closed satyamtg closed 4 years ago
@satyamtg ?
Oh. Sorry @rgaudin , I forgot this. For dropdowns, at this point of time, I didn't implement those. However, that's doable for dropdown questions having a single dropdown or group of dropdowns having total sum of all options in all dropdowns <= 5. But wherever dropdowns are present, they're actually multiple dropdowns in a single question and each dropdown has several options as mentioned in https://github.com/openzim/openedx/issues/35#issuecomment-671872999 . What do you suggest?
This refactors the problem answer fetching and uses a proper POST request to the API for getting the answers as follows -
The point to note here is this is almost the same process as what's done in the online version.
It contains the following changes -
update_csrf_token_in_headers()
is introduced in instance_connection.py to update the latest CSRF token before making any request to the instance server. The previous method of setting CSRF token at the start has been dropped.problem.py
is fully refactored as follows -get_answers()
is refactored to get answers using the samePOST
requests as the online versioncheck_problem_type_and_get_options()
is added. It returns whether answers are fetchable for a problem, if yes, also returns whether the problem has single correct answers, and a list of options for answers.check_answer()
is added to do thePOST
request with a combination of answerswrite_answers_and_mark_available()
is added to write the answer content in a JS file in instance_assets directoryrender()
now passes only the required content to jinjaxblocks.js
is fully changed. All previous functions are dropped. A new functionproblem_check_answers()
with the same name has been added to get the selected answer ID and accordingly change HTML content.README.md
is updated to clearly mention the limitation in answer fetchingCHANGELOG.md
is updatedThis fixes the following issues - #85, #35 Also, I wanted to look into #27, but this says that edX doesn't support Adaptive hints. Also couldn't find any adaptive hint MOOC. @dattaz could you clarify on this? I think we may want to drop this if there's no MOOC with this feature.