Пример #1
0
def fetch_results(prof):
    tb = [[['Monday']], [['Tuesday']], [['Wednesday']], [['Thursday']],
          [['Friday']]]
    times = [
        '', '8 AM', '9 AM', '10 AM', '11 AM', '12 PM', '2 PM', '3 PM', '4 PM',
        '5 PM'
    ]

    prof = correct_spelling(prof)
    slot_data = get_times(prof)
    dept = get_attr(prof, 'dept')
    website = get_attr(prof, 'website')

    if len(slot_data) == 0 and len(dept) == 0:
        abort(404)

    data = get_table(slot_data)

    for row in tb:
        for i in range(9):
            row.append([])

    for item in data:
        for venue in data[item]:
            if venue == '0':
                venue = 'In Dept'

            tb[int(item[0])][int(item[1]) + 1].append(venue)

    return [tb, times, dept, website, prof.title()]
Пример #2
0
def fetch_results(prof):
    tb = [['Monday'], ['Tuesday'], ['Wednesday'], ['Thursday'], ['Friday']]
    times = ['', '8 AM', '9 AM', '10 AM', '11 AM', '12 PM', '2 PM', '3 PM', '4 PM', '5 PM']

    data = get_table(get_times(prof))

    for row in tb:
        for i in range(9):
            row.append('')

    for item in data:
        for venue in data[item]:
            if venue != '0':
                tb[int(item[0])][int(item[1])+1] +=  venue + " | "
        
        tb[int(item[0])][int(item[1])+1] = tb[int(item[0])][int(item[1])+1][:-2]

    return [tb, times]
Пример #3
0
def result():
    tb = [['Monday'], ['Tuesday'], ['Wednesday'], ['Thursday'], ['Friday']]
    times = [
        '', '8 AM - 9 AM', '9 AM - 10 AM', '10 AM - 11 AM', '11 AM - 12 AM',
        '12 PM - 1 PM', '2 PM - 3 PM', '3 PM - 4PM', '4 PM - 5 PM',
        '5 PM - 6 PM'
    ]

    prof = request.form['prof']
    data = get_table(get_times(prof))

    for row in tb:
        for i in range(9):
            row.append('')

    for item in data:
        for venue in data[item]:
            if venue != '0':
                tb[int(item[0])][int(item[1]) + 1] = venue

    return render_template('result.html', name=prof, data=tb, times=times)