Use a set instead of list when gathering package IDs to fetch

If we have duplicates in this list, it makes no sense to include them in
the list we send to the database.

Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
Dan McGee 2012-07-08 20:51:23 -05:00
parent ca86b8d339
commit b95b0cd419

View File

@ -123,7 +123,7 @@ def get_differences_info(arch_a, arch_b):
cursor.execute(sql, [arch_a.id, arch_b.id])
results = cursor.fetchall()
# column A will always have a value, column B might be NULL
to_fetch = [row[0] for row in results]
to_fetch = set(row[0] for row in results)
# fetch all of the necessary packages
pkgs = Package.objects.normal().in_bulk(to_fetch)
# now build a list of tuples containing differences