diff --git a/index.html b/index.html index faded32..8d51522 100644 --- a/index.html +++ b/index.html @@ -107,6 +107,10 @@
+ + diff --git a/js/app.js b/js/app.js index 48ad36d..e69de29 100644 --- a/js/app.js +++ b/js/app.js @@ -1,45 +0,0 @@ -// Funkcja do wczytania pliku JSON -async function fetchJSONFile(filePath) { - try { - const response = await fetch(filePath); - if (!response.ok) { - throw new Error(`HTTP error! Status: ${response.status}`); - } - return await response.json(); - } catch (error) { - console.error("Error fetching JSON file:", error); - } -} - -// Funkcja do wczytania pliku class.json -async function loadClasses() { - const classFilePath = '/data/class.json'; - const classes = await fetchJSONFile(classFilePath); - - if (classes) { - console.log('Classes loaded:', classes); - - // Iterowanie po wszystkich klasach i wczytywanie plików z danymi uczniów - for (const classInfo of classes) { - const studentsFilePath = '/data/'+ classInfo.file_path; - const studentsData = await fetchJSONFile(studentsFilePath); - - if (studentsData) { - console.log(`Students loaded for class ${classInfo.class}:`, studentsData); - // Tutaj możesz przechowywać dane lub je przetwarzać według potrzeb - processClassData(classInfo, studentsData); - } - } - } -} - -// Funkcja do przetwarzania danych o klasach i uczniach -function processClassData(classInfo, studentsData) { - console.log(`Class: ${classInfo.class}, Group: ${classInfo.group}, Students Count: ${classInfo.student_count}`); - console.log('Student Data:', studentsData); - - // Możesz tutaj np. wyświetlić dane w interfejsie lub przeprowadzić dodatkowe operacje -} - -// Uruchomienie wczytywania klas -loadClasses(); diff --git a/js/script.js b/js/script.js index 202231a..af91fa6 100644 --- a/js/script.js +++ b/js/script.js @@ -1,3 +1,55 @@ +// Funkcja do wczytania pliku JSON +async function fetchJSONFile(filePath) { + try { + const response = await fetch(filePath); + if (!response.ok) { + throw new Error(`HTTP error! Status: ${response.status}`); + } + return await response.json(); + } catch (error) { + console.error("Error fetching JSON file:", error); + } +} + +// Funkcja do wczytania pliku class.json +async function loadClasses() { + const classFilePath = '/data/class.json'; + const classes = await fetchJSONFile(classFilePath); + + if (classes) { + console.log('Classes loaded:', classes); + + // Iterowanie po wszystkich klasach i wczytywanie plików z danymi uczniów + for (const classInfo of classes) { + const studentsFilePath = '/data/'+ classInfo.file_path; + const studentsData = await fetchJSONFile(studentsFilePath); + + if (studentsData) { + console.log(`Students loaded for class ${classInfo.class}:`, studentsData); + // Tutaj możesz przechowywać dane lub je przetwarzać według potrzeb + processClassData(classInfo, studentsData); + } + } + } +} + +const classData = [] + +// Funkcja do przetwarzania danych o klasach i uczniach +function processClassData(classInfo, studentsData) { + console.log(`Class: ${classInfo.class}, Group: ${classInfo.group}, Students Count: ${classInfo.student_count}`); + console.log('Student Data:', studentsData); + classData.push(studentsData) + // Możesz tutaj np. wyświetlić dane w interfejsie lub przeprowadzić dodatkowe operacje +} + +// Uruchomienie wczytywania klas +loadClasses(); + +// +// +// + let currentDay = 0; const baseDate = new Date(); const studentsData = [ @@ -19,7 +71,22 @@ function showTab(tabName) { } } +async function changeClass() { + await loadClasses() + let classesNames = [] +for (const classInfo of classData) { + console.log(classInfo) + classesNames.push(classInfo.header.class + "-" + classInfo.header.group) +} +console.log("lol") +console.log(classesNames) + +} + + + function generateTable() { + changeClass() const table = document.getElementById('student-table'); table.innerHTML = '';