def get_school_exam_values(item, table_code, subject_id):
    subject_where.set_value(subject_id)
    varied_where = school_where
    table = table_config.get_school_dimen_table(table_code)
    ids = school_ids

    start, end = qam_dao.get_subject_exam_start_end(exam, subject_id)
    exam_ids = all_exam_ids[start:end + 1]
    exam_cell = qa.CellWithOrders(item, table, [varied_where, subject_where], "examId", exam_ids)
    exam_row = qa.ColSeriesCell(exam_cell, ids)
    return exam_row.get_values()
def get_exam_subject_values(item, table_code, school_id, subject_id):
    subject_where.set_value(subject_id)
    school_where.set_value(school_id)
    varied_where = exam_where
    start, end = qam_dao.get_subject_exam_start_end(exam, subject_id)
    exam_ids = all_exam_ids[start:end + 1]

    table = table_config.get_school_dimen_table(table_code)
    ids = exam_ids

    exam_cell = qa.Cell(item, table, [varied_where, school_where, subject_where])
    exam_row = qa.ColSeriesCell(exam_cell, ids)
    return exam_row.get_values()
def school_exam_dimen_avg_table(subject_id, index):
    subject_where.set_value(subject_id)
    dimen_description = qam_dao.get_dimen_description_by_exam(exam_where, subject_where)
    dimen_length = len(dimen_description)
    dimen_item = item_config.DIMEN_AVG_ITEMS[0:dimen_length]

    if base_student == report_config.SPECIAL:
        table_code = table_config.QA_ZK
    elif base_student == report_config.CURRENT:
        table_code = table_config.QA

    school_values = get_exam_subject_values(dimen_item, table_code, school_ids[index], subject_id)
    start, end = qam_dao.get_subject_exam_start_end(exam, subject_id)
    exam_nicks = all_exam_nicks[start:end + 1]
    result = list_util.combine_values_by_col(exam_nicks, school_values)
    dimen_description.insert(0, "知识块(平均分)")
    result.insert(0, dimen_description)
    return result
def get_exam_rank_diff_values(item, table_code, school_id, subject_id):
    font_subject_where = qa.Where("font.subjectId", subject_id)
    behind_subject_where = qa.Where("behind.subjectId", subject_id)
    font_school_where = qa.Where("font.schoolId", school_id)
    behind_school_where = qa.Where("behind.schoolId", school_id)

    varied_where = [qa.Where("font.examId"), qa.Where("behind.examId")]
    start, end = qam_dao.get_subject_exam_start_end(exam, subject_id)
    exam_ids = all_exam_ids[start:end + 1]
    exam_diff_ids = get_rank_diff_exam_ids(exam_ids)

    table = table_config.get_school_dimen_table(table_code)
    table = ["%s AS font" % table, "%s AS behind" % table]
    ids = exam_diff_ids

    exam_cell = qa.Cell(item, table, [varied_where, font_school_where, behind_school_where, font_subject_where,
                                      behind_subject_where])
    exam_row = qa.ColSeriesCell(exam_cell, ids)
    return exam_row.get_values()
def school_avg_rank_table(subject_id, index):
    if base_student == report_config.SPECIAL:
        table_code = table_config.QA_ZK
    elif base_student == report_config.CURRENT:
        table_code = table_config.QA

    item = item_config.AVG_ITEM
    district_avg_values = get_district_exam_values(item, table_code, subject_id)
    school_avg_values = get_school_exam_values(item, table_code, subject_id)
    item = item_config.RANK_ITEM
    school_rank_values = get_school_exam_values(item, table_code, subject_id)

    district_avg_row = ['区平均分'] + district_avg_values[0]
    similar_avg_row = ['同类学校平均分'] + district_avg_values[get_district_index(school_types[index])]
    school_avg_row = ['校平均分'] + school_avg_values[index]
    school_rank_row = ['排名'] + school_rank_values[index]
    result = [school_rank_row, school_avg_row, similar_avg_row, district_avg_row]

    start, end = qam_dao.get_subject_exam_start_end(exam, subject_id)
    exam_nicks = all_exam_nicks[start:end + 1]
    exam_nicks.insert(0, "考试(类别)")

    result.insert(0, exam_nicks)
    return result
Пример #6
0
def get_subject_exam_ids(subject_id):
    start, end = qam_dao.get_subject_exam_start_end(exam, subject_id)
    return all_exam_ids[start:end + 1]