webwork_extension

Adds correct ratio to each homework.

< Opinie na webwork_extension

Ocena: OK - skrypt działa, ale ma błędy

§
Napisano: 18-09-2025
Edytowano: 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 !

Odpowiedz

Zaloguj się, by odpowiedzieć.