Exemplo n.º 1
0
 # }

# Lookup AmName by badge & rotation/block by AmName
# Returns 'Not Found' for AmName if the badge isn't in the directory (there is
# an unusual number of what look like fragmented badge #s in the history)
# and then '', '' for rotation & block if any aren't found. This happens both
# for those badge # frags and for tests / med student badges, etc.
for key in cleanDict:
    cleanDict[key]['AmionName'] = 'Not Found'
    badge = cleanDict[key]['badge']
    for res in badgeDict:
        if badge == badgeDict[res]['badgeCode']:
            cleanDict[key]['AmionName'] = badgeDict[res]['AmionName']
    AmName = cleanDict[key]['AmionName']
    eventDate = cleanDict[key]['date']
    try: tupule = blockLookup(eventDate, AmName, allRes)
    except KeyError: tupule = ('','')
    cleanDict[key]['rotation'] = tupule[1]
    cleanDict[key]['block'] = tupule[0]

for key in cleanDict:
    print cleanDict[key]
# {{'minLate': 46, 'AmionName': 'Shalen-J', 'conf': 'am', 'time':
 # datetime.time(8, 46, 4), 'date': datetime.date(2016, 1, 26), 'rotation':
 # 'PURPLE1', 'badge': '21378800976610', 'block': 8}
# {'minLate': 4, 'AmionName': 'Yang-E', 'conf': 'am', 'time':
 # datetime.time(8, 4, 7), 'date': datetime.date(2016, 1, 25), 'rotation':
 # 'PURPLE1', 'badge': '21378801448437', 'block': 8}
# }

Exemplo n.º 2
0
# Lookup AmName by badge & rotation/block by AmName
# Returns 'Not Found' for AmName if the badge isn't in the directory (there is
# an unusual number of what look like fragmented badge #s in the history)
# and then '', '' for rotation & block if any aren't found. This happens both
# for those badge # frags and for tests / med student badges, etc.
for key in cleanDict:
    cleanDict[key]['AmionName'] = 'Not Found'
    badge = cleanDict[key]['badge']
    for res in badgeDict:
        if badge == badgeDict[res]['badgeCode']:
            cleanDict[key]['AmionName'] = badgeDict[res]['AmionName']
    AmName = cleanDict[key]['AmionName']
    eventDate = cleanDict[key]['date']
    try:
        tupule = blockLookup(eventDate, AmName, allRes)
    except KeyError:
        tupule = ('', '')
    cleanDict[key]['rotation'] = tupule[1]
    cleanDict[key]['block'] = tupule[0]

for key in cleanDict:
    print cleanDict[key]
# {{'minLate': 46, 'AmionName': 'Shalen-J', 'conf': 'am', 'time':
# datetime.time(8, 46, 4), 'date': datetime.date(2016, 1, 26), 'rotation':
# 'PURPLE1', 'badge': '21378800976610', 'block': 8}
# {'minLate': 4, 'AmionName': 'Yang-E', 'conf': 'am', 'time':
# datetime.time(8, 4, 7), 'date': datetime.date(2016, 1, 25), 'rotation':
# 'PURPLE1', 'badge': '21378801448437', 'block': 8}
# }
Exemplo n.º 3
0
        starts = blockStarts1
        stops = blockStops1
    else:
        starts = blockStarts23
        stops = blockStops23

    day1 = DT.datetime.strptime(starts[firstBlock], '%Y-%m-%d')
    firstMon = day1 + DT.timedelta(days=(7-day1.weekday())) - increment
    endDay = DT.datetime.strptime(stops[lastBlock], '%Y-%m-%d')

    for res in allRes:
        if allRes[res]['pgy'] == pgyYr:
            tracker = firstMon
            # tracker = tracker + DT.timedelta(7)
            while (tracker < endDay):
                tupule = blockLookup(tracker, res, allRes)
                # tupule is (blockNum, 'rotation') eg:
                # blockLookup('2016-01-20', 'Sun-V', allRes)
                # returns (8, 'ORANGE3')
                block = tupule[0]
                rotation = tupule[1]
                # These try blocks allow skipping empty cells, eg, partial year
                # super seniors. Prints those output for you to check
                try: cashRot = cashData[rotation]
                except:
                    cashRot = 0
                    # print res, tupule
                    errRes.add(res) # Log error res. Should be super-seniors.
                    # If not, it's a big error somewhere.
                    errRots.add(rotation) # Log the error rotations. Most are
                    # blank garbage from super-seniors, but some will be new