webwork_extension

Adds correct ratio to each homework.

< 脚本 webwork_extension 的反馈

评价:一般 - 脚本能用,但还有一些问题

§
发布于:2025-09-18
编辑于:2025-09-18

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 !

发布留言

登录以发布留言。