#!/usr/bin/env python3 """Remove resigned members from team_assignments.json. Update RESIGNED_IDS with the Discord IDs of members who have resigned before running this script. """ import json # Discord IDs of members who have resigned - update before running RESIGNED_IDS: list[str] = [] def main() -> None: """Remove resigned members from team assignments.""" with open("team_assignments.json") as f: teams = json.load(f) changes_made = [] for team in teams: team_name = team["name"] original_leaders = len(team["leaders"]) team["leaders"] = [lid for lid in team["leaders"] if lid not in RESIGNED_IDS] if len(team["leaders"]) < original_leaders: removed = original_leaders - len(team["leaders"]) changes_made.append(f"Removed {removed} leader(s) from {team_name}") original_participants = len(team["participants"]) team["participants"] = [ pid for pid in team["participants"] if pid not in RESIGNED_IDS ] if len(team["participants"]) < original_participants: removed = original_participants - len(team["participants"]) changes_made.append(f"Removed {removed} participant(s) from {team_name}") print(f"⚠️ {team_name}: Proficiency distribution may need updating") with open("team_assignments.json", "w") as f: json.dump(teams, f, indent=2) if changes_made: print("✅ Successfully removed resigned members from team_assignments.json") print("\nChanges made:") for change in changes_made: print(f" - {change}") else: print("No changes needed - resigned members were not found in team assignments") print("\nUpdated team sizes:") for team in teams: total_members = len(team["leaders"]) + len(team["participants"]) print( f" {team['name']}: {total_members} members " f"({len(team['leaders'])} leaders, {len(team['participants'])} participants)" # noqa: E501 ) if __name__ == "__main__": main()