Ejemplo n.º 1
0
def test2():
    ids = []
    names = []
    start, end, step = [0, 150, 5]
    scopes = range(start, end, step)

    for index, scope in enumerate(scopes[0:-1]):
        ids.append([scope, scopes[index + 1]])
        names.append("(%d, %d]" % (scope, scopes[index + 1]))
    if scopes[-1] < end:
        ids.append([scopes[-1], end])
        names.append("(%d, %d]" % (scopes[-1], end))
    names[0] = "[%d, %d]" % (scopes[0], scopes[1])

    greater_equal_where = qa.Where("sum", symbol=">=")
    greater_where = qa.Where("sum", symbol=">")
    less_equal_where = qa.Where("sum", symbol="<=")

    cell1 = qa.Cell(
        "COUNT(*)", stu_dimen_table,
        [[greater_equal_where, less_equal_where], exam_where, subject_where])
    cell2 = qa.Cell(
        "COUNT(*)", stu_dimen_table,
        [[greater_where, less_equal_where], exam_where, subject_where])
    row1 = qa.RowSeriesCell(cell1, ids[0:1])
    row2 = qa.RowSeriesCell(cell2, ids[1:])
    table = qa.TableRows(["分数段", names], ['个数'], [row1, row2])
    for table_row in table.get_values():
        print(table_row)
Ejemplo n.º 2
0
def test1():
    district_subject_cell = qa.CellWithOrders(subject_avg_null_item,
                                              district_dimen_table,
                                              [district_where, exam_where],
                                              subject_item, subject_ids)

    district_subject_row = qa.ColSeriesCell(district_subject_cell,
                                            district_ids)

    district_sum_cell = qa.Cell(sum_avg_null_item, district_sum_table,
                                [district_where, exam_where])

    district_sum_row = qa.ColSeriesCell(district_sum_cell, district_ids)

    school_subject_cell = qa.CellWithOrders(subject_avg_rank_item,
                                            school_dimen_table,
                                            [school_where, exam_where],
                                            subject_item, subject_ids)
    school_subject_row = qa.ColSeriesCell(school_subject_cell, school_ids)

    school_sum_cell = qa.Cell(sum_avg_rank_item, school_sum_table,
                              [school_where, exam_where])
    school_sum_row = qa.ColSeriesCell(school_sum_cell, school_ids)

    first_row = [
        '类别', '语文', '排名', '数学', '英语', '排名', '物理', '排名', '化学', '排名', '总分', '排名'
    ]
    datarows = [[district_subject_row, district_sum_row],
                [school_subject_row, school_sum_row]]
    table_rows = qa.TableRows(first_row, district_school_names, *datarows)
    for table_row in table_rows.get_values():
        print(table_row)
Ejemplo n.º 3
0
def test8_2():
    class_sum_avg_rank_cell = qa.Cell(
        sum_avg_rank_item, class_sum_table,
        [[school_where, class_where], exam_where])
    class_subject_avg_rank_cell = qa.Cell(
        subject_avg_rank_item, class_dimen_table,
        [[school_where, class_where], subject_where, exam_where])
    class_sum_avg_rank_row = qa.ColSeriesCell(class_sum_avg_rank_cell,
                                              school_class_ids)
    class_subject_rank_row = qa.BlockSeriesCell(class_subject_avg_rank_cell,
                                                school_class_ids, subject_ids)
    first_row = [
        '学校',
        '班级',
        '总分',
        '排名',
        '语文',
        '排名',
        '数学',
        '英语',
        '排名',
        '物理',
        '排名',
        '化学',
        '排名',
    ]
    datarows = [class_sum_avg_rank_row, class_subject_rank_row]
    table_rows = qa.TableRows(first_row, school_class_names, datarows)
    for table_row in table_rows.get_values():
        print(table_row)
Ejemplo n.º 4
0
def test6():
    school_sum_line_cell = qa.Cell(line_items, school_line_table,
                                   [school_where, exam_where])
    school_sum_line_row = qa.ColSeriesCell(school_sum_line_cell, school_ids)

    first_row = ['学校', line_names]
    datarows = school_sum_line_row
    table_rows = qa.TableRows(first_row, school_names, datarows)
    for table_row in table_rows.get_values():
        print(table_row)
Ejemplo n.º 5
0
def test7():
    district_dimen_avg_cell = qa.Cell(
        dimen_avg_items, district_dimen_table,
        [district_where, exam_where, subject_where])
    district_dimen_avg_row = qa.ColSeriesCell(district_dimen_avg_cell,
                                              district_ids)

    school_dimen_avg_cell = qa.Cell(dimen_avg_items, school_dimen_table,
                                    [school_where, exam_where, subject_where])
    school_dimen_avg_row = qa.ColSeriesCell(school_dimen_avg_cell, school_ids)

    first_row = ['学校', dimen_names]
    datarows = [district_dimen_avg_row, school_dimen_avg_row]
    table_rows = qa.TableRows(first_row, district_school_names, *datarows)
    for table_row in table_rows.get_values():
        print(table_row)