当前位置: 首页>>代码示例>>Python>>正文


Python DataModel.getTeamScore方法代码示例

本文整理汇总了Python中DataModel.getTeamScore方法的典型用法代码示例。如果您正苦于以下问题:Python DataModel.getTeamScore方法的具体用法?Python DataModel.getTeamScore怎么用?Python DataModel.getTeamScore使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DataModel的用法示例。


在下文中一共展示了DataModel.getTeamScore方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_team_score_json

# 需要导入模块: import DataModel [as 别名]
# 或者: from DataModel import getTeamScore [as 别名]
def get_team_score_json(global_config, name, comp, store_json_file=False):
        
    global_config['logger'].debug( 'GET Team %s Score For Competition %s', name, comp )
    
    season = WebCommonUtils.map_comp_to_season(comp)
    session = DbSession.open_db_session(global_config['db_name'] + season)
    
    result = []
    result.append('{ "competition" : "%s", "team" : "%s", ' % (comp,name))
    team_scores = DataModel.getTeamScore(session, name, comp)
    if len(team_scores)==1:
        result.append('"score": "%s" }' % team_scores[0].score)
    else:
        result.append('  "score": [')
        for score in team_scores:
            result.append(score.json())
            result.append(',\n')
        if len(team_scores) > 0:
            result = result[:-1]
        result.append(']}')
        
    json_str = ''.join(result)
    
    if store_json_file is True:
        try:
            FileSync.put( global_config, '%s/EventData/TeamData/team%s_scouting_score.json' % (comp,name), 'text', json_str)
        except:
            raise
        
    session.remove()
    return json_str
开发者ID:FRCTeam1073-TheForceTeam,项目名称:ScoutingAppCentral,代码行数:33,代码来源:WebTeamData.py

示例2: get_team_comp_list

# 需要导入模块: import DataModel [as 别名]
# 或者: from DataModel import getTeamScore [as 别名]
def get_team_comp_list(this_comp, team):

    my_config = ScoutingAppMainWebServer.global_config
    complist = list()

    if this_comp == None:
        this_comp = my_config["this_competition"] + my_config["this_season"]
        season = my_config["this_season"]
    else:
        season = map_comp_to_season(this_comp)

    complist.append(this_comp)

    team_complist = WebTeamData.get_team_event_list_from_tba(my_config, team, season)
    if not team_complist:
        session = DbSession.open_db_session(my_config["db_name"] + my_config["this_season"])
        team_scores = DataModel.getTeamScore(session, team)
        for score in team_scores:
            comp = score.competition.upper()
            # currently, the competition season is stored in the database
            # as part of the competition. So, we need to add it for the comparison,
            # but not as we define the complist itself
            if comp != this_comp.upper():
                complist.append(comp)

    else:
        for comp in team_complist:
            if comp.upper() != this_comp.upper():
                complist.append(comp)

    return complist
开发者ID:FRCTeam1073-TheForceTeam,项目名称:ScoutingAppCentral,代码行数:33,代码来源:WebCommonUtils.py

示例3: get_team_score_page

# 需要导入模块: import DataModel [as 别名]
# 或者: from DataModel import getTeamScore [as 别名]
def get_team_score_page(global_config, name):
        
    global_config['logger'].debug( 'GET Team Score: %s', name )
    
    session = DbSession.open_db_session(global_config['db_name'] + global_config['this_season'])
    
    web.header('Content-Type', 'application/json')
    result = []
    result.append('{ "score": [')
    comp = global_config['this_competition'] + global_config['this_season']
    team_score = DataModel.getTeamScore(session, name, comp)
    for score in team_score:
        result.append(score.json())
        result.append(',\n')
    if len(team_score) > 0:
        result = result[:-1]
    result.append(']}')
    return ''.join(result)
开发者ID:,项目名称:,代码行数:20,代码来源:

示例4: get_team_score_json

# 需要导入模块: import DataModel [as 别名]
# 或者: from DataModel import getTeamScore [as 别名]
def get_team_score_json(global_config, name, comp):
        
    global_config['logger'].debug( 'GET Team %s Score For Competition %s', name, comp )
    session = DbSession.open_db_session(global_config['db_name'])
    
    web.header('Content-Type', 'application/json')
    result = []
    result.append('{ "competition" : "%s", "team" : "%s", ' % (comp,name))
    team_scores = DataModel.getTeamScore(session, name, comp)
    if len(team_scores)==1:
        result.append('"score": "%s" }' % team_scores[0].score)
    else:
        result.append('  "score": [')
        for score in team_scores:
            result.append(score.json())
            result.append(',\n')
        if len(team_scores) > 0:
            result = result[:-1]
        result.append(']}')
    return ''.join(result)
开发者ID:mbhoude,项目名称:ScoutingAppCentral,代码行数:22,代码来源:WebTeamData.py

示例5: get_team_comp_list

# 需要导入模块: import DataModel [as 别名]
# 或者: from DataModel import getTeamScore [as 别名]
def get_team_comp_list(this_comp, team):
    
    my_config = ScoutingAppMainWebServer.global_config
    complist = list()
    
    if this_comp == None:
        this_comp = my_config['this_competition'] + my_config['this_season']
        
    complist.append(this_comp)
    
    session = DbSession.open_db_session(my_config['db_name'])
    team_scores = DataModel.getTeamScore(session, team)
    for score in team_scores:
        comp = score.competition
        # currently, the competition season is stored in the database
        # as part of the competition. So, we need to add it for the comparison,
        # but not as we define the complist itself
        if comp != this_comp:
            complist.append(comp)
    return complist
开发者ID:mbhoude,项目名称:ScoutingAppCentral,代码行数:22,代码来源:WebCommonUtils.py


注:本文中的DataModel.getTeamScore方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。