openzim / openedx

Open edX (to zim) scraper
GNU General Public License v3.0
8 stars 7 forks source link

Fix answer fetching #109

Closed satyamtg closed 4 years ago

satyamtg commented 4 years ago

This refactors the problem answer fetching and uses a proper POST request to the API for getting the answers as follows -

  1. generate all combinations of possible answers
  2. for every candidate answer, do the POST request to get the HTML content that which is to be put (this contains all messages, and classes for styling)
  3. Store the content in a JS file for each problem as follows -
    problem_answers[problem_id] = {<answer_id>: <html_content>, ... , <answer_id>: <html_content>}
  4. Use this problem_answers object to replace the content of the HTML according to the IDs of selected answers.

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 -

This 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.

rgaudin commented 4 years ago

@satyamtg ?

satyamtg commented 4 years ago

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?