-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgetData.js
More file actions
28 lines (25 loc) · 1.04 KB
/
getData.js
File metadata and controls
28 lines (25 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
let matchData = localStorage.matchData ? JSON.parse(localStorage.matchData) : [];
let pitData = [];
function fetchMatchData(sheetName = 'Sheet1') {
const url = 'https://script.google.com/macros/s/AKfycbz-takae_7ZtVD_luRtAAhAQJKflLwT6JU5S_PaLo_qfxmUs0TQ3hXeLq7MBo_qHzdA/exec'; // Replace with the URL you copied from the deployment
const params = new URLSearchParams({ sheet: sheetName });
document.getElementById("rankings").innerHTML = `<div class="Loader"></div><h2>Loading data...</h2>`
fetch(`${url}?${params}`)
.then(res => res.json())
.then(data => {
matchData = [];
for(let match of data) {
if(match.Competition === document.getElementById("compSelect").value) {
matchData.push(match)
}
}
localStorage.matchData = JSON.stringify(matchData);
console.log(matchData);
initAnalysis();
})
}
function initAnalysis() {
rankTeams();
}
initAnalysis();
fetchMatchData();