refactor: admin interface: number of quotes instead of quotes

This commit is contained in:
Settel 2022-03-01 12:25:25 +01:00
parent e2ad380c6c
commit 4f760bb5ed
3 changed files with 9 additions and 8 deletions

View File

@ -9,7 +9,7 @@
</tr> </tr>
<tr class="admin-tile-players__player" @click="editPlayer(player.id)" v-for="player in players" :key="player.id"> <tr class="admin-tile-players__player" @click="editPlayer(player.id)" v-for="player in players" :key="player.id">
<td>{{ player.name }}</td> <td>{{ player.name }}</td>
<td>{{ player.quotes.length }}</td> <td>{{ player.numQuotes }}</td>
<td>{{ player.score }}</td> <td>{{ player.score }}</td>
<td>{{ player.isPlaying ? (player.isIdle ? 'idle' : 'active') : '-'}}</td> <td>{{ player.isPlaying ? (player.isIdle ? 'idle' : 'active') : '-'}}</td>
</tr> </tr>

View File

@ -6,7 +6,8 @@ func (gm *Game) GetGameInfo() *GameInfoJson {
gameInfo := gm.initGameInfoJson() gameInfo := gm.initGameInfoJson()
for i, _ := range gameInfo.Players { for i, _ := range gameInfo.Players {
gameInfo.Players[i].Quotes = gm.getQuotesInfoByUserId(gameInfo.Players[i].Id) quotes := gm.getQuotesInfoByUserId(gameInfo.Players[i].Id)
gameInfo.Players[i].NumberOfQuotes = len(quotes)
} }
return gameInfo return gameInfo
} }

View File

@ -86,7 +86,7 @@ type PlayerInfoJson struct {
Score int `json:"score"` Score int `json:"score"`
IsPlaying bool `json:"isPlaying"` IsPlaying bool `json:"isPlaying"`
IsIdle bool `json:"isIdle"` IsIdle bool `json:"isIdle"`
Quotes []Quote `json:"quotes"` NumberOfQuotes int `json:"numQuotes"`
} }
type GameInfoJson struct { type GameInfoJson struct {