Make ATC lists sort E-mails with preferred first

* tools/atc/email-stats.py: Adjust the order in which Gerrit E-mail
addresses are returned so that the one listed as the preferred
address is sorted to the beginning of the set.

Change-Id: I95b5817ada58f4059df4f5c0b406183f1c1e5b74
This commit is contained in:
Jeremy Stanley 2014-06-24 20:37:40 +00:00
parent 876ba7a23b
commit 69e247d873

View File

@ -49,6 +49,15 @@ def get_account(accounts, num):
def main():
accounts = {}
for row in csv.reader(open('accounts.csv')):
num = int(row[-1])
name = row[1]
email = row[2]
a = get_account(accounts, num)
a.full_name = name
if email and email != '\\N':
a.emails.append(email)
for row in csv.reader(open('emails.csv')):
num, email, pw, external = row
num = int(num)
@ -67,12 +76,6 @@ def main():
raise Exception("Already a username")
a.username = m.group(1)
for row in csv.reader(open('accounts.csv')):
num = int(row[-1])
name = row[1]
a = get_account(accounts, num)
a.full_name = name
username_accounts = {}
for a in accounts.values():
username_accounts[a.username] = a