From 096623a5311abf957c5d110c888ac270a8e47641 Mon Sep 17 00:00:00 2001 From: baiobelfer Date: Wed, 16 Oct 2024 10:40:14 +0200 Subject: [PATCH] init --- css/style.css | 27 +++ data/class.json | 34 +++ data/criteria.json | 161 ++++++++++++++ data/students/_class_json_schema.json | 105 ++++++++++ data/students/_validate_json.py | 37 ++++ ..._3i_programowanie_aplikacji_2024_2025.json | 171 +++++++++++++++ ..._programowanie_aplikacji_II_2024_2025.json | 198 ++++++++++++++++++ index.html | 35 ++++ js/app.js | 86 ++++++++ templates/criteria.html | 7 + templates/dashboard.html | 51 +++++ templates/header.html | 12 ++ templates/statistics.html | 27 +++ 13 files changed, 951 insertions(+) create mode 100644 css/style.css create mode 100644 data/class.json create mode 100644 data/criteria.json create mode 100644 data/students/_class_json_schema.json create mode 100644 data/students/_validate_json.py create mode 100644 data/students/ckziu_class_3i_programowanie_aplikacji_2024_2025.json create mode 100644 data/students/ckziu_class_4i_programowanie_aplikacji_II_2024_2025.json create mode 100644 index.html create mode 100644 js/app.js create mode 100644 templates/criteria.html create mode 100644 templates/dashboard.html create mode 100644 templates/header.html create mode 100644 templates/statistics.html diff --git a/css/style.css b/css/style.css new file mode 100644 index 0000000..74183a1 --- /dev/null +++ b/css/style.css @@ -0,0 +1,27 @@ +body { + font-family: Arial, sans-serif; + margin: 20px; +} + +table { + width: 100%; + border-collapse: collapse; +} + +table, th, td { + border: 1px solid black; +} + +th, td { + padding: 10px; + text-align: center; +} + +th { + background-color: #f2f2f2; +} + +input[type="number"], input[type="checkbox"] { + transform: scale(1.2); +} + diff --git a/data/class.json b/data/class.json new file mode 100644 index 0000000..b7447ae --- /dev/null +++ b/data/class.json @@ -0,0 +1,34 @@ +[ + { + "school": "CKZiU", + "city": "City", + "year": "202/202", + "semester": "Semestr 1", + "subject": "Programowanie Aplikacji Internetowych I", + "level": "Podstawowy", + "publisher": "Dokumentacja", + "class": "3", + "group": "i", + "profile": "Technik Informatyk", + "max_points": 55, + "teacher": "M. Pabi", + "file_path": "students/ckziu_class_3i_programowanie_aplikacji_2024_2025.json", + "student_count": 17 + }, + { + "school": "CKZiU", + "city": "City", + "year": "202/202", + "semester": "Semestr 1", + "subject": "Programowanie Aplikacji Internetowych II", + "level": "Podstawowy", + "publisher": "Dokumentacja", + "class": "4", + "group": "i", + "profile": "Technik Informatyk", + "max_points": 55, + "teacher": "M. Pabi", + "file_path": "students/ckziu_class_4i_programowanie_aplikacji_II_2024_2025.json", + "student_count": 18 + } +] diff --git a/data/criteria.json b/data/criteria.json new file mode 100644 index 0000000..c726e17 --- /dev/null +++ b/data/criteria.json @@ -0,0 +1,161 @@ +{ + "criteria": [ + { + "id": 1, + "name": "Tardiness" + }, + { + "id": 2, + "name": "Disruption" + }, + { + "id": 3, + "name": "Disrespect towards teachers" + }, + { + "id": 4, + "name": "Participation in class" + }, + { + "id": 5, + "name": "Preparedness for class" + }, + { + "id": 6, + "name": "Attendance" + }, + { + "id": 7, + "name": "Involvement in projects" + }, + { + "id": 8, + "name": "Warning from homeroom teacher" + }, + { + "id": 9, + "name": "Warning from principal" + }, + { + "id": 10, + "name": "Achievements in competitions" + }, + { + "id": 11, + "name": "Representing the school" + }, + { + "id": 12, + "name": "Independence" + }, + { + "id": 13, + "name": "Engagement in lessons" + } + ], + "categories": [ + { + "id": "behavior", + "name": "Behavior", + "criteria_ids": [ + 1, + 2, + 3, + 4 + ] + }, + { + "id": "responsibility", + "name": "Responsibility", + "criteria_ids": [ + 5, + 6, + 7 + ] + }, + { + "id": "discipline", + "name": "Discipline", + "criteria_ids": [ + 8, + 9 + ] + }, + { + "id": "achievement", + "name": "Achievements", + "criteria_ids": [ + 10, + 11 + ] + }, + { + "id": "self_assessment", + "name": "Self-Assessment", + "criteria_ids": [ + 12, + 13 + ] + } + ], + "roles": { + "teacher": { + "criteria_ids": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7 + ] + }, + "homeroom_teacher": { + "criteria_ids": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8 + ] + }, + "principal": { + "criteria_ids": [ + 8, + 9, + 10, + 11 + ] + }, + "student": { + "criteria_ids": [ + 12, + 13 + ] + } + }, + "people": [ + { + "name": "M. Pabiszczak", + "roles": [ + "teacher", + "homeroom_teacher" + ] + }, + { + "name": "A. Nowak", + "roles": [ + "principal" + ] + }, + { + "name": "K. Kowalski", + "roles": [ + "teacher" + ] + } + ] +} diff --git a/data/students/_class_json_schema.json b/data/students/_class_json_schema.json new file mode 100644 index 0000000..d906e47 --- /dev/null +++ b/data/students/_class_json_schema.json @@ -0,0 +1,105 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "header": { + "type": "object", + "properties": { + "school": { + "type": "string" + }, + "city": { + "type": "string" + }, + "year": { + "type": "string" + }, + "semester": { + "type": "string" + }, + "subject": { + "type": "string" + }, + "level": { + "type": "string" + }, + "publisher": { + "type": "string" + }, + "class": { + "type": "string" + }, + "group": { + "type": "string" + }, + "profile": { + "type": "string" + }, + "max_points": { + "type": "integer" + }, + "teacher": { + "type": "string" + } + }, + "required": [ + "school", + "city", + "year", + "semester", + "subject", + "class", + "group", + "profile", + "teacher" + ] + }, + "students": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "integer" + }, + "first_name": { + "type": "string" + }, + "last_name": { + "type": "string" + }, + "name": { + "type": "string" + }, + "grade": { + "type": [ + "string", + "null" + ] + }, + "points": { + "type": [ + "number", + "null" + ] + }, + "status": { + "type": "integer" + } + }, + "required": [ + "id", + "first_name", + "last_name", + "name", + "grade", + "status" + ] + } + } + }, + "required": [ + "header", + "students" + ] +} \ No newline at end of file diff --git a/data/students/_validate_json.py b/data/students/_validate_json.py new file mode 100644 index 0000000..47e21af --- /dev/null +++ b/data/students/_validate_json.py @@ -0,0 +1,37 @@ +import json +import sys +from jsonschema import validate, ValidationError + +def validate_json(schema_file, json_file): + try: + # Wczytaj schemat JSON + with open(schema_file, 'r') as f: + schema = json.load(f) + + # Wczytaj dane JSON + with open(json_file, 'r') as f: + data = json.load(f) + + # Sprawdź, czy dane JSON są zgodne ze schematem + validate(instance=data, schema=schema) + print("JSON jest zgodny z schematem") + + except ValidationError as e: + print("JSON nie jest zgodny z schematem:", e.message) + except json.JSONDecodeError as e: + print("Błąd wczytywania JSON:", e) + except FileNotFoundError as e: + print("Plik nie został znaleziony:", e) + except Exception as e: + print("Wystąpił błąd:", e) + +if __name__ == "__main__": + if len(sys.argv) != 3: + print("Użycie: python validate_json.py ") + sys.exit(1) + + schema_file = sys.argv[1] + json_file = sys.argv[2] + + validate_json(schema_file, json_file) + diff --git a/data/students/ckziu_class_3i_programowanie_aplikacji_2024_2025.json b/data/students/ckziu_class_3i_programowanie_aplikacji_2024_2025.json new file mode 100644 index 0000000..ac5c22f --- /dev/null +++ b/data/students/ckziu_class_3i_programowanie_aplikacji_2024_2025.json @@ -0,0 +1,171 @@ +{ + "header": { + "school": "CKZiU", + "city": "City", + "year": "202/202", + "semester": "Semestr 1", + "subject": "Programowanie Aplikacji Internetowych I", + "level": "Podstawowy", + "publisher": "Dokumentacja", + "class": "3", + "group": "i", + "profile": "Technik Informatyk", + "max_points": 55, + "teacher": "M. Pabi" + }, + "students": [ + { + "id": 1, + "first_name": "Nikodem", + "last_name": "And", + "name": "And N", + "grade": "Brak ocen", + "points": null, + "status": 1 + }, + { + "id": 2, + "first_name": "Karol", + "last_name": "Bar", + "name": "Bar K", + "grade": "Brak ocen", + "points": null, + "status": 1 + }, + { + "id": 3, + "first_name": "Roman", + "last_name": "Baz", + "name": "Baz R", + "grade": "Brak ocen", + "points": null, + "status": 1 + }, + { + "id": 4, + "first_name": "Jakub", + "last_name": "Bed", + "name": "Bed J", + "grade": "Brak ocen", + "points": null, + "status": 1 + }, + { + "id": 5, + "first_name": "Marcel", + "last_name": "Gaj", + "name": "Gaj M", + "grade": "Brak ocen", + "points": null, + "status": 1 + }, + { + "id": 6, + "first_name": "Rostyslav", + "last_name": "Hum", + "name": "Hum R", + "grade": "Brak ocen", + "points": null, + "status": 1 + }, + { + "id": 7, + "first_name": "Szymon", + "last_name": "Jacz", + "name": "Jacz S", + "grade": "Brak ocen", + "points": null, + "status": 1 + }, + { + "id": 8, + "first_name": "Eryk", + "last_name": "Kar", + "name": "Kar E", + "grade": "Brak ocen", + "points": null, + "status": 1 + }, + { + "id": 9, + "first_name": "Fabian", + "last_name": "Korz", + "name": "Korz F", + "grade": "Brak ocen", + "points": null, + "status": 1 + }, + { + "id": 10, + "first_name": "Zuzanna", + "last_name": "Lo", + "name": "Lo Z", + "grade": "Brak ocen", + "points": null, + "status": 1 + }, + { + "id": 11, + "first_name": "Maja", + "last_name": "Miz", + "name": "Miz M", + "grade": "Brak ocen", + "points": null, + "status": 1 + }, + { + "id": 12, + "first_name": "Jakub", + "last_name": "Ole", + "name": "Ole J", + "grade": "Brak ocen", + "points": null, + "status": 1 + }, + { + "id": 13, + "first_name": "Łukasz", + "last_name": "Oś", + "name": "Oś Ł", + "grade": "Brak ocen", + "points": null, + "status": 1 + }, + { + "id": 14, + "first_name": "Maciej", + "last_name": "Pac", + "name": "Pac M", + "grade": "Brak ocen", + "points": null, + "status": 1 + }, + { + "id": 15, + "first_name": "Lena", + "last_name": "Pło", + "name": "Pło L", + "grade": "Brak ocen", + "points": null, + "status": 1 + }, + { + "id": 16, + "first_name": "Hubert", + "last_name": "Py", + "name": "Py H", + "grade": "Brak ocen", + "points": null, + "status": 1 + }, + { + "id": 17, + "first_name": "Antoni", + "last_name": "Wó", + "name": "Wó A", + "grade": "Brak ocen", + "points": null, + "status": 1 + } + ] +} diff --git a/data/students/ckziu_class_4i_programowanie_aplikacji_II_2024_2025.json b/data/students/ckziu_class_4i_programowanie_aplikacji_II_2024_2025.json new file mode 100644 index 0000000..25d61c5 --- /dev/null +++ b/data/students/ckziu_class_4i_programowanie_aplikacji_II_2024_2025.json @@ -0,0 +1,198 @@ +{ + "header": { + "school": "CKZiU", + "city": "City", + "year": "202/202", + "semester": "Semestr 1", + "subject": "Programowanie Aplikacji Internetowych II", + "level": "Podstawowy", + "publisher": "Dokumentacja", + "class": "4", + "group": "i", + "profile": "Technik Informatyk", + "max_points": 55, + "teacher": "M. Pabi" + }, + "students": [ + { + "id": 1, + "first_name": "Aleksander", + "last_name": "Adam", + "name": "Adam A", + "grade": "Brak ocen", + "points": null, + "info": "", + "status": 1 + }, + { + "id": 2, + "first_name": "Bartosz", + "last_name": "Boh", + "name": "Boh B", + "grade": "Brak ocen", + "points": null, + "info": "Na prośbę rodzica proszę o zwolnienie ucznia z 9 lekcji", + "status": 1 + }, + { + "id": 3, + "first_name": "Jakub", + "last_name": "Gj", + "name": "Gj J", + "grade": "Brak ocen", + "points": null, + "info": "Na prośbę rodzica proszę o zwolnienie ucznia z 9 lekcji", + "status": 1 + }, + { + "id": 4, + "first_name": "Wiktor", + "last_name": "Kier", + "name": "Kier W", + "grade": "Brak ocen", + "points": null, + "info": "", + "status": 1 + }, + { + "id": 5, + "first_name": "Jakub", + "last_name": "Km", + "name": "Km J", + "grade": "Brak ocen", + "points": null, + "info": "", + "status": 1 + }, + { + "id": 6, + "first_name": "Fabian", + "last_name": "Kow", + "name": "Kow F", + "grade": "Brak ocen", + "points": null, + "info": "", + "status": 1 + }, + { + "id": 7, + "first_name": "Patryk", + "last_name": "Mac", + "name": "Mac P", + "grade": "Brak ocen", + "points": null, + "info": "", + "status": 1 + }, + { + "id": 8, + "first_name": "Marcel", + "last_name": "Mars", + "name": "Mars M", + "grade": "Brak ocen", + "points": null, + "info": "", + "status": 1 + }, + { + "id": 9, + "first_name": "Szymon", + "last_name": "Pt", + "name": "Pt S", + "grade": "Brak ocen", + "points": null, + "info": "", + "status": 1 + }, + { + "id": 10, + "first_name": "Dmytro", + "last_name": "Shev", + "name": "Shev D", + "grade": "Brak ocen", + "points": null, + "info": "", + "status": 1 + }, + { + "id": 11, + "first_name": "Anna", + "last_name": "Sik", + "name": "Sik A", + "grade": "Brak ocen", + "points": null, + "info": "", + "status": 1 + }, + { + "id": 12, + "first_name": "Szymon", + "last_name": "Spili", + "name": "Spili S", + "grade": "Brak ocen", + "points": null, + "info": "Na prośbę rodzica proszę o zwolnienie ucznia z 9 lekcji", + "status": 1 + }, + { + "id": 13, + "first_name": "Alan", + "last_name": "Stas", + "name": "Stas A", + "grade": "Brak ocen", + "points": null, + "info": "", + "status": 1 + }, + { + "id": 14, + "first_name": "Kamil", + "last_name": "Szy", + "name": "Szy K", + "grade": "Brak ocen", + "points": null, + "info": "", + "status": 1 + }, + { + "id": 15, + "first_name": "Jakub", + "last_name": "Toc", + "name": "Toc J", + "grade": "Brak ocen", + "points": null, + "info": "Na prośbę rodzica proszę o zwolnienie ucznia z 9 lekcji", + "status": 1 + }, + { + "id": 16, + "first_name": "Mateusz", + "last_name": "Wój", + "name": "Wój M", + "grade": "Brak ocen", + "points": null, + "info": "Na prośbę rodzica proszę o zwolnienie ucznia z 9 lekcji", + "status": 1 + }, + { + "id": 17, + "first_name": "Tomasz", + "last_name": "Zad", + "name": "Zad T", + "grade": "Brak ocen", + "points": null, + "info": "", + "status": 1 + }, + { + "id": 18, + "first_name": "Wiktor", + "last_name": "Zal", + "name": "Zal W", + "grade": "Brak ocen", + "points": null, + "info": "", + "status": 1 + } + ] +} \ No newline at end of file diff --git a/index.html b/index.html new file mode 100644 index 0000000..f3aa161 --- /dev/null +++ b/index.html @@ -0,0 +1,35 @@ + + + + + + Ocena Zachowania + + + +

Ocena Zachowania -

+ + +
+ + +
+ +

Kryteria oceny zachowania

+ + + + + + + + + + +
Uczeń
+ + + + diff --git a/js/app.js b/js/app.js new file mode 100644 index 0000000..abe18ec --- /dev/null +++ b/js/app.js @@ -0,0 +1,86 @@ +let criteriaData = 1 +let studentsData = []; // Baza danych uczniów +let currentCategory = "behavior"; // Domyślna kategoria + +console.log("data") +// Wczytanie kryteriów z pliku JSON +fetch('../data/criteria.json') + .then(response => response.json()) + .then(data => { + console.log(data); + criteriaData = data; + populateCategorySelect(); + loadStudents(); // Wczytanie pierwszej listy uczniów + }) + .catch(error => { + console.error("Błąd podczas wczytywania pliku criteria.json: ", error); + }); + +// Załaduj kategorie do selektora +function populateCategorySelect() { + const categorySelect = document.getElementById('category-select'); + criteriaData.categories.forEach(category => { + const option = document.createElement('option'); + option.value = category.id; + option.text = category.name; + categorySelect.appendChild(option); + }); +} + +// Załaduj kryteria na podstawie wybranej kategorii +function loadCriteriaByCategory() { + currentCategory = document.getElementById('category-select').value; + generateStudentTable(); +} + +// Wczytanie listy uczniów z pliku +function loadStudents() { + fetch('data/students/zsl_class_2a_fizyka_2024_2025.json') // Załaduj pierwszy plik jako przykład + .then(response => response.json()) + .then(data => { + studentsData = data.students; + generateStudentTable(); + }) + .catch(error => { + console.error("Błąd podczas wczytywania pliku studentów: ", error); + }); +} + +// Generowanie tabeli uczniów i kryteriów +function generateStudentTable() { + const table = document.getElementById('student-table'); + const thead = document.querySelector('thead tr'); + + table.innerHTML = ''; // Wyczyść tabelę uczniów + thead.innerHTML = 'Uczeń'; // Wyczyść i ustaw pierwszy nagłówek + + const categoryCriteria = criteriaData.categories.find(category => category.id === currentCategory).criteria_ids; + const filteredCriteria = criteriaData.criteria.filter(criterion => categoryCriteria.includes(criterion.id)); + + // Dodanie kolumn dla kryteriów + filteredCriteria.forEach(criterion => { + const th = document.createElement('th'); + th.textContent = criterion.name; + thead.appendChild(th); + }); + + // Generowanie wierszy dla każdego ucznia + studentsData.forEach(student => { + const row = document.createElement('tr'); + row.innerHTML = `${student.first_name} ${student.last_name}`; + + // Dodanie pól do zaznaczania dla każdego kryterium + filteredCriteria.forEach(criterion => { + const td = document.createElement('td'); + td.innerHTML = ``; + row.appendChild(td); + }); + + table.appendChild(row); + }); +} + +// Obliczanie statystyk na podstawie wybranych kryteriów +function calculateStats() { + // Logika do przeliczania punktacji na podstawie zaznaczonych kryteriów +} diff --git a/templates/criteria.html b/templates/criteria.html new file mode 100644 index 0000000..cf39461 --- /dev/null +++ b/templates/criteria.html @@ -0,0 +1,7 @@ +
+

Kryteria Weryfikacyjne

+
    + +
+
+ diff --git a/templates/dashboard.html b/templates/dashboard.html new file mode 100644 index 0000000..d006bd8 --- /dev/null +++ b/templates/dashboard.html @@ -0,0 +1,51 @@ + + + + + + Behavior Assessment Dashboard + + + +

Behavior Assessment Dashboard

+ +
+ + + + + + + + + + + +
+ +

Criteria Table

+ + + + + + + + + + +
Student
+ + + + + diff --git a/templates/header.html b/templates/header.html new file mode 100644 index 0000000..41adefc --- /dev/null +++ b/templates/header.html @@ -0,0 +1,12 @@ +
+

Ocena Zachowania

+

Zalogowany jako: Nauczyciel

+
+ + + diff --git a/templates/statistics.html b/templates/statistics.html new file mode 100644 index 0000000..ce95227 --- /dev/null +++ b/templates/statistics.html @@ -0,0 +1,27 @@ +
+

Statystyki i Ustalanie Wag

+ + +
+ + +
+ + + +

Statystyki dla uczniów

+ + + + + + + + + + + + +
UczeńPunktyOcena
+
+