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

View File

@ -6,7 +6,8 @@ func (gm *Game) GetGameInfo() *GameInfoJson {
gameInfo := gm.initGameInfoJson()
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
}

View File

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