Exemplo n.º 1
0
def handleMatch(match, matchTitle):
    newMatch = DBEntry()
    newMatch.matchtype = "group"
    newMatch.scheduleid = lastSchedule.id
    newMatch.player1name = getStr(match, "player1")
    newMatch.player2name = getStr(match, "player2")
    newMatch.player1race = getStr(match, "player1race")
    newMatch.player2race = getStr(match, "player2race")
    newMatch.player1flag = "-"
    newMatch.player2flag = "-"
    p1wins, p2wins = handleGame(match)
    newMatch.player1wins = p1wins
    newMatch.player2wins = p2wins
    newMatch.winner = getInt(match, "winner")
    matches.append(newMatch)
Exemplo n.º 2
0
def handleGroupEntry(entry):
    newParticipant = DBEntry()
    for param in entry.params:
        for template in param.value.filter_templates():
            if unicode(template.name) == 'player':
                newParticipant.name = getStr(template, '1')
                newParticipant.flag = getStr(template, 'flag')
                newParticipant.race = getStr(template, 'race')
    newParticipant.place = getInt(entry, 'place')
    newParticipant.matcheswon = getInt(entry, 'win_m')
    newParticipant.matcheslost = getInt(entry, 'lose_m')
    newParticipant.mapswon = getInt(entry, 'win_g')
    newParticipant.mapslost = getInt(entry, 'lose_g')
    newParticipant.result = getStr(entry, 'bg')
    newParticipant.scheduleid = lastSchedule.id
    participants.append(newParticipant)
Exemplo n.º 3
0
def handleHeadsUpMatch(match):
    newMatch = DBEntry()
    newMatch.matchtype = 'bracket'
    newMatch.scheduleid = lastSchedule.id
    newMatch.player1name = getStr(match, 'player1')
    newMatch.player2name = getStr(match, 'player2')
    newMatch.player1race = getStr(match, 'player1race')
    newMatch.player2race = getStr(match, 'player2race')
    newMatch.player1flag = getStr(match, 'player1flag')
    newMatch.player2flag = getStr(match, 'player2flag')
    newMatch.player1wins, newMatch.player2wins = handleGame(match)
    if match.has('winner') and getInt(match, 'winner') > 0:
        newMatch.winner = getInt(match, 'winner')
    else:
        newMatch.winner = None
    matches.append(newMatch)
Exemplo n.º 4
0
def handleBracketEntry(entry, prefix1, prefix2, prefixg, title):
    if entry.has(prefixg + 'details'):
        bracketMatchSummary = entry.get(prefixg + 'details').value.filter_templates(matches=r'BracketMatchSummary')[0]
        handleScheduleEntry(bracketMatchSummary, title, 
                            unicode(entry.get(prefix1[:2]).value).strip() if entry.has(prefix1[:2]) else unicode(entry.name).strip())
        handleGame(bracketMatchSummary)
    newMatch = DBEntry()
    newMatch.matchtype = 'bracket'
    newMatch.scheduleid = lastSchedule.id
    newMatch.player1name = getStr(entry, prefix1)
    newMatch.player2name = getStr(entry, prefix2)
    newMatch.player1race = getStr(entry, prefix1 + 'race')
    newMatch.player2race = getStr(entry, prefix2 + 'race')
    newMatch.player1flag = getStr(entry, prefix1 + 'flag')
    newMatch.player2flag = getStr(entry, prefix2 + 'flag')
    newMatch.player1wins = getStr(entry, prefix1 + 'score')
    newMatch.player2wins = getStr(entry, prefix2 + 'score')
    if entry.has(prefix1 + 'win') and getInt(entry, prefix1 + 'win') > 0:
        newMatch.winner = 1
    elif entry.has(prefix2 + 'win') and getInt(entry, prefix2 + 'win') > 0:
        newMatch.winner = 2
    else:
        newMatch.winner = None
    matches.append(newMatch)