webwork_extension

Adds correct ratio to each homework.

< Feedback on webwork_extension

Review: OK - script works, but has bugs

§
Posted: 18-09-2025
Edited: 18-09-2025

Note that newer Webwork versions (at least 2.15, released 2019, compared to 2.9, released 2015), may have the homework names in the grades table on in the "th" element instead of being in a "td". Thus, i had to do the following modifications to the nodes.forEach lambda :

nodes.forEach(function(ele) {
      // seems like they now place the homework name in a <th>
      let name = ele.getElementsByTagName('th');
      let e = ele.getElementsByTagName('td');

      if (name.length == 0) {
        // fallback on old method
        if (e.length > 2) {
          m[e[0].innerText] = [parseScore(e[1].innerText), parseScore(e[2].innerText)];
        }
      } else if (e.length > 2 && name.length > 0) {
        // use new method
        m[name[0].innerText] = [parseScore(e[1].innerText), parseScore(e[2].innerText)];
      }
    });

If wanted, I can provide a patch file. Thank you !

Post reply

Sign in to post a reply.