fix(#2956): delete score from matchdescription for 0-0

keep-around/3d3716c8eecddecc93aa1855ad3f52b67b2f7b4b
Andrei Dekterev 3 years ago
parent 5b0fcd0428
commit d6e6644a0a
  1. 27
      src/features/MatchPage/store/hooks/index.tsx
  2. 2
      src/requests/getMatches/types.tsx

@ -22,27 +22,6 @@ import { useMatchData } from './useMatchData'
import { useFiltersPopup } from './useFitersPopup' import { useFiltersPopup } from './useFitersPopup'
import { useTabEvents } from './useTabEvents' import { useTabEvents } from './useTabEvents'
import type { Playlists } from '../../types'
const addScoresFromPlaylists = (
profile: MatchInfo,
playlists: Playlists,
): MatchInfo => (
profile
? {
...profile,
team1: {
...profile?.team1,
score: playlists.score1,
},
team2: {
...profile?.team2,
score: playlists.score2,
},
}
: null
)
export const useMatchPage = () => { export const useMatchPage = () => {
const [matchProfile, setMatchProfile] = useState<MatchInfo>(null) const [matchProfile, setMatchProfile] = useState<MatchInfo>(null)
const { profileId: matchId, sportType } = usePageParams() const { profileId: matchId, sportType } = usePageParams()
@ -91,10 +70,8 @@ export const useMatchPage = () => {
setFullMatchPlaylistDuration, setFullMatchPlaylistDuration,
} = useMatchData(matchProfile) } = useMatchData(matchProfile)
const profile = useMemo( const profile = matchProfile
() => addScoresFromPlaylists(matchProfile, matchPlaylists),
[matchProfile, matchPlaylists],
)
const isStarted = useMemo(() => ( const isStarted = useMemo(() => (
profile?.date profile?.date
? parseDate(profile.date) < new Date() ? parseDate(profile.date) < new Date()

@ -11,7 +11,7 @@ type Team = {
id: number, id: number,
name_eng: string, name_eng: string,
name_rus: string, name_rus: string,
score?: number, score?: number | null,
} }
export type SportInfo = { export type SportInfo = {

Loading…
Cancel
Save