package game import ( "sirlab.de/go/knowyt/user" ) func (gm *Game) GetQuotesInfoByUser(usr *user.User) *QuotesInfo { usrId := usr.GetId() return &QuotesInfo{Quotes: gm.getQuotesInfoByUserId(usrId)} } func (gm *Game) getQuotesInfoByUserId(usrId string) []Quote { gm.mu.Lock() defer gm.mu.Unlock() quotes := make([]Quote, 0) for _, quote := range gm.quotes { if quote.GetSourceId() == usrId { quotes = append(quotes, Quote{ Id: quote.GetId(), Quote: quote.GetQuote(), }) } } return quotes }