def aggregate_assignments_by_user(assignments, username_mapping):
    """Aggregates a flat list of ticket assignments per user."""
    data = {}
    for t_id, n_id, username, msg in assignments:
        gh_name = username_mapping[username]
        data.setdefault(gh_name, []).append((t_id, msg))
    return data
