def get_student_first_year_course_grades(dbname): ''' Returns a list of lists. Each sublist represents the grades of one student. The list has grades for all first year courses. ''' # TODO make None default con = database_interface.get_database_connection(dbname, None) courses = map(lambda inf: (inf[0], inf[1] + inf[2]), get_first_year_courses(con)) normalizer = CourseNormalizer(courses) columns = normalizer.get_norm_course_list() columns.append((-1, "Label")) results_table = ResultsTable(columns) students = get_student_grades(con, normalizer) cur = con.cursor() cur.execute(GET_STUDENT_LABELS) for r in cur: sid, label = r students[sid][-1] = label for sid in students.keys(): results_table.add_row(sid, students[sid]) con.close() return results_table