Пример #1
0
def get_team_groups(group_codes):
    results = data_loch.get_team_groups(group_codes=group_codes)
    if not results:
        return []

    def translate_row(row):
        return {
            'groupCode': row['group_code'],
            'groupName': row['group_name'],
            'name': row['group_name'],
            'teamCode': row['team_code'],
            'teamName': row['team_name'],
        }

    return [translate_row(row) for row in results]
Пример #2
0
def all_team_groups():
    results = data_loch.get_team_groups()
    if not results:
        return []

    def translate_row(row):
        group_code = row['group_code']
        group_name = row['group_name'] + ' (AA)' if group_code.endswith(
            '-AA') else row['group_name']
        return {
            'groupCode': group_code,
            'groupName': group_name,
            'name': group_name,
            'teamCode': row['team_code'],
            'teamName': row['team_name'],
            'totalStudentCount': row['count'],
        }

    return [translate_row(row) for row in results]