Exemplo n.º 1
0
def add_user_to_ndb(user_info,stats):
    games = user_info.get_games()
    total_hours, hours_without_mp, hours = calc_hours(games)
    hours_needed_main, hours_needed_complete, game_objs, mp_main, mp_complete = calc_needed(games,stats)
    price = utils.calc_value(game_objs)
    new_steam_id = SteamIds(visibility=user_info.visibility,steam_id=user_info.get_steam(),
        username=user_info.get_username(),profileurl=user_info.get_profileurl(),avatar=user_info.get_avatar(),
        games=games.keys(),last_updated=datetime.now(),steam_account_worth=price,
        hours_played=total_hours,hours_needed_main=hours_needed_main,
        hours_needed_completion=hours_needed_complete,hours=hours,id=user_info.steam_id,hours_without_mp=hours_without_mp,
        needed_main_nmp=mp_main,needed_complete_nmp=mp_complete)
    new_steam_id.put()
    return new_steam_id
Exemplo n.º 2
0
def _update_user(user, info_to_update, stats):
    if info_to_update.visibility is False:
        user.key.delete()
        return user, 5
    else:
        games = info_to_update.get_games()
        total_hours, hours_without_mp, hours = calc_hours(games)
        hours_needed_main, hours_needed_complete, game_objs, mp_main, mp_complete = calc_needed(info_to_update.get_games(),stats)
        price = utils.calc_value(game_objs)
        user.games = games.keys()
        user.steam_account_worth = price
        user.hours_played = total_hours
        user.hours_needed_main = hours_needed_main
        user.hours_needed_complete = hours_needed_complete
        user.needed_main_nmp=mp_main
        user.needed_complete_nmp=mp_complete
        user.hours = hours
        user.hours_without_mp = hours_without_mp
        user.last_updated = datetime.now()
        user.put()
        return user, 2
Exemplo n.º 3
0
def _update_user(user, info_to_update, stats):
    if info_to_update.visibility is False:
        user.key.delete()
        return user, 5
    else:
        games = info_to_update.get_games()
        total_hours, hours_without_mp, hours = calc_hours(games)
        hours_needed_main, hours_needed_complete, game_objs, mp_main, mp_complete = calc_needed(
            info_to_update.get_games(), stats)
        price = utils.calc_value(game_objs)
        user.games = games.keys()
        user.steam_account_worth = price
        user.hours_played = total_hours
        user.hours_needed_main = hours_needed_main
        user.hours_needed_complete = hours_needed_complete
        user.needed_main_nmp = mp_main
        user.needed_complete_nmp = mp_complete
        user.hours = hours
        user.hours_without_mp = hours_without_mp
        user.last_updated = datetime.now()
        user.put()
        return user, 2
Exemplo n.º 4
0
def add_user_to_ndb(user_info, stats):
    games = user_info.get_games()
    total_hours, hours_without_mp, hours = calc_hours(games)
    hours_needed_main, hours_needed_complete, game_objs, mp_main, mp_complete = calc_needed(
        games, stats)
    price = utils.calc_value(game_objs)
    new_steam_id = SteamIds(visibility=user_info.visibility,
                            steam_id=user_info.get_steam(),
                            username=user_info.get_username(),
                            profileurl=user_info.get_profileurl(),
                            avatar=user_info.get_avatar(),
                            games=games.keys(),
                            last_updated=datetime.now(),
                            steam_account_worth=price,
                            hours_played=total_hours,
                            hours_needed_main=hours_needed_main,
                            hours_needed_completion=hours_needed_complete,
                            hours=hours,
                            id=user_info.steam_id,
                            hours_without_mp=hours_without_mp,
                            needed_main_nmp=mp_main,
                            needed_complete_nmp=mp_complete)
    new_steam_id.put()
    return new_steam_id