feat: show number of quotes played by player
This commit is contained in:
parent
fee9caff08
commit
24c93623dc
@ -30,7 +30,7 @@ const emit = defineEmits(['icon-top-click', 'icon-bottom-click'])
|
||||
&__container {
|
||||
position: relative;
|
||||
min-width: 300px;
|
||||
margin: 40px;
|
||||
margin: 16px;
|
||||
padding: 16px 30px;
|
||||
background-color: $admin-tile-background-color;
|
||||
border: $admin-tile-border;
|
||||
|
@ -3,10 +3,10 @@
|
||||
<AdminInfoTile title="Players" icon-top="reload" @icon-top-click="reload" icon-bottom="add" @icon-bottom-click="addPlayer">
|
||||
<table class="players-tile__table">
|
||||
<tr>
|
||||
<th class="players-tile__table-head">{{ $t('name') }}:</th>
|
||||
<th class="players-tile__table-head">{{ $t('num-quotes') }}</th>
|
||||
<th class="players-tile__table-head">{{ $t('score') }}</th>
|
||||
<th class="players-tile__table-head">{{ $t('last-logged-in') }}</th>
|
||||
<th class="players-tile__table-head players-tile__cell">{{ $t('name') }}:</th>
|
||||
<th class="players-tile__table-head players-tile__cell">{{ $t('num-quotes') }}</th>
|
||||
<th class="players-tile__table-head players-tile__cell">{{ $t('score') }}</th>
|
||||
<th class="players-tile__table-head players-tile__cell">{{ $t('last-logged-in') }}</th>
|
||||
</tr>
|
||||
<tr v-for="player in players" class="players-tile__row" :key="player.id" @click="editPlayer(player)">
|
||||
<td class="players-tile__cell">
|
||||
@ -15,7 +15,7 @@
|
||||
<nuxt-icon name="crown" filled />
|
||||
</div>
|
||||
</td>
|
||||
<td class="players-tile__cell">{{ player.numQuotes }}</td>
|
||||
<td class="players-tile__cell">{{ player.numQuotesPlayed }} / {{ player.numQuotes }}</td>
|
||||
<td class="players-tile__cell">{{ player.score }}</td>
|
||||
<td class="players-tile__cell">{{ !player.isIdle ? 'online' : player.lastLoggedIn === 0 ? '-' : datetime(player.lastLoggedIn) }}</td>
|
||||
</tr>
|
||||
@ -42,7 +42,7 @@ const emit = defineEmits(['update'])
|
||||
|
||||
const { $t } = useI18n({
|
||||
name: { en: 'Name', de: 'Name' },
|
||||
'num-quotes': { en: '# quotes', de: '# Quotes' },
|
||||
'num-quotes': { en: '# quotes', de: '# Aussagen gespielt' },
|
||||
'score': { en: 'Score', de: 'Score' },
|
||||
'last-logged-in': { en: 'last logged in', de: 'zuletzt eingeloggt' },
|
||||
})
|
||||
@ -135,7 +135,7 @@ const playerDialogSubmit = async (action: ButtonAction): Promise<void> => {
|
||||
}
|
||||
|
||||
&__cell {
|
||||
padding-right: 8px;
|
||||
padding-right: 16px;
|
||||
}
|
||||
|
||||
&__is-gamemaster {
|
||||
|
1
client/src/composables/engine.d.ts
vendored
1
client/src/composables/engine.d.ts
vendored
@ -18,6 +18,7 @@ export type PlayerInfo = PlayerEdit & {
|
||||
lastLoggedIn: number
|
||||
isPlaying: boolean
|
||||
numQuotes: number
|
||||
numQuotesPlayed: number
|
||||
role: Role
|
||||
}
|
||||
|
||||
|
@ -24,6 +24,7 @@ await useAuth().authenticateAndLoadUserInfo(['admin'])
|
||||
|
||||
&__tiles {
|
||||
display: flex;
|
||||
margin: 24px;
|
||||
}
|
||||
}
|
||||
</style>
|
@ -42,6 +42,7 @@ updateGameinfo()
|
||||
|
||||
&__tiles {
|
||||
display: flex;
|
||||
margin: 24px;
|
||||
}
|
||||
|
||||
&__tiles-spacer {
|
||||
|
@ -5,7 +5,15 @@ func (gm *Game) GetGameInfo() *GameInfoJson {
|
||||
|
||||
for i := range gameInfo.Players {
|
||||
quotes := gm.getQuotesInfoByUserId(gameInfo.Players[i].Id)
|
||||
numPlayed := 0
|
||||
for j := range quotes {
|
||||
if quotes[j].IsPlayed {
|
||||
numPlayed++
|
||||
}
|
||||
}
|
||||
|
||||
gameInfo.Players[i].NumberOfQuotes = len(quotes)
|
||||
gameInfo.Players[i].NumberOfQuotesPlayed = numPlayed
|
||||
}
|
||||
return gameInfo
|
||||
}
|
||||
|
@ -90,16 +90,17 @@ type QuotesInfo struct {
|
||||
}
|
||||
|
||||
type PlayerInfoJson struct {
|
||||
Id string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Created int64 `json:"created"`
|
||||
LastLoggedIn int64 `json:"lastLoggedIn"`
|
||||
Score int `json:"score"`
|
||||
IsPlaying bool `json:"isPlaying"`
|
||||
IsIdle bool `json:"isIdle"`
|
||||
NumberOfQuotes int `json:"numQuotes"`
|
||||
AuthCode string `json:"authcode,omitempty"`
|
||||
Role string `json:"role"`
|
||||
Id string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Created int64 `json:"created"`
|
||||
LastLoggedIn int64 `json:"lastLoggedIn"`
|
||||
Score int `json:"score"`
|
||||
IsPlaying bool `json:"isPlaying"`
|
||||
IsIdle bool `json:"isIdle"`
|
||||
NumberOfQuotes int `json:"numQuotes"`
|
||||
NumberOfQuotesPlayed int `json:"numQuotesPlayed"`
|
||||
AuthCode string `json:"authcode,omitempty"`
|
||||
Role string `json:"role"`
|
||||
}
|
||||
|
||||
type GameInfoJson struct {
|
||||
|
Loading…
Reference in New Issue
Block a user