Right now PageAssessments immediately writes each assessment to the database as soon as each ((#assessment}} parser function is parsed. This has two disadvantages:
- We have no way of knowing when an assessment has been removed from the page and thus needs to be deleted.
- Each page parse may trigger several separate database inserts. It would be better if we could batch the inserts (and deletions) in a single transaction.
To improve things, we should instead have PageAssessments temporarily store each assessment in the ParserOutput's ExtensionData. Then, once the page parsing is complete, we can retrieve all the data using getExtensionData(), figure out which updates need to be made, and batch the updates into a single transaction (using begin and commit).