Skip to content

Commit

Permalink
added functionality for merging names
Browse files Browse the repository at this point in the history
  • Loading branch information
bbirman committed Jun 28, 2012
1 parent b137949 commit 6d52cd7
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@


peopleCounts = {}
names = []
weekTotals = [0]*54
drawType = "percentages"
drawType = "rawLines"

def nameLabel(currentTag):
toTruncate = currentTag.index("current")
Expand Down Expand Up @@ -75,7 +76,19 @@ def parseDate(dateString):
date = datetime.date(int(year), monthNum, int(day))
dateTuple = date.isocalendar()
return dateTuple

def mergeNames(keepName, mergeNames):
for mergeName in mergeNames:
for i in range(54):
peopleCounts[keepName][i] += peopleCounts[mergeName][i]
del peopleCounts[mergeName]
names.remove(mergeName)


def mergeTheseNames():
mergeName("Example name", ["Example name duplicate"])


def drawValue(name, week):
if drawType == "rawLines":
return .25*peopleCounts[name][week]
Expand All @@ -90,7 +103,7 @@ def main():
raw_emails = pickle.load(FILE)
FILE.close()

names = []

#weekTotals = [0]*54
for raw_email in raw_emails:
email_message = email.message_from_bytes(raw_email)
Expand All @@ -116,7 +129,7 @@ def main():
peopleCounts[name][weekBucket] += lines
weekTotals[weekBucket] += lines


mergeTheseNames()

#for name in names:
# print("--" + name + "--")
Expand Down

0 comments on commit 6d52cd7

Please sign in to comment.