From bd4b9d38fd4b5720d30b9c8747e71fb3ebe703c1 Mon Sep 17 00:00:00 2001 From: IUrreta Date: Thu, 24 Aug 2023 23:25:48 +0200 Subject: [PATCH 01/65] comment of some files --- front/index.html | 1 - front/js/performance.js | 46 ++++++++++++++++++-- front/js/renderer.js | 93 +++++++++++++++++++++++++++++------------ front/js/stats.js | 65 ++++++++++++++++++++++++++-- main.js | 2 +- 5 files changed, 172 insertions(+), 35 deletions(-) diff --git a/front/index.html b/front/index.html index e3563466..cfec5996 100644 --- a/front/index.html +++ b/front/index.html @@ -9,7 +9,6 @@ - Database Editor for F1 Manager 23 diff --git a/front/js/performance.js b/front/js/performance.js index c1a1c1a3..154b27b2 100644 --- a/front/js/performance.js +++ b/front/js/performance.js @@ -11,6 +11,9 @@ let teamSelected; let engineSelected; let teamEngineSelected; +/** + * Pills that manage engines and teams screens and lists + */ teamsPill.addEventListener("click",function () { manageTeamsEngines("show","hide") document.querySelector(".engines-show").classList.add("d-none") @@ -25,6 +28,10 @@ enginesPill.addEventListener("click",function () { removeSelected() }) +/** + * manages if to show or hide teams/engines list + * @param {Array} divs state of the list divs of engines and teams + */ function manageTeamsEngines(...divs) { divsTeamsArray.forEach(function (div,index) { if (divs[index] === "show") { @@ -36,6 +43,10 @@ function manageTeamsEngines(...divs) { }) } +/** + * Manages the engine stats for all manufacturers + * @param {Object} msg engine stats for all manufacturers + */ function manage_engineStats(msg) { msg.forEach(function (elem) { let engineId = elem[0] @@ -48,6 +59,11 @@ function manage_engineStats(msg) { }) } +/** + * Places the stats engineStats of engineid in its div + * @param {string} engineId if of the engine to place the stats in + * @param {string} engineStats string with all the stats of the engineid manufacturer + */ function place_engineStats(engineId,engineStats) { var element = document.querySelector('[data-engineId="' + engineId + '"]'); element.setAttribute('data-stats',""); @@ -56,6 +72,9 @@ function place_engineStats(engineId,engineStats) { } } +/** + * removes the team or engine selected anc changes the icon if necesssary + */ function removeSelected() { let elemsSelected = document.querySelectorAll('.selected'); elemsSelected.forEach(item => { @@ -75,8 +94,9 @@ function removeSelected() { }); } - - +/** + * eventListeners for all teams and engines + */ document.querySelectorAll(".team").forEach(function (elem) { elem.addEventListener("click",function () { removeSelected() @@ -98,6 +118,10 @@ document.querySelectorAll(".engine").forEach(function (elem) { }) }) +/** + * Puts the bars of the engine to their appropiate values + * @param {div} div element of the dom that contains the stats of the engine + */ function resetBarsEngines(div) { let statsString = div.dataset.stats var statsArray = statsString.split(' ').map(function (item) { @@ -109,6 +133,9 @@ function resetBarsEngines(div) { }) } +/** + * resets all bars to 0 + */ function resetBars() { document.querySelectorAll(".custom-progress").forEach(function (elem) { elem.dataset.progress = 0 @@ -116,6 +143,9 @@ function resetBars() { }) } +/** + * eventListeners for the confirm button for engines and teams + */ document.getElementById("confirmEnginebtn").addEventListener("click",function () { let performanes = ""; let progresses = "" @@ -156,7 +186,9 @@ document.getElementById("confirmPerformancebtn").addEventListener("click",functi socket.send(JSON.stringify(dataPerformance)) }) - +/** + * eventlisteners for the buttons to add or remove from a bar, depending on if its an engine bar or team + */ document.querySelectorAll(".bi-dash-circle").forEach(function (elem) { elem.addEventListener("click",function () { let performanceArea = elem.parentNode.parentNode @@ -200,6 +232,9 @@ document.querySelectorAll(".bi-plus-circle").forEach(function (elem) { }) }) +/** + * eventListeners on Alpine and AT teams and Renault engine to change the icon + */ document.getElementById("alpineTeam").addEventListener("click",function () { document.getElementById("alpineTeam").firstElementChild.classList.add("d-none") document.getElementById("alpineTeam").children[1].classList.remove("d-none") @@ -215,6 +250,11 @@ document.getElementById("renaultengine").addEventListener("click",function () { document.getElementById("renaultengine").children[1].classList.remove("d-none") }) +/** + * Manages the progression of the bars + * @param {div} bar bar that is about to be edited + * @param {int} progress number that determines the progress of the bar + */ function manage_bar(bar,progress) { if (bar.dataset.type === "engine") { let whiteDiv = bar.querySelector(".white-part") diff --git a/front/js/renderer.js b/front/js/renderer.js index c8db1368..dce060cf 100644 --- a/front/js/renderer.js +++ b/front/js/renderer.js @@ -1,5 +1,8 @@ const socket = new WebSocket('ws://localhost:8765/'); +/** + * When the socket is opened sends a connect message to the backend + */ socket.onopen = () => { //console.log('Conexión establecida.'); let data = { @@ -21,6 +24,9 @@ const parchModalTitle = document.getElementById("patchModalTitle") const repoOwner = 'IUrreta'; const repoName = 'DatabaseEditor'; +/** + * Fetches the version from the version.conf file + */ fetch('./../launcher/version.conf') .then(response => response.text()) .then(version => { @@ -30,6 +36,9 @@ fetch('./../launcher/version.conf') getPatchNotes() }); +/** + * get the patch notes from the actual version fro the github api + */ async function getPatchNotes() { try { if (versionNow.slice(-3) !== "dev") { @@ -84,14 +93,15 @@ document.addEventListener('DOMContentLoaded',function () { let divBlocking = 1; - - let connectionTimeout = setTimeout(() => { update_notifications("Could not connect with backend",true) manage_status(0) },4000); - + /** + * Handles the receiving end from the messages sent from backend + * @param {string} event the message tha tcomes fro the backend + */ socket.onmessage = (event) => { // const mensaje = event.data; // console.log('Mensaje recibido: ' + event.data); @@ -137,10 +147,17 @@ document.addEventListener('DOMContentLoaded',function () { }; + /** + * Opens the log file + */ logButton.addEventListener("click",function () { window.location.href = '../log.txt'; }) + /** + * Manages the look of the status icon in the footer + * @param {int} state state of the connection with backend + */ function manage_status(state) { if (state == 1) { status.classList.remove("awaiting") @@ -155,6 +172,9 @@ document.addEventListener('DOMContentLoaded',function () { } } + /** + * Checks with the github api if there is a newer version of the tool + */ function check_version() { fetch(`https://api.github.com/repos/${repoOwner}/${repoName}/tags`) .then(response => response.json()) @@ -217,6 +237,10 @@ document.addEventListener('DOMContentLoaded',function () { }); } + /** + * Check if the tool was installed through git or not + * @returns {bool} If the tool was installed through git or zip + */ function checkGit() { let dir = './'; // Cambia esto a la ruta de tu herramienta let res = false; @@ -229,6 +253,9 @@ document.addEventListener('DOMContentLoaded',function () { } } + /** + * Adds the spinner informing of updating state + */ function addSpinner() { let statusDiv = document.querySelector('.status'); @@ -243,6 +270,9 @@ document.addEventListener('DOMContentLoaded',function () { statusDiv.insertBefore(outsideDiv,statusDiv.children[2]); } + /** + * Manages the actions of the update button + */ function updateButton() { let repoPath = './'; let git = simpleGit(repoPath); @@ -275,7 +305,10 @@ document.addEventListener('DOMContentLoaded',function () { } - + /** + * Manages the state of the calendar blocking div in case it cannot be modified + * @param {string} info If the calendar has had major changes or not + */ function manage_calendarDiv(info) { if (info[0] === "1") { document.getElementById("calendarBlockDiv").className = "blocking-div d-none" @@ -286,6 +319,10 @@ document.addEventListener('DOMContentLoaded',function () { } } + /** + * Places all the values for the modal that just openend + * @param {Object} info values for the contract modal that just opened + */ function manage_modal(info) { document.querySelectorAll(".rounded-input").forEach(function (elem,index) { elem.value = info[index] @@ -293,6 +330,11 @@ document.addEventListener('DOMContentLoaded',function () { } + /** + * Places and manages the notifications that appear in the tool + * @param {string} noti message of the notification + * @param {bool} error if the notification is an error or not + */ function update_notifications(noti,error) { let newNoti; newNoti = document.createElement('div'); @@ -313,7 +355,10 @@ document.addEventListener('DOMContentLoaded',function () { } } - + /** + * Adds the saves that the backend detected to the dropdown of saves + * @param {Object} savesArray contains the list of saves that the backend was able to find + */ function load_saves(savesArray) { for (let i = 1; i < savesArray.length; i++) { let elem = savesArray[i] @@ -331,6 +376,9 @@ document.addEventListener('DOMContentLoaded',function () { listenersStaffGroups() } + /** + * Adds the eventListeners to each element of the save dropdown + */ function listenersSaves() { document.querySelectorAll('#dropdownMenu a').forEach(item => { item.addEventListener("click",function () { @@ -353,6 +401,9 @@ document.addEventListener('DOMContentLoaded',function () { }); } + /** + * Adds eventListeners to all the elements of the staff dropdown + */ function listenersStaffGroups() { document.querySelectorAll('#staffMenu a').forEach(item => { item.addEventListener("click",function () { @@ -394,27 +445,9 @@ document.addEventListener('DOMContentLoaded',function () { }); } - function change_elegibles(divID) { - document.querySelectorAll(".elegible").forEach(function (elem) { - elem.classList.remove("elegible") - - }) - let divStats = document.getElementById(divID) - divStats.querySelectorAll(".custom-input-number").forEach(function (elem) { - elem.classList.add("elegible") - }) - if (divID === "driverStats") { - document.getElementById("growthInput").classList.add("elegible") - document.getElementById("agressionInput").classList.add("elegible") - - } - document.querySelectorAll(".main-panel-stats").forEach(function (elem) { - elem.className = "main-panel-stats d-none" - }) - divStats.classList.remove("d-none") - - } - + /** + * checks if a save and a script have been selected to unlock the tool + */ function check_selected() { if (isSaveSelected == 1 && scriptSelected == 1 && divBlocking == 1) { document.getElementById("blockDiv").className = "d-none" @@ -423,6 +456,9 @@ document.addEventListener('DOMContentLoaded',function () { } } + /** + * Pills and their eventListeners + */ driverTransferPill.addEventListener("click",function () { manageScripts("show","hide","hide","hide") scriptSelected = 1 @@ -448,7 +484,10 @@ document.addEventListener('DOMContentLoaded',function () { check_selected() }) - + /** + * Manages the stats of the divs associated with the pills + * @param {Array} divs array of state of the divs + */ function manageScripts(...divs) { scriptsArray.forEach(function (div,index) { if (divs[index] === "show") { diff --git a/front/js/stats.js b/front/js/stats.js index 7b995f47..ab03b304 100644 --- a/front/js/stats.js +++ b/front/js/stats.js @@ -3,12 +3,19 @@ let statPanelShown = 0; let typeOverall = "driver"; let typeEdit; +/** + * Removes all the staff from their list + */ function removeStatsDrivers() { document.querySelectorAll(".staff-list").forEach(function(elem){ elem.innerHTML = "" }) } +/** + * Places the drivers that the backend fetched on the driver list + * @param {Object} driversArray Object with all the drivers that the backend fetched + */ function place_drivers_editStats(driversArray) { let divPosition; driversArray.forEach((driver) => { @@ -72,7 +79,10 @@ function place_drivers_editStats(driversArray) { }); }); } - +/** + * Places the staff that the backend fetched on their respective staff list + * @param {Object} staffArray Object with all the staff that the backend fetched + */ function place_staff(staffArray) { let divPosition; @@ -152,6 +162,9 @@ function place_staff(staffArray) { } +/** + * changes the overall placed in the overall square + */ function recalculateOverall() { let stats = "" document.querySelectorAll(".elegible").forEach(function (elem) { @@ -171,6 +184,9 @@ function recalculateOverall() { } +/** + * eventListeenr for the confirm button for the stats + */ document.getElementById("confirmbtn").addEventListener("click",function () { let stats = "" document.querySelectorAll(".elegible").forEach(function (elem) { @@ -202,6 +218,11 @@ document.getElementById("confirmbtn").addEventListener("click",function () { }) +/** + * Gets the named with a space between name and lastname + * @param {*} html element with the name bad formatted + * @returns the name formatted + */ function getName(html) { let name = "" html.querySelectorAll('span').forEach(function(elem){ @@ -214,7 +235,12 @@ function getName(html) { } - +/** + * Mathematic calculations to get a staff's overall value + * @param {string} stats all stats spearated by a space between them + * @param {string} type type of staff + * @returns the number of his overall value + */ function calculateOverall(stats, type) { let statsArray = stats.split(" ").map(Number); let rating; @@ -243,6 +269,10 @@ function calculateOverall(stats, type) { return Math.round(rating) } +/** + * Loads the stats into the input numbers + * @param {div} div div of the staff that is about to be edited + */ function load_stats(div) { let statsArray = div.dataset.stats.split(" ").map(Number); @@ -252,7 +282,11 @@ function load_stats(div) { }); } - +/** + * Generates the name title on the main panel of the edit stats + * @param {div} html div from the staff selected + * @returns the html necessary to put in the name with correct color + */ function manage_stats_title(html) { let colorClass ="" if(html.dataset.teamid != 0){ @@ -266,4 +300,29 @@ function manage_stats_title(html) { return name; +} + +/** + * Changes the input number that are taken into account to change stats + * @param {div} divID div that contains the correct input numbers + */ +function change_elegibles(divID) { + document.querySelectorAll(".elegible").forEach(function (elem) { + elem.classList.remove("elegible") + + }) + let divStats = document.getElementById(divID) + divStats.querySelectorAll(".custom-input-number").forEach(function (elem) { + elem.classList.add("elegible") + }) + if (divID === "driverStats") { + document.getElementById("growthInput").classList.add("elegible") + document.getElementById("agressionInput").classList.add("elegible") + + } + document.querySelectorAll(".main-panel-stats").forEach(function (elem) { + elem.className = "main-panel-stats d-none" + }) + divStats.classList.remove("d-none") + } \ No newline at end of file diff --git a/main.js b/main.js index a3931b8c..d8c102d6 100644 --- a/main.js +++ b/main.js @@ -23,7 +23,7 @@ function createWindow () { mainWindow.removeMenu() // Open the DevTools. - // mainWindow.webContents.openDevTools() + mainWindow.webContents.openDevTools() } From a2ec5fefc76c2a50f5d74cb52250c83ce7c7bd02 Mon Sep 17 00:00:00 2001 From: IUrreta Date: Fri, 25 Aug 2023 12:11:28 +0200 Subject: [PATCH 02/65] fixed bug of no albon --- back/back.py | 30 +++++++++++++++++------------- front/js/renderer.js | 1 - 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/back/back.py b/back/back.py index 4e59e2cd..6a88402f 100644 --- a/back/back.py +++ b/back/back.py @@ -63,6 +63,7 @@ async def handle_command(message): await send_message_to_client(data_json_calendar) create_backup(path, save) + elif type =="hire": argument = "hire " + message["driverID"] + " " + str(message["teamID"]) + " " + message["position"] + " " + message["salary"] + " " + message["signBonus"] + " " + message["raceBonus"] + " " + message["raceBonusPos"] + " " + message["year"] run_trasnsfer(argument) @@ -180,7 +181,7 @@ async def handle_client(websocket, path): client = None conn.commit() conn.close() - + async def start_server(): server = await websockets.serve(handle_client, "localhost", 8765) @@ -188,7 +189,7 @@ async def start_server(): await server.wait_closed() server.close() - + def create_backup(originalFIle, saveFile): backup_path = "./../backup" if not os.path.exists(backup_path): @@ -216,7 +217,7 @@ def fetch_engines(): lista.append(engineInfo) return lista - + async def main(): @@ -236,17 +237,16 @@ def fetch_staff(): result = format_names_get_stats(tupla, "staff"+str(tupla[4])) formatted_tuples.append(result) - print(formatted_tuples) return formatted_tuples def fetch_info(): - drivers = cursor.execute('SELECT bas.FirstName, bas.LastName, bas.StaffID, con.TeamID, con.PosInTeam FROM Staff_BasicData bas JOIN Staff_DriverData dri ON bas.StaffID = dri.StaffID LEFT JOIN Staff_Contracts con ON dri.StaffID = con.StaffID WHERE ContractType = 0 OR ContractType IS NULL;').fetchall() + drivers = cursor.execute('SELECT bas.FirstName, bas.LastName, bas.StaffID, con.TeamID, con.PosInTeam, MIN(con.ContractType) AS MinContractType FROM Staff_BasicData bas JOIN Staff_DriverData dri ON bas.StaffID = dri.StaffID LEFT JOIN Staff_Contracts con ON dri.StaffID = con.StaffID GROUP BY bas.FirstName, bas.LastName, bas.StaffID, con.TeamID;').fetchall() formatted_tuples = [] for tupla in drivers: result = format_names_get_stats(tupla, "driver") formatted_tuples.append(result) - + return formatted_tuples def check_claendar(): @@ -261,22 +261,26 @@ def check_claendar(): resultCalendar = "1" if are_all_numbers_present else "0" return resultCalendar - + def format_names_get_stats(name, type): nombre_pattern = r'StaffName_Forename_(Male|Female)_(\w+)' apellido_pattern = r'StaffName_Surname_(\w+)' - + nombre_match = re.search(nombre_pattern, name[0]) apellido_match = re.search(apellido_pattern, name[1]) - + nombre = remove_number(nombre_match.group(2)) apellido = remove_number(apellido_match.group(1)) name_formatted = f"{nombre} {apellido}" team_id = name[3] if name[3] is not None else 0 pos_in_team = name[4] if name[4] is not None else 0 + if type =="driver" and name[5] != 0: + team_id = 0 + pos_in_team = 0 + resultado = (name_formatted, name[2], team_id, pos_in_team) @@ -286,25 +290,25 @@ def format_names_get_stats(name, type): nums = resultado + tuple(stat[0] for stat in stats) + additionalStats return nums - + elif type == "staff1": stats = cursor.execute("SELECT Val FROM Staff_PerformanceStats WHERE StaffID = " + str(name[2]) + " AND StatID IN (0,1,14,15,16,17);").fetchall() nums = resultado + tuple(stat[0] for stat in stats) return nums - + elif type == "staff2": stats = cursor.execute("SELECT Val FROM Staff_PerformanceStats WHERE StaffID = " + str(name[2]) + " AND StatID IN (13,25,43);").fetchall() nums = resultado + tuple(stat[0] for stat in stats) return nums - + elif type == "staff3": stats = cursor.execute("SELECT Val FROM Staff_PerformanceStats WHERE StaffID = " + str(name[2]) + " AND StatID IN (19,20,26,27,28,29,30,31);").fetchall() nums = resultado + tuple(stat[0] for stat in stats) return nums - + elif type == "staff4": stats = cursor.execute("SELECT Val FROM Staff_PerformanceStats WHERE StaffID = " + str(name[2]) + " AND StatID IN (11,22,23,24);").fetchall() nums = resultado + tuple(stat[0] for stat in stats) diff --git a/front/js/renderer.js b/front/js/renderer.js index dce060cf..a1034097 100644 --- a/front/js/renderer.js +++ b/front/js/renderer.js @@ -129,7 +129,6 @@ document.addEventListener('DOMContentLoaded',function () { create_races() } else if (message[0] === "Staff Fetched") { - console.log(message) place_staff(message.slice(1)) } else if (message[0] === "Calendar fetched") { From d571c24bedc607a9b343209c3280a19b8c84190c Mon Sep 17 00:00:00 2001 From: Ignacio Date: Wed, 30 Aug 2023 19:25:53 +0200 Subject: [PATCH 03/65] results fetched, formatted and sent --- back/back.py | 33 +++++++++++++++++++++++++++++++++ front/js/renderer.js | 5 ++++- main.js | 2 +- 3 files changed, 38 insertions(+), 2 deletions(-) diff --git a/back/back.py b/back/back.py index 6a88402f..3a75d2aa 100644 --- a/back/back.py +++ b/back/back.py @@ -62,6 +62,10 @@ async def handle_command(message): data_json_calendar = json.dumps(allowCalendar) await send_message_to_client(data_json_calendar) create_backup(path, save) + results = fetch_seasonResults() + results.insert(0, "Results fetched") + data_json_results = json.dumps(results) + await send_message_to_client(data_json_results) elif type =="hire": @@ -239,6 +243,35 @@ def fetch_staff(): return formatted_tuples +def fetch_seasonResults(): + year = cursor.execute("SELECT CurrentSeason FROM Player_State").fetchone() + drivers = cursor.execute("SELECT DriverID FROM Races_DriverStandings WHERE RaceFormula = 1 AND SeasonID = " + str(year[0])).fetchall() + seasonResults = [] + for driver in drivers: + results = cursor.execute("SELECT DriverID, TeamID, FinishingPos, Points FROM Races_Results WHERE Season = " + str(year[0]) + " AND DriverID = " + str(driver[0])).fetchall() + teamID = results[0][1] + driverName = cursor.execute("SELECT FirstName, LastName FROM Staff_BasicData WHERE StaffID = " + str(driver[0])).fetchone() + seasonResults.append(format_seasonResults(results, driverName, teamID)) + return seasonResults + + +def format_seasonResults(results, driver, teamID): + nombre_pattern = r'StaffName_Forename_(Male|Female)_(\w+)' + apellido_pattern = r'StaffName_Surname_(\w+)' + + nombre_match = re.search(nombre_pattern, driver[0]) + apellido_match = re.search(apellido_pattern, driver[1]) + + nombre = remove_number(nombre_match.group(2)) + apellido = remove_number(apellido_match.group(1)) + name_formatted = f"{nombre} {apellido}" + + formatred_results = [(result[-2], result[-1]) for result in results] + formatred_results.insert(0, teamID) + formatred_results.insert(0, name_formatted) + return formatred_results + + def fetch_info(): drivers = cursor.execute('SELECT bas.FirstName, bas.LastName, bas.StaffID, con.TeamID, con.PosInTeam, MIN(con.ContractType) AS MinContractType FROM Staff_BasicData bas JOIN Staff_DriverData dri ON bas.StaffID = dri.StaffID LEFT JOIN Staff_Contracts con ON dri.StaffID = con.StaffID GROUP BY bas.FirstName, bas.LastName, bas.StaffID, con.TeamID;').fetchall() diff --git a/front/js/renderer.js b/front/js/renderer.js index f080d641..19fe0403 100644 --- a/front/js/renderer.js +++ b/front/js/renderer.js @@ -130,7 +130,10 @@ document.addEventListener('DOMContentLoaded',function () { else if (message[0] === "Contract fetched") { manage_modal(message.slice(1)[0]) } - if (message[0] !== "Calendar fetched" && message[0] !== "Contract fetched" && message[0] != "Staff Fetched" && message[0] != "Engines fetched") update_notifications(message[0],false) + else if(message[0] === "Results fetched"){ + console.log(message.slice(1)) + } + if (message[0] !== "Calendar fetched" && message[0] !== "Contract fetched" && message[0] != "Staff Fetched" && message[0] != "Engines fetched" && message[0] != "Results fetched") update_notifications(message[0],false) } diff --git a/main.js b/main.js index a3931b8c..d8c102d6 100644 --- a/main.js +++ b/main.js @@ -23,7 +23,7 @@ function createWindow () { mainWindow.removeMenu() // Open the DevTools. - // mainWindow.webContents.openDevTools() + mainWindow.webContents.openDevTools() } From 29f59d4187f7ce267223737184e10f9ea30f5149 Mon Sep 17 00:00:00 2001 From: Ignacio Date: Thu, 31 Aug 2023 15:18:22 +0200 Subject: [PATCH 04/65] first decent version --- back/back.py | 6 +++++- front/index.html | 16 ++++++++++++++++ front/js/renderer.js | 26 +++++++++++++++++++------ front/js/seasonViewer.js | 41 ++++++++++++++++++++++++++++++++++++++++ front/styles.css | 23 ++++++++++++++++++++++ launcher/version.conf | 2 +- package-lock.json | 13 ++++++++++++- package.json | 3 ++- 8 files changed, 120 insertions(+), 10 deletions(-) create mode 100644 front/js/seasonViewer.js diff --git a/back/back.py b/back/back.py index 3a75d2aa..0fad532e 100644 --- a/back/back.py +++ b/back/back.py @@ -288,12 +288,16 @@ def check_claendar(): season_events = cursor.execute("SELECT TrackID FROM Races WHERE SeasonID = " + str(day_season[1])).fetchall() tuple_numbers = {num for tpl in season_events for num in tpl} + events_ids =[] + for tupla in season_events: + events_ids.append(tupla[0]) + are_all_numbers_present = all(num in tuple_numbers for num in default_tracks) # Definir la variable resultante resultCalendar = "1" if are_all_numbers_present else "0" - return resultCalendar + return (resultCalendar, events_ids) def format_names_get_stats(name, type): diff --git a/front/index.html b/front/index.html index b681bd7d..0eea25ed 100644 --- a/front/index.html +++ b/front/index.html @@ -7,6 +7,7 @@ + @@ -104,6 +105,9 @@

by @i