Esempio n. 1
0
def index_page1t():
    oneteam_folder = os.path.join(sc.output_path(), 'oneteam')
    file_names = os.listdir(oneteam_folder)
    file_data = [(f_name, 'Team {}'.format(f_name[2:-5]))
                 for f_name in file_names if f_name[-5:] == '.html']
    links = [
        '<li><a href="oneteam/{}">{}</a></li>'.format(f_data[0], f_data[1])
        for f_data in file_data
    ]
    html = '<html><head><link rel="stylesheet" href="list-nav.css"><title>IRS Scouting Data One Team Graphs</title></head>'
    html = html + '''<ul id="list-nav">
	<li><a href="./index.html">Six Team</a></li>
	<li><a href="./pointschart.html">Points Chart</a></li>
	<li><a href="./rankingtable.html">Ranking Table</a></li>
	<li><a href="./oneteam_index.html">One Team</a></li><br><br>
</ul><body><h1> IRS Scouting Data One Team Graphs</h1>'''
    html = html + '<h3> Last Updated at Match: {} </h3>'.format(
        sme.EventDal.get_previous_match())
    html = html + '<a href=index.html><h4>Main Page</h4></a> <br/><br/>'
    html = html + ''.join(links)
    html = html + '''
            </ul></body></html>
    '''
    os.chdir(sc.output_path())
    index_file = open("oneteam_index.html", "w")
    index_file.write(html)
    index_file.close()
    return html
Esempio n. 2
0
def index_page():
    sixteam_folder = os.path.join(sc.output_path(), 'sixteam')
    last_match = sme.EventDal.get_previous_match()
    file_names = os.listdir(sixteam_folder)
    file_data = [(f_name, 'Match {}'.format(f_name[2:-5]))
                 for f_name in file_names if f_name[-5:] == '.html']
    links = [
        '<li><a href="sixteam/{}">{}</a></li>'.format(f_data[0], f_data[1])
        for f_data in file_data
    ]

    html = '<html><head><link rel="stylesheet" href="list-nav.css"><title>IRS Scouting Data</title></head>'
    html = html + '''<ul id="list-nav">
	<li><a href="./index.html">Six Team</a></li>
	<li><a href="./pointschart.html">Points Chart</a></li>
	<li><a href="./rankingtable.html">Ranking Table</a></li>
	<li><a href="./oneteam_index.html">One Team</a></li>
</ul><body><br><br><h1>IRS Scouting Data</h1>h2>Updated at match: ''' +\
                   sme.EventDal.get_previous_match() + '</h2><ul>'

    html = html + ''.join(links)
    html = html + '</ul><h3>One team charts</h3><a href="oneteam_index.html">Oneteam charts</a>'
    html = html + '</ul><h3>Ranking Table</h3><a href="rankingtable.html">Ranking Table</a>'
    html = html + '<h3>Points Chart</h3><a href="pointschart.html">Points Chart</a></body></html>'
    os.chdir(sc.output_path())
    index_file = open("index.html", "w")
    index_file.write(html)
    index_file.close()
    return html
Esempio n. 3
0
def pages_pointschart():
    match = sme.EventDal.get_current_match()
    os.chdir(sc.output_path())
    chart = point_chart()
    div1 = blt.WidgetBox(bmw.Div(text='<a href="index.html">Home Page</a>'))
    div2 = blt.WidgetBox(
        bmw.Div(text='<h1>Points Chart</h1>' + 'updated at match:' + match))
    bokeh.io.output_file('pointschart.html')
    col = blt.column([div1, div2, chart])
    title = 'Ranking Table: Match ' + match
    # LocalResource needed to load JS and CSS files from local folder
    res = server.view.bokeh.LocalResource(
        os.path.join(sc.output_path(), 'static'))
    bokeh.io.save(col, title=title, resources=res)
Esempio n. 4
0
def test_updater():
    sme.EventDal.set_current_event('waahs', '2019')
    sme.EventDal.set_current_match('060-q')
    c = datetime.datetime.now().strftime('%D %H:%M')
    u.update_graph()
    a = time.localtime(os.path.getmtime(sc.output_path() + '\\rankingtable.html'))
    b = time.strftime("%D %H:%M", a)
    assert c <= b
    a = time.localtime(os.path.getmtime(sc.output_path() + '\\oneteam_index.html'))
    b = time.strftime("%D %H:%M", a)
    assert c <= b
    a = time.localtime(os.path.getmtime(sc.output_path() + '\\index.html'))
    b = time.strftime("%D %H:%M", a)
    assert c <= b
    a = time.localtime(os.path.getmtime(sc.output_path() + '\\pointschart.html'))
    b = time.strftime("%D %H:%M", a)
    assert c <= b
Esempio n. 5
0
def pages_6t(matches, num_matches=12):
    os.chdir(os.path.join(sc.output_path(), 'sixteam'))
    for match in matches:
        bokeh.io.output_file('6t' + match + '.html')
        div_top = bmw.Div(text='''
            <H1>Match {} Six Team Chart</H1>
        '''.format(match))
        div_all = bmw.Div(text='<h3>All Matches</h3>')
        row_all = blt.row(total_6t(match, num_matches))
        div_l3 = bmw.Div(text='<h3>Last 3 Matches</h3>')
        row_l3 = blt.row(total_6t(match, 3))

        col = blt.Column(div_top, div_all, row_all, div_l3, row_l3)
        title = 'Six Team Display: Match ' + match
        # LocalResource needed to load JS and CSS files from local folder
        res = server.view.bokeh.LocalResource(
            os.path.join(sc.output_path(), 'static'))
        bokeh.io.save(col, title=title, resources=res)
Esempio n. 6
0
def pages_rankingtable():
    df_all = ranking_df()
    autoTable = ranking_auto(df_all)
    generalTable = ranking_general(df_all)
    match = sme.EventDal.get_current_match()
    tab1 = bmw.Panel(child=generalTable, title='General Table')
    tab2 = bmw.Panel(child=autoTable, title='Auto Table')
    tabs = bmw.Tabs(tabs=[tab1, tab2])
    div1 = blt.WidgetBox(bmw.Div(text='<a href="index.html">Home Page</a>'))
    div2 = blt.WidgetBox(
        bmw.Div(text='<h1>Ranking Table</h1>' + 'updated at match:' + match))
    os.chdir(sc.output_path())
    bokeh.io.output_file('rankingtable.html')
    col = blt.column([div1, div2, tabs])
    title = 'Ranking Table: Match ' + match
    # LocalResource needed to load JS and CSS files from local folder
    res = server.view.bokeh_res.LocalResource(
        os.path.join(sc.output_path(), 'static'))
    bokeh.io.save(col, title=title, resources=res)