revelation of the source

This commit is contained in:
Settel 2021-09-06 21:56:52 +02:00
parent ecfea20df1
commit cd020e4a31
5 changed files with 18 additions and 4 deletions

View File

@ -51,7 +51,8 @@ func (gm *Game) getSelections() map[string]bool {
func (gm *Game) getRevelation() *syncdata.Revelation { func (gm *Game) getRevelation() *syncdata.Revelation {
revelation := syncdata.Revelation{ revelation := syncdata.Revelation{
Votes: gm.round.revelation.votes, Votes: gm.round.revelation.votes,
Sources: gm.round.revelation.sources,
} }
return &revelation return &revelation

View File

@ -9,5 +9,15 @@ func (gm *Game) revealSource() {
fmt.Println(err) fmt.Println(err)
return return
} }
gm.mu.Lock()
for _, source := range gm.round.sources {
gm.round.revelation.sources[source.id] = false
}
gm.round.revelation.sources["f17065b7-88e7-4777-bc48-15770a5b7c83"] = true
// quote := gm.quotes[gm.round.quoteId]
// gm.round.revelation.sources[quote.GetSourceId()] = true
gm.mu.Unlock()
gm.notifyClients() gm.notifyClients()
} }

View File

@ -29,7 +29,8 @@ func (gm *Game) setupRound() {
gm.round = Round{ gm.round = Round{
selections: make(map[string]string, 0), selections: make(map[string]string, 0),
revelation: Revelation{ revelation: Revelation{
votes: make(map[string][]string, 0), votes: make(map[string][]string, 0),
sources: make(map[string]bool, 0),
}, },
} }
} }

View File

@ -39,7 +39,8 @@ type Source struct {
} }
type Revelation struct { type Revelation struct {
votes map[string][]string votes map[string][]string
sources map[string]bool
} }
type Round struct { type Round struct {

View File

@ -18,7 +18,8 @@ type SourceInfo struct {
} }
type Revelation struct { type Revelation struct {
Votes map[string][]string `json:"votes"` Votes map[string][]string `json:"votes"`
Sources map[string]bool `json:"sources"`
} }
type RoundInfo struct { type RoundInfo struct {