Skip to content
This repository has been archived by the owner on May 6, 2024. It is now read-only.

Commit

Permalink
Merge pull request #529 from realgolf/527-bug-archive-and-games-do-no…
Browse files Browse the repository at this point in the history
…t-load-anymore

527 bug archive and games do not load anymore
  • Loading branch information
MoinJulian committed May 6, 2024
2 parents 31ec9b5 + 50c72ca commit 3a15ea5
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 20 deletions.
23 changes: 13 additions & 10 deletions src/lib/components/Archive/Game.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,22 @@
export let is_over: boolean;
const dataObj = JSON.parse(data);
let interleavedData: { color: string; value: string }[] = [];
// Separate data arrays for each color
const redData = dataObj.find((obj: { color: string }) => obj.color === 'red')?.data || [];
const blueData = dataObj.find((obj: { color: string }) => obj.color === 'blue')?.data || [];
// Check if "4winning" is not included in teams
if (teams.includes('4winning')) {
// Separate data arrays for each color
const redData = dataObj.find((obj: { color: string }) => obj.color === 'red')?.data || [];
const blueData = dataObj.find((obj: { color: string }) => obj.color === 'blue')?.data || [];
// Interleave the data arrays
let interleavedData: { color: string; value: string }[] = [];
for (let i = 0; i < Math.max(redData.length, blueData.length); i++) {
if (i < redData.length) interleavedData.push({ color: 'red', value: redData[i] });
if (i < blueData.length) interleavedData.push({ color: 'blue', value: blueData[i] });
}
// Interleave the data arrays
for (let i = 0; i < Math.max(redData.length, blueData.length); i++) {
if (i < redData.length) interleavedData.push({ color: 'red', value: redData[i] });
if (i < blueData.length) interleavedData.push({ color: 'blue', value: blueData[i] });
}
console.log(interleavedData);
console.log(interleavedData);
}
</script>

<div class="game">
Expand Down
23 changes: 13 additions & 10 deletions src/lib/components/Public/Games/Game.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,23 @@
export let show_confirmation: boolean;
export let user_username: string | null | undefined;
// Interleave the data arrays
let interleavedData: { color: string; value: string }[] = [];
const dataObj = JSON.parse(data);
let interleavedData: { color: string; value: string }[] = [];
// Separate data arrays for each color
const redData = dataObj.find((obj: { color: string }) => obj.color === 'red')?.data || [];
const blueData = dataObj.find((obj: { color: string }) => obj.color === 'blue')?.data || [];
// Check if "4winning" is not included in teams
if (teams.includes('4winning')) {
// Separate data arrays for each color
const redData = dataObj.find((obj: { color: string }) => obj.color === 'red')?.data || [];
const blueData = dataObj.find((obj: { color: string }) => obj.color === 'blue')?.data || [];
for (let i = 0; i < Math.max(redData.length, blueData.length); i++) {
if (i < redData.length) interleavedData.push({ color: 'red', value: redData[i] });
if (i < blueData.length) interleavedData.push({ color: 'blue', value: blueData[i] });
}
// Interleave the data arrays
for (let i = 0; i < Math.max(redData.length, blueData.length); i++) {
if (i < redData.length) interleavedData.push({ color: 'red', value: redData[i] });
if (i < blueData.length) interleavedData.push({ color: 'blue', value: blueData[i] });
}
console.log(interleavedData);
console.log(interleavedData);
}
function extractDomain(url: string): string | null {
try {
Expand Down

0 comments on commit 3a15ea5

Please sign in to comment.