From 19444b22a7e160b0a5f116febe3be47d17ef86a9 Mon Sep 17 00:00:00 2001 From: migbash <20924663+migbash@users.noreply.github.com> Date: Mon, 22 May 2023 18:14:09 +0100 Subject: [PATCH] issue: #1301; update checks; --- .../home/livescores-v2/Livescores_Main.svelte | 63 +++++++++++++------ 1 file changed, 43 insertions(+), 20 deletions(-) diff --git a/src/lib/components/page/home/livescores-v2/Livescores_Main.svelte b/src/lib/components/page/home/livescores-v2/Livescores_Main.svelte index a6e82615e..15a4fe533 100644 --- a/src/lib/components/page/home/livescores-v2/Livescores_Main.svelte +++ b/src/lib/components/page/home/livescores-v2/Livescores_Main.svelte @@ -106,12 +106,13 @@ COMPONENT JS (w/ TS) ( ): Promise < void > { + + console.log('injectLivescoreData') const liveFixturesMap = $sessionStore?.livescore_now_scoreboard const if_0 = - liveFixturesMap.size == 0 - || fixturesGroupByDateMap.size == 0 + fixturesGroupByDateMap.size == 0 ; if (if_0) { @@ -131,6 +132,10 @@ COMPONENT JS (w/ TS) ]; let fixtureOrphanId: number[] = [] + console.log('fixtureDates', fixtureDates) + console.log('fixturesGroupByDateLiveLeagueMap', fixturesGroupByDateLiveLeagueMap) + console.log('liveFixturesMap', liveFixturesMap) + // for each "target-date" expected to have, // LIVE fixtures, loop; for (const targetDate of fixtureDates) @@ -201,6 +206,8 @@ COMPONENT JS (w/ TS) ); } + console.log('fixtureOrphanId', fixtureOrphanId) + // handle ORPHAN (past-LIVE) fixtures; const if_2 = fixtureOrphanId.length != 0 @@ -244,8 +251,26 @@ COMPONENT JS (w/ TS) if (fixtureOrphanId.includes(fixture.id)) { console.log('orphan', fixture?.id) + const newOrphanData = _fixtureMap.get(fixture?.id?.toString()) + console.log('newOrphanData', newOrphanData) + return { - ..._fixtureMap.get(fixture?.id?.toString()) + ...fixture, + minute: newOrphanData?.minute, + status: newOrphanData?.status, + teams: + { + away: { + name: fixture?.teams?.away?.name, + red_cards: newOrphanData?.teams?.away?.red_cards, + score: newOrphanData?.teams?.away?.score, + }, + home: { + name: fixture?.teams?.home?.name, + red_cards: newOrphanData?.teams?.home?.red_cards, + score: newOrphanData?.teams?.home?.score, + } + } }; } @@ -263,6 +288,11 @@ COMPONENT JS (w/ TS) // IMPORTANT fixturesGroupByDateMap = fixturesGroupByDateMap + + // IMPORTANT + updateLiveInfo() + + // ??? // WIDGET_DATA = WIDGET_DATA; } @@ -367,6 +397,7 @@ COMPONENT JS (w/ TS) `${LV2_W_H_TAG[0]} (in) updateLiveInfo`, LV2_W_H_TAG[1] ); + console.log("(in) updateLiveInfo") numOfFixturesLive = 0 fixturesGroupByDateLiveLeagueMap = new Map() @@ -456,6 +487,8 @@ COMPONENT JS (w/ TS) ) } + fixturesGroupByDateLiveLeagueMap = fixturesGroupByDateLiveLeagueMap + dlog(`${LV2_W_H_TAG[0]} numOfFixturesLive ${numOfFixturesLive}`, LV2_W_H_TAG[1]) dlog(`${LV2_W_H_TAG[0]} liveLeaguesIds.length ${liveLeaguesIds.length}`, LV2_W_H_TAG[1]) dlog(`${LV2_W_H_TAG[0]} liveLeaguesIds ${liveLeaguesIds}`, LV2_W_H_TAG[1]) @@ -623,10 +656,15 @@ COMPONENT JS (w/ TS) /** * @description listens to changes in - * selected date of fixture display; + * selected date (and/or country-bookmaker) + * of fixture display; * Proceeds to update data accordingly; */ - $: if ($sessionStore.livescoreNowSelectedDate) + $: if + ( + $sessionStore.livescoreNowSelectedDate + || $userBetarenaSettings?.country_bookmaker + ) { isShowMore = false targetFixtureDateData() @@ -640,22 +678,7 @@ COMPONENT JS (w/ TS) */ $: if ($sessionStore?.livescore_now_scoreboard) { - dlog($sessionStore?.livescore_now_scoreboard, LV2_W_H_TAG[1]) injectLivescoreData() - updateLiveInfo() - } - - /** - * @description listens to changes in - * user country_bookmaker data session-store; - * Proceeds to update data accordingly; - * NOTE: copy of if ($sessionStore.livescoreNowSelectedDate) [...] - */ - $: if ($userBetarenaSettings?.country_bookmaker) - { - isShowMore = false - targetFixtureDateData() - updateLiveInfo() } // [🐞] [DEV-ONLY]