Issue #2365709 by djdevin: Move quiz attempt layout to database.
Follow up #2365709:

- Fix broken test cases.
- Move new hook implementation to controller.