Ignore:
Timestamp:
Nov 29, 2013, 1:56:00 AM (12 years ago)
Author:
Alex Dehnert <adehnert@…>
Branches:
master, stable, stage
Children:
429e162
Parents:
8a6faa1
git-author:
Alex Dehnert <adehnert@…> (11/29/13 01:56:00)
git-committer:
Alex Dehnert <adehnert@…> (11/29/13 01:56:00)
Message:

Save some unnecessary queries with select_related

Computing how many people have confirmed still requires O(n) queries, but at
least this gets rid of a few of the things that required O(n) queries.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • asadb/forms/views.py

    r8a6faa1 r0e2426b  
    506506
    507507    check_groups = groups.models.Group.objects.filter(group_status__slug__in=('active', 'suspended', ))
    508     check_groups = check_groups.select_related('group_status__slug')
     508    check_groups = check_groups.select_related('group_status')
    509509    group_updates = forms.models.GroupMembershipUpdate.objects.filter(cycle__slug=slug, )
     510    group_updates = group_updates.select_related('group', 'group__group_status')
    510511    people_confirmations = forms.models.PersonMembershipUpdate.objects.filter(
    511512        deleted__isnull=True,
     
    536537    #print len(list(group_updates))
    537538    for group in missing_groups:
    538         num_confirms = len(people_confirmations.filter(groups=group))
    539         output_issue(group, 'unsubmitted', num_confirms)
     539        #num_confirms = len(people_confirmations.filter(groups=group))
     540        output_issue(group, 'unsubmitted', '')
    540541
    541542    for group_update in group_updates:
Note: See TracChangeset for help on using the changeset viewer.