diff --git a/scripts/subscribe_participants/.gitignore b/scripts/subscribe_participants/.gitignore index afed0735..b51cf63e 100644 --- a/scripts/subscribe_participants/.gitignore +++ b/scripts/subscribe_participants/.gitignore @@ -1 +1,3 @@ *.csv +subscribe_participants + diff --git a/scripts/subscribe_participants/main.go b/scripts/subscribe_participants/main.go index cf8a7184..1210bb98 100644 --- a/scripts/subscribe_participants/main.go +++ b/scripts/subscribe_participants/main.go @@ -41,7 +41,7 @@ func main() { username := flag.String("username", "admin", "Username") password := flag.String("password", "admin", "Password") subscribe := flag.Bool("subscribe", true, "Subscribe to the given contest") - region := flag.Bool("region", true, "Region based subscription") + region := flag.Bool("region", false, "Region based subscription") unsubscribeAll := flag.Bool("unsubscribe-all", false, "Unsubscribe all participants from all contests") juniorContestId := flag.Int("jid", 0, "Contest ID for Junior category") @@ -82,13 +82,13 @@ func main() { } } } - log.Println(participants) + allParticipants = participants } var updated bool if *unsubscribeAll { - for _, participant := range participants { + for _, participant := range allParticipants { participant.ContestIDs = make(orm.ContestIDs, 0) id, err := client.Update(participant) if err != nil { @@ -124,7 +124,7 @@ func main() { } } - for _, participant := range participants { + for _, participant := range allParticipants { for _, contest := range participant.Contests { participant.ContestIDs = append(participant.ContestIDs, contest.ID) } @@ -152,7 +152,7 @@ func main() { } else { if *subscribe { - for _, participant := range participants { + for _, participant := range allParticipants { for _, contest := range participant.Contests { participant.ContestIDs = append(participant.ContestIDs, contest.ID) }