bots: Remove unnecessary select_related on Service objects.

Given how we're using these, there's no need for the full UserProfile
object to be fetched from the server.
This commit is contained in:
Tim Abbott 2018-05-04 13:38:28 -07:00
parent 186152bfc0
commit 6cc2e8bbff
1 changed files with 1 additions and 1 deletions

View File

@ -4716,7 +4716,7 @@ def get_service_dicts_for_bot(user_profile_id: str) -> List[Dict[str, Any]]:
return service_dicts
def get_services_for_bots(bot_profile_ids: List[int]) -> Dict[int, List[Service]]:
services = Service.objects.filter(user_profile_id__in=bot_profile_ids).select_related()
services = Service.objects.filter(user_profile_id__in=bot_profile_ids)
services_by_uid = defaultdict(list) # type: Dict[int, List[Service]]
for service in services:
services_by_uid[service.user_profile.id].append(service)