本文整理汇总了Python中DataModel.getTeamNotes方法的典型用法代码示例。如果您正苦于以下问题:Python DataModel.getTeamNotes方法的具体用法?Python DataModel.getTeamNotes怎么用?Python DataModel.getTeamNotes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataModel
的用法示例。
在下文中一共展示了DataModel.getTeamNotes方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_team_scouting_notes_json
# 需要导入模块: import DataModel [as 别名]
# 或者: from DataModel import getTeamNotes [as 别名]
def get_team_scouting_notes_json(global_config, comp, name, store_json_file=False):
global_config['logger'].debug( 'GET Team %s Scouting Notes 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",\n' % (comp,name))
result.append(' "scouting_notes" : [\n')
team_notes = DataModel.getTeamNotes(session, name, comp)
for note in team_notes:
result.append(' { "tag": "%s", "note": "%s" }' % (note.tag,note.data))
result.append(',\n')
if len(team_notes) > 0:
result = result[:-1]
result.append(' ] }\n')
json_str = ''.join(result)
if store_json_file is True:
try:
FileSync.put( global_config, '%s/EventData/TeamData/team%s_scouting_notes.json' % (comp,name), 'text', json_str)
except:
raise
session.remove()
return json_str
示例2: get_team_notes_page
# 需要导入模块: import DataModel [as 别名]
# 或者: from DataModel import getTeamNotes [as 别名]
def get_team_notes_page(global_config, name):
global_config['logger'].debug( 'GET Team Notes: %s', name )
session = DbSession.open_db_session(global_config['db_name'] + global_config['this_season'])
#web.header('Content-Type', 'application/json')
notes_string = ''
comp = global_config['this_competition'] + global_config['this_season']
team_notes = DataModel.getTeamNotes(session, name, comp)
for note in team_notes:
notes_string += note.data + '\n'
return notes_string
示例3: get_team_scouting_notes_json
# 需要导入模块: import DataModel [as 别名]
# 或者: from DataModel import getTeamNotes [as 别名]
def get_team_scouting_notes_json(global_config, comp, name):
global_config['logger'].debug( 'GET Team %s Scouting Notes 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",\n' % (comp,name))
result.append(' "scouting_notes" : [\n')
team_notes = DataModel.getTeamNotes(session, name, comp)
for note in team_notes:
result.append(' { "tag": "%s", "note": "%s" }' % (note.tag,note.data))
result.append(',\n')
if len(team_notes) > 0:
result = result[:-1]
result.append(' ] }\n')
return ''.join(result)
示例4: get_team_datafiles_page
# 需要导入模块: import DataModel [as 别名]
# 或者: from DataModel import getTeamNotes [as 别名]
#.........这里部分代码省略.........
pattern = 'Team' + name + '_' + '[a-zA-Z0-9_]*.txt'
datafiles = get_datafiles(input_dir, re.compile(pattern), False, global_config['logger'])
input_dir = './static/data/' + comp + '/ScoutingPictures/'
pattern = 'Team' + name + '_' + '[a-zA-Z0-9_]*.jpg|mp4'
mediafiles = get_datafiles(input_dir, re.compile(pattern), False, global_config['logger'])
if len(datafiles) == 0 and len(mediafiles) == 0:
continue
page += '<hr>'
page += '<h3> ' + comp + '</h3>'
team_attributes = DataModel.getTeamAttributesInOrder(session, name, comp)
if len(team_attributes) > 0:
page += '<ul>'
page += '<h3>Scouting Data Summary:</h3>'
page += '<ul>'
page += '<table border="1" cellspacing="5">'
page += '<tr>'
page += '<th>Attribute Name</th>'
page += '<th>Matches</th>'
page += '<th>Cumulative Value</th>'
page += '<th>Average Value</th>'
#page += '<th>Last Value</th>'
page += '<th>All Values</th>'
page += '</tr>'
for attribute in team_attributes:
attr_def = attr_definitions.get_definition( attribute.attr_name )
include_attr = False
if attr_def:
if attr_def.has_key('Include_In_Team_Display') \
and attr_def['Include_In_Team_Display'] == 'Yes':
include_attr = True
elif attr_def.has_key('Include_In_Report') \
and attr_def['Include_In_Report'] == 'Yes':
include_attr = True
elif attr_def.has_key('Weight') \
and attr_def['Weight'] != '0':
include_attr = True
if include_attr == True:
page += '<tr>'
if attr_def.has_key('Display_Name'):
page += '<td>%s</td>' % attr_def['Display_Name']
else:
page += '<td>%s</td>' % attr_def['Name']
page += '<td>%s</td>' % str(attribute.num_occurs)
page += '<td>%s</td>' % str(attribute.cumulative_value)
page += '<td>%0.2f</td>' % (attribute.avg_value)
#page += '<td>%s</td>' % str(attribute.attr_value)
page += '<td>%s</td>' % attribute.all_values
page += '</tr>'
page += '</table>'
page += '</ul>'
page += '</ul>'
if len(datafiles) > 0:
page += '<ul>'
page += '<h3>Pit and Match Data:</h3>'
page += '<ul>'
for filename in datafiles:
segments = filename.split('/')
basefile = segments[-1]
# the following line inserts a hyperlink to the file itself, the second line
# inserts a hyperlink to a url that allows the webserver to create a nicer display of
# the file contents
#page += '<li><a href="' + filename.lstrip('.') + '">' + basefile + '</a></li>'
page += '<li><a href="' + '/ScoutingData/' + comp + '/' + basefile + '">' + basefile + '</a></li>'
page += '</ul>'
if len(mediafiles) > 0:
page += '<h3>Pictures and Videos:</h3>'
page += '<ul>'
for filename in mediafiles:
segments = filename.split('/')
basefile = segments[-1]
page += '<li><a href="' + filename.lstrip('.') + '">' + basefile + '</a></li>'
page += '</ul>'
page += '</ul>'
if display_notes == True:
page += '<hr>'
page += '<h3> Notes for Team ' + name + '</h3>'
page += '<ul>'
comp = global_config['this_competition'] + global_config['this_season']
team_notes = DataModel.getTeamNotes(session, name, comp)
for note in team_notes:
page += '<li>' + note.data + '</li>'
page += '</ul>'
session.remove()
return page