MDL-39536 completion: Prevent DB call when fetching activities
MDL-39536 completion: Unit tests for get_activities and has_activities