I think it would be good to make sure that this filters by both module_state_key and course_id. Do you see any reason not to do that?