in glam/api/views.py [0:0]
def _get_firefox_counts(channel, os, versions, by_build):
"""
Helper method to gather the `FirefoxCounts` data in a single query.
Returns the data as a Python dict keyed by "{version}-{build_id}" for
quick lookup.
"""
query = FirefoxCounts.objects.filter(
channel=constants.CHANNEL_IDS[channel], os=os, version__in=versions
)
if by_build:
query = query.exclude(build_id="*")
else:
query = query.filter(build_id="*")
query = query.annotate(key=Concat("version", Value("-"), "build_id"))
data = {
row["key"]: row["total_users"] for row in query.values("key", "total_users")
}
return data