MDL-41888 separate out quiz statistics calculations from report code

also code clean up.