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)
def test8_1(): 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.CellWithOrders( subject_avg_rank_item, class_dimen_table, [[school_where, class_where], exam_where], "subjectId", subject_ids) class_sum_avg_rank_row = qa.ColSeriesCell(class_sum_avg_rank_cell, school_class_ids) class_subject_rank_row = qa.ColSeriesCell(class_subject_avg_rank_cell, school_class_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)
def get_school_subject_values(item, table_code): varied_where = school_where table = table_config.get_school_dimen_table(table_code) ids = school_ids subject_cell = qa.CellWithOrders(item, table, [varied_where, exam_where], "subjectId", subject_ids) subject_row = qa.ColSeriesCell(subject_cell, ids) return subject_row.get_values()
def test4(): school_subject_cell = qa.CellWithOrders(num_item, school_dimen_table, [school_where, exam_where], subject_item, subject_ids) school_subject_row = qa.ColSeriesCell(school_subject_cell, school_ids) datarows = school_subject_row.get_values() for table_row in list_util.combine_values_by_col(school_names, datarows): print(table_row)
def test6(): district_exams_avg_cell = qa.CellWithOrders( subject_avg_item, district_dimen_table, [district_where, subject_where], exam_item, exam_ids) district_exams_avg_row = qa.ColSeriesCell(district_exams_avg_cell, district_ids) datarows = district_exams_avg_row.get_values() for table_row in list_util.combine_values_by_col(district_names, datarows): print(table_row)
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 test2(): school_subject_cell = qa.CellWithOrders(subject_avg_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_five_item, school_sum_table, [school_where, exam_where]) school_sum_row = qa.ColSeriesCell(school_sum_cell, school_ids) datarows = qa.DataRows.combine_col_rows(school_sum_row, school_subject_row) for table_row in list_util.combine_values_by_col(school_names, datarows): print(table_row)
def table_of_dimen_sum(item, table, exam_where, varied_where, ids, subject_ids=None): if subject_ids is None: cell = qa.Cell(item, table, [varied_where, exam_where]) else: cell = qa.CellWithOrders(item, table, [varied_where, exam_where], "subjectId", subject_ids) if cell is None: return [] else: return qa.ColSeriesCell(cell, ids).get_values()
def __init__(self, exam, gradation, where): self.exam = exam self.gradation = gradation self.where = where # self.exam = handler.Exam() # self.gradation = handler.Gradation() # self.where = handler.Where() self.cell_where = qa.CellWhere() self.cell_order = qa.CellOrder() self.cell = qa.Cell(where_list=self.cell_where) self.order_cell = qa.CellWithOrders(where_list=self.cell_where, order=self.cell_order) self.row_value = qa.RowSeriesCell() self.col_value = qa.ColSeriesCell()
def get_class_sum_subject_avg_rank_values(): if base_student == report_config.SPECIAL: sum_table = table_config.QA_ZK_CLASS_SUM_TABLE dimen_table = table_config.QA_ZK_CLASS_DIMEN_TABLE elif base_student == report_config.CURRENT: sum_table = table_config.QA_CLASS_SUM_TABLE dimen_table = table_config.QA_CLASS_DIMEN_TABLE item = item_config.AVG_RANK_ITEM class_sum_cell = qa.Cell(item, sum_table, [[school_where, class_where], exam_where]) class_subject_cell = qa.CellWithOrders(item, dimen_table, [[school_where, class_where], exam_where], "subjectId", subject_ids) class_sum_row = qa.ColSeriesCell(class_sum_cell, class_ids) class_subject_row = qa.ColSeriesCell(class_subject_cell, class_ids) return qa.DataRows.combine_col_rows(class_sum_row, class_subject_row)
def test1(): district_subject_cell = qa.CellWithOrders(subject_avg_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_five_item, district_sum_table, [district_where, exam_where]) district_sum_row = qa.ColSeriesCell(district_sum_cell, district_ids) datarows = qa.DataRows.combine_col_rows(district_sum_row, district_subject_row) for table_row in list_util.combine_values_by_col(district_names, datarows): print(table_row)
def get_subject_sum_values(item, type_code, district_code): if district_code == DISTRICT_CODE: dimen_table, sum_table = table_config.get_district_table(type_code) varied_where = district_where ids = district_ids elif district_code == SCHOOL_CODE: dimen_table, sum_table = table_config.get_school_table(type_code) varied_where = school_where ids = school_ids subject_cell = qa.CellWithOrders(item, dimen_table, [varied_where, exam_where], "subjectId", subject_ids) subject_row = qa.ColSeriesCell(subject_cell, ids) sum_cell = qa.Cell(item, sum_table, [varied_where, exam_where]) sum_row = qa.ColSeriesCell(sum_cell, ids) return list_util.combine_values_by_col(sum_row.get_values(), subject_row.get_values())
def avg_rank_of_subject_sum_of_districts_schools(self): district_dimen_table = TableName.dimen(BaseStudent.NORMAL, District.DISTRICT, Subject.SUBJECT) exam_where = WhereFactory.exam(self.exam.exam_id) district_subject_cell = qa.CellWithOrders(Item.SUBJECT_AVG_NULL, district_dimen_table, [WhereFactory.district(), exam_where], Item.SUBJECT, subject_ids) district_subject_row = qa.ColSeriesCell(district_subject_cell, ReportController.district_ids) district_sum_table = TableName.dimen(BaseStudent.NORMAL, District.DISTRICT, Subject.SUM) district_sum_cell = qa.Cell(Item.get_sum_avg_null(self.sum_count), district_sum_table, [WhereFactory.district(), exam_where]) district_sum_row = qa.ColSeriesCell(district_sum_cell, ReportController.district_ids) datarows = qa.DataRows.combine_col_rows(district_sum_row, district_subject_row) district_names = list_util.add_something_to_list("(实考)", ReportController.district_names) for table_row in list_util.combine_values_by_row(FirstRow.AVG_RANK_OF_SUM_SUBJECT, list_util.combine_values_by_col(district_names, datarows)): print(table_row)
def get_cell(self): where_list = qa.CellWhere(self.where.fixed, self.where.varied) return qa.CellWithOrders(self.item, self.table, where_list, self.order)
def get_cell_with_order(select, where, order): return qa.CellWithOrders(select.item, select.table, where.get_where_list(), order.item, order.ids)
def get_cell(self): return qa.CellWithOrders(self.item, self.table, self.get_where_list(), self.order.item, self.order.ids)