We mentioned in a previous post that we are doing initial testing on our code to integrate the Moodle gradebook with some elements of a clone installation of Khan Academy (KA). We are specifically tracking exercise proficiency and percentage watched of videos on a per user basis. Moodle already has great support for adding new items to the gradebook using its gradebook API and we just needed to figure out how to properly get the information from the KA clone.
The approach I used was to create a REST api handler on the KA clone so that moodle can request a list of user exercises that are already marked for the user as being proficient in. I also added a call to request a list of a user's viewed videos and how much time was spent viewing them in relation to the video's total length in time. From the data Moodle gathers using these APIs, it can do grade computations on the moodle side and insert them properly into the gradebook. Using this method also allows for future expansion by just adding to the calls the REST api supports.
With regards to the moodle side, I created plugins that hold KA video and exercise data and use these to map each entry to a gradebook item. Because the system can't guarantee that teachers have already created a map to an exercise or a video before a student actually encounters them in KA, it needs to insert all the data it fetches into a queue. This makes it possible to store all seen data and not lose them even if it's not used now and allows for revisiting them in the future when a mapping is created. I then hooked the logic to Moodle's cron system so that it calls the KA api and enqueues the relevant data. This cron function will also updates the grades as necessary by traversing the elements in the queue. The cron function stores data relating to the dates of the fetched items so that it knows to use that as a limiting parameter and it won't get too expensive on the KA side.
Since our KA clone already stores consumer secrets and keys to authenticate using moodle servers, it makes it easy to use the same credentials and perform a tokenless OAuth exchange in calling the APIs. KA already has OAuth-based APIs but I opted not to use that since moodle needs to fetch the data in an secure, unattended way and we don't want to expose it as a public API because our KA clone allows for connections coming from different moodle instances.
We have been working to integrate a clone of Khan Academy, which is an open source code base, with Moodle, an open source Learning Management System. Our vision is to help teachers use the vast resources of Khan Academy's exercsies and videos in a way that is integrated with current curriculum and other educational resources from around the web.
The $.ajax method may be the most documented, but most tricky part of jQuery. The documentation will leave out tiny details you might not know.
Here is today's example.
html": Returns HTML as plain text; included script tags are evaluated when inserted in the DOM.
This says the ajax response is HTML as plain text. This is not clear. Does it mean the return mime-type should be "text/plain"? It is never specified. It also makes a refererce to included script tags being evaluated when inserted to the DOM. It does not mention that you need to do that yourself.
Subscribe to notificaitons