From ad84ff99086f19270c401242da94dea016519c75 Mon Sep 17 00:00:00 2001 From: David Florness Date: Sat, 23 Jan 2021 12:28:23 -0500 Subject: [PATCH] Parse join election messages after parsing elections file --- election/election.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/election/election.go b/election/election.go index 56693c3..5085167 100644 --- a/election/election.go +++ b/election/election.go @@ -41,7 +41,6 @@ func NewElection(candidates []Candidate, createEventId id.EventID, func (el *Election) UnmarshalJSON(b []byte) error { type Alias Election // create alias to prevent endless loop tmp := (*Alias)(el) - err := json.Unmarshal(b, tmp) if err != nil { return err @@ -50,5 +49,9 @@ func (el *Election) UnmarshalJSON(b []byte) error { if el.LocalVoter != nil { el.Joins[el.LocalVoter.JoinEvt.ID] = el.LocalVoter.Voter } + for _, voter := range el.Joins { + // TODO: for some reason I can't get this to work in (*Voter).UnmarshalJSON + voter.JoinEvt.Content.ParseRaw(JoinElectionMessage) + } return nil } -- 2.38.4