Difference between revisions of "User:Andr3w"
Jump to navigation
Jump to search
Line 1: | Line 1: | ||
Notes on question type '''qtp''' | ==Notes on question type '''qtp'''== | ||
Set the question type using | Set the question type using | ||
Line 10: | Line 10: | ||
* fetch | * fetch | ||
** intercept '''fetch''' calls, after the promise has been resolved pass document.innerHTML to score.php | ** intercept '''fetch''' calls, after the promise has been resolved pass document.innerHTML to score.php | ||
==Notes on score.php== | |||
Each question creates two iframes one for user input one for model answer. | |||
The containing document cannot see the iframe contents so we use a round-about scoring mechanism: | |||
* Each iframe reports to score.php with the body innerHTML or the canvas content | |||
* score.php responds to the second of the two calls by generating an MQTT message | |||
topic: pzscore/0.08061187738818432 | |||
payload: {"uid":"0.08061187738818432","aid":"1629570082","qid":"Flags_with_Rectangles-1","score":50} | |||
* these messages can be picked up by the parent page, also allows a teacher to monitor a class |
Revision as of 18:23, 21 August 2021
Notes on question type qtp
Set the question type using
<pre id='shellbody' data-qtp='DOM'></pre>
- canvas
- in this case we create a canvas element, call drawFlag with the 2d context, report the bitmap to score.php
- DOM
- in this question type after usr.js has executed pass document.body.innerHTML to score.php
- fetch
- intercept fetch calls, after the promise has been resolved pass document.innerHTML to score.php
Notes on score.php
Each question creates two iframes one for user input one for model answer.
The containing document cannot see the iframe contents so we use a round-about scoring mechanism:
- Each iframe reports to score.php with the body innerHTML or the canvas content
- score.php responds to the second of the two calls by generating an MQTT message
topic: pzscore/0.08061187738818432 payload: {"uid":"0.08061187738818432","aid":"1629570082","qid":"Flags_with_Rectangles-1","score":50}
- these messages can be picked up by the parent page, also allows a teacher to monitor a class