Ignore:
Timestamp:
Dec 14, 2011, 6:51:55 PM (13 years ago)
Author:
rick
Message:

Fix the filter to get rid of duplicates

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/django_gheat/wlheatmap/filters.py

    r9650 r9778  
    22#
    33# View serving filter values.
    4 
    54from django.core.management import setup_environ
    65from django.http import HttpResponse
     
    1312  result = []
    1413  meetrondje_list_total = list()
     14  all_ssids = set()
    1515  for user in Gebruiker.objects.all().order_by('naam'):
    1616    entry = {'gebruiker' : user.naam}
     
    3333        }
    3434      )
     35
     36    # Hack to gather totals, used for the ``all'' filter
     37    meetrondje_list_total += meetrondje_list
     38    all_ssids |= sum_ssid
     39
    3540    meetrondje_list = [{ 'naam' : 'all', 'datum' : 'any', 'nodes' : ['all'] + sorted(sum_ssid) }] + meetrondje_list
    36     meetrondje_list_total += meetrondje_list
    3741    entry['meetrondje'] = meetrondje_list
    3842    result.append(entry)
     43
     44  # Hack the ``all'' user filter in the results
     45  meetrondje_list_total = [{'naam' : 'all', 'datum' : 'any', 'nodes' : ['all'] + sorted(all_ssids)}] + sorted(meetrondje_list_total, key=lambda x: x['naam'])
    3946  result = [ {'gebruiker' : 'all', 'meetrondje' : meetrondje_list_total} ] + result
    4047
Note: See TracChangeset for help on using the changeset viewer.