Beispiel #1
0
def randomly_rank_players_in(rankset):
    import common

    PlayerRanking.objects.filter(rankset=rankset).delete()  # delete everything
    # TODO: improve this into a bulk insert
    rank = 1
    for player in common.find_players_in_season(rankset.season).order_by("?"):
        PlayerRanking.objects.create(player=player, rankset=rankset, rank=rank)
        rank += 1
Beispiel #2
0
def enforce_schedule_preference(player, season):
    import common
    """
    If they didn't answer the question, they can meet any schedule
    """
    for player in common.find_players_in_season(season):
        if player.schedule_preference_selections.all().count() == 0:
            for option in season.schedule_preference.options.all():
                player.schedule_preference_selections.create(selection=option, season=season, preference=season.schedule_preference)
Beispiel #3
0
def calculate_all_ratings(rankset):
    import common

    total_weight = get_weight_total_for_set(rankset)
    for player in common.find_players_in_season(rankset.season):
        calculate_rating_for_player(player, rankset, total_weight=total_weight)
Beispiel #4
0
def enforce_schedule_preference_for_players(season):
    import common
    for player in common.find_players_in_season(season):
        enforce_schedule_preference(player, season)