Renzo/fix instructor analytics

The majority of the changes contained herein were reviewed in #4545, merged into master, then reverted by the most recent RC because of an issue on the instructor dashboard. This PR un-reverts the revert of the original commit and adds a fix for the instructor dashboard issue. I've tested this locally and will have it running in a sandbox tomorrow.

@sarina, could you sign off on this?