@golstats/gsc-lineups-reports 1.0.6 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
package/src/App.vue
CHANGED
|
@@ -6,8 +6,41 @@ import GSCMatchSummary from './components/gsc-lineups-reports.vue'
|
|
|
6
6
|
<div style="max-width: 968px; height: auto">
|
|
7
7
|
<GSCMatchSummary
|
|
8
8
|
selected-option="Prematch"
|
|
9
|
-
:game="{ game_id:
|
|
9
|
+
:game="{ game_id: 90434, season_id: 2010, prematch: true }"
|
|
10
10
|
:gamehome="{ game_id: 90564, season_id: 2015, prematch: true }"
|
|
11
|
+
:game-number="2"
|
|
12
|
+
:last-games="{
|
|
13
|
+
home_team: 14,
|
|
14
|
+
last_home_games: [
|
|
15
|
+
{
|
|
16
|
+
season_id: 2010,
|
|
17
|
+
game_id: 90420,
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
season_id: 2010,
|
|
21
|
+
game_id: 90412,
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
season_id: 2010,
|
|
25
|
+
game_id: 90406,
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
visiting_team: 12,
|
|
29
|
+
last_visiting_games: [
|
|
30
|
+
{
|
|
31
|
+
season_id: 2010,
|
|
32
|
+
game_id: 90422,
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
season_id: 2010,
|
|
36
|
+
game_id: 90417,
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
season_id: 2010,
|
|
40
|
+
game_id: 90403,
|
|
41
|
+
},
|
|
42
|
+
],
|
|
43
|
+
}"
|
|
11
44
|
:gameaway="{ game_id: 90565, season_id: 2015, prematch: true }"
|
|
12
45
|
/>
|
|
13
46
|
</div>
|
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div>
|
|
3
3
|
<!-- Aquí va tu contenido -->
|
|
4
|
-
<GSCLineups
|
|
4
|
+
<GSCLineups
|
|
5
|
+
:game="game"
|
|
6
|
+
:gamehome="lastHomeGame"
|
|
7
|
+
:gameaway="lastVisitingGame"
|
|
8
|
+
:selected-option="selectedOption"
|
|
9
|
+
/>
|
|
5
10
|
</div>
|
|
6
11
|
</template>
|
|
7
12
|
|
|
8
13
|
<script setup>
|
|
9
|
-
import { defineProps } from 'vue'
|
|
14
|
+
import { defineProps, computed } from 'vue'
|
|
10
15
|
import GSCLineups from '@/components/gsc-lineups.vue'
|
|
11
16
|
|
|
12
|
-
defineProps({
|
|
17
|
+
const props = defineProps({
|
|
13
18
|
game: {
|
|
14
19
|
type: Object,
|
|
15
20
|
default: () => {},
|
|
@@ -18,6 +23,14 @@ defineProps({
|
|
|
18
23
|
type: Object,
|
|
19
24
|
default: () => {},
|
|
20
25
|
},
|
|
26
|
+
gameNumber: {
|
|
27
|
+
type: Number,
|
|
28
|
+
default: 0,
|
|
29
|
+
},
|
|
30
|
+
lastGames: {
|
|
31
|
+
type: Object,
|
|
32
|
+
default: () => {},
|
|
33
|
+
},
|
|
21
34
|
gameaway: {
|
|
22
35
|
type: Object,
|
|
23
36
|
default: () => {},
|
|
@@ -28,6 +41,57 @@ defineProps({
|
|
|
28
41
|
},
|
|
29
42
|
})
|
|
30
43
|
|
|
44
|
+
// Función para validar y formatear el objeto del juego
|
|
45
|
+
const formatGameObject = (gameData) => {
|
|
46
|
+
if (!gameData) {
|
|
47
|
+
return {
|
|
48
|
+
game_id: null,
|
|
49
|
+
season_id: null,
|
|
50
|
+
prematch: true,
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Asegurar que tenga el formato correcto
|
|
55
|
+
return {
|
|
56
|
+
game_id: gameData.game_id || null,
|
|
57
|
+
season_id: gameData.season_id || null,
|
|
58
|
+
prematch: gameData.prematch !== undefined ? gameData.prematch : true,
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// Computed properties para obtener los juegos basados en gameNumber
|
|
63
|
+
const lastHomeGame = computed(() => {
|
|
64
|
+
// Validar que gameNumber sea 1, 2 o 3
|
|
65
|
+
if (![1, 2, 3].includes(props.gameNumber)) {
|
|
66
|
+
return formatGameObject(null)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
if (props.selectedOption === 'Prematch' && props.lastGames && props.lastGames.last_home_games) {
|
|
70
|
+
const gameIndex = props.gameNumber - 1 // Convertir a índice basado en 0
|
|
71
|
+
const gameData = props.lastGames.last_home_games[gameIndex]
|
|
72
|
+
return formatGameObject(gameData)
|
|
73
|
+
}
|
|
74
|
+
return formatGameObject(null)
|
|
75
|
+
})
|
|
76
|
+
|
|
77
|
+
const lastVisitingGame = computed(() => {
|
|
78
|
+
// Validar que gameNumber sea 1, 2 o 3
|
|
79
|
+
if (![1, 2, 3].includes(props.gameNumber)) {
|
|
80
|
+
return formatGameObject(null)
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
if (
|
|
84
|
+
props.selectedOption === 'Prematch' &&
|
|
85
|
+
props.lastGames &&
|
|
86
|
+
props.lastGames.last_visiting_games
|
|
87
|
+
) {
|
|
88
|
+
const gameIndex = props.gameNumber - 1 // Convertir a índice basado en 0
|
|
89
|
+
const gameData = props.lastGames.last_visiting_games[gameIndex]
|
|
90
|
+
return formatGameObject(gameData)
|
|
91
|
+
}
|
|
92
|
+
return formatGameObject(null)
|
|
93
|
+
})
|
|
94
|
+
|
|
31
95
|
// Función para manejar el evento onOpenProfile
|
|
32
96
|
const onOpenProfile = (data) => {
|
|
33
97
|
console.log('Perfil abierto:', data)
|