added tick_rate + condition to display chat
All checks were successful
CSGOWTF/csgowtf/pipeline/head This commit looks good

This commit is contained in:
2022-02-03 16:37:42 +01:00
parent 4f27e8dd16
commit 45ab9887cf
2 changed files with 10 additions and 12 deletions

View File

@@ -1,10 +1,10 @@
<template> <template>
<div class="chat-history mt-2"> <div class="chat-history mt-2">
<table class="table table-borderless"> <table v-if="data.chat.length > 0" class="table table-borderless">
<tbody> <tbody>
<tr v-for="(m, id) in data.chat" :key="id"> <tr v-for="(m, id) in data.chat" :key="id">
<td> <td>
{{ ConvertTickToTime(m.tick) }} {{ ConvertTickToTime(m.tick, m.tick_rate) }}
</td> </td>
<td class="td-avatar"> <td class="td-avatar">
<img :class="'team-color-' + m.color" <img :class="'team-color-' + m.color"
@@ -41,6 +41,9 @@
</tr> </tr>
</tbody> </tbody>
</table> </table>
<div v-else>
<h3 class="text-center">No chat available</h3>
</div>
</div> </div>
</template> </template>
@@ -60,9 +63,8 @@ export default {
const getChatHistory = async () => { const getChatHistory = async () => {
const resData = await GetChatHistory(store, store.state.matchDetails.match_id) const resData = await GetChatHistory(store, store.state.matchDetails.match_id)
if (resData !== null) { if (resData !== null)
data.chat = await setPlayer(sortChatHistory(resData)) data.chat = await setPlayer(sortChatHistory(resData))
}
} }
const sortChatHistory = (res = {}) => { const sortChatHistory = (res = {}) => {
@@ -85,7 +87,6 @@ export default {
} }
const setPlayer = async (chat) => { const setPlayer = async (chat) => {
console.log(store.state.matchDetails)
let arr = [] let arr = []
for (const o of chat) { for (const o of chat) {
for (const p of store.state.matchDetails.stats) { for (const p of store.state.matchDetails.stats) {
@@ -102,6 +103,7 @@ export default {
game_ban: p.player.game_ban, game_ban: p.player.game_ban,
game_ban_date: p.player.game_ban_date, game_ban_date: p.player.game_ban_date,
tick: o.tick, tick: o.tick,
tick_rate: store.state.matchDetails.tick_rate !== -1 ? store.state.matchDetails.tick_rate : 64,
all_chat: o.all_chat, all_chat: o.all_chat,
message: o.message message: o.message
}) })

View File

@@ -129,9 +129,9 @@
replace>Damage replace>Damage
</router-link> </router-link>
</li> </li>
<li :title="!data.matchDetails.parsed ? 'This demo has not been parsed' : data.matchDetails.date < 1643410799 ? 'This feature wasn\'t available for this match' : ''" <li :title="!data.matchDetails.parsed ? 'This demo has not been parsed' : ''"
class="list-item nav-item"> class="list-item nav-item">
<router-link :class="!data.matchDetails.parsed ? 'disabled' : data.matchDetails.date < 1643410799 ? 'disabled' : ''" :disabled="!data.matchDetails.parsed" <router-link :class="!data.matchDetails.parsed ? 'disabled' : ''" :disabled="!data.matchDetails.parsed"
:to="'/match/' + data.matchDetails.match_id + '/chat'" class="nav-link" :to="'/match/' + data.matchDetails.match_id + '/chat'" class="nav-link"
replace>Chat replace>Chat
</router-link> </router-link>
@@ -257,12 +257,8 @@ export default {
if (route.fullPath.split('/')[3]) { if (route.fullPath.split('/')[3]) {
const sub = route.fullPath.split('/')[3] const sub = route.fullPath.split('/')[3]
if (matchIdPattern.test(props.match_id)) { if (matchIdPattern.test(props.match_id)) {
if (store.state.matchDetails.date <= 1643410799 && sub === 'chat') {
GoToLink(`/match/${props.match_id}`)
} else
GoToLink(`/match/${props.match_id}/${sub}`) GoToLink(`/match/${props.match_id}/${sub}`)
} } else {
else {
errorHandling(404) errorHandling(404)
} }
} else { } else {