This commit is contained in:
baiobelfer 2024-10-16 10:40:14 +02:00
commit 096623a531
13 changed files with 951 additions and 0 deletions

27
css/style.css Normal file
View File

@ -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);
}

34
data/class.json Normal file
View File

@ -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
}
]

161
data/criteria.json Normal file
View File

@ -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"
]
}
]
}

View File

@ -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"
]
}

View File

@ -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 <schemat.json> <plik.json>")
sys.exit(1)
schema_file = sys.argv[1]
json_file = sys.argv[2]
validate_json(schema_file, json_file)

View File

@ -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
}
]
}

View File

@ -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
}
]
}

35
index.html Normal file
View File

@ -0,0 +1,35 @@
<!DOCTYPE html>
<html lang="pl">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Ocena Zachowania</title>
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<h1>Ocena Zachowania - <span id="current-date"></span></h1>
<!-- Wybór kategorii -->
<div>
<label for="category-select">Wybierz kategorię:</label>
<select id="category-select" onchange="loadCriteriaByCategory()">
<!-- Kategorie zostaną załadowane dynamicznie -->
</select>
</div>
<h2>Kryteria oceny zachowania</h2>
<table>
<thead>
<tr>
<th>Uczeń</th>
<!-- Kryteria zostaną załadowane dynamicznie jako kolumny -->
</tr>
</thead>
<tbody id="student-table">
<!-- Dane uczniów będą generowane dynamicznie -->
</tbody>
</table>
<script src="js/app.js"></script>
</body>
</html>

86
js/app.js Normal file
View File

@ -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 = '<th>Uczeń</th>'; // 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 = `<td>${student.first_name} ${student.last_name}</td>`;
// Dodanie pól do zaznaczania dla każdego kryterium
filteredCriteria.forEach(criterion => {
const td = document.createElement('td');
td.innerHTML = `<input type="checkbox" id="student-${student.id}-criterion-${criterion.id}" onchange="calculateStats()">`;
row.appendChild(td);
});
table.appendChild(row);
});
}
// Obliczanie statystyk na podstawie wybranych kryteriów
function calculateStats() {
// Logika do przeliczania punktacji na podstawie zaznaczonych kryteriów
}

7
templates/criteria.html Normal file
View File

@ -0,0 +1,7 @@
<div>
<h2>Kryteria Weryfikacyjne</h2>
<ul id="criteria-list">
<!-- Kryteria weryfikacyjne będą generowane dynamicznie -->
</ul>
</div>

51
templates/dashboard.html Normal file
View File

@ -0,0 +1,51 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Behavior Assessment Dashboard</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<h1>Behavior Assessment Dashboard</h1>
<div class="filters">
<!-- Wybór roli -->
<label for="role">Select Role:</label>
<select id="role">
<option value="teacher">Teacher</option>
<option value="homeroom_teacher">Homeroom Teacher</option>
<option value="principal">Principal</option>
<option value="student">Student (Self-Assessment)</option>
</select>
<!-- Wybór osoby -->
<label for="person">Select Person:</label>
<select id="person">
<!-- Osoby będą generowane dynamicznie na podstawie roli -->
</select>
<!-- Wybór kategorii -->
<label for="category">Select Category:</label>
<select id="category">
<!-- Kategorie będą generowane dynamicznie na podstawie roli -->
</select>
</div>
<h2>Criteria Table</h2>
<table id="criteria-table">
<thead>
<tr>
<th>Student</th>
<!-- Nagłówki dla kryteriów zostaną dodane dynamicznie -->
</tr>
</thead>
<tbody>
<!-- Wiersze uczniów i kryteriów zostaną dodane dynamicznie -->
</tbody>
</table>
<script src="app.js"></script>
</body>
</html>

12
templates/header.html Normal file
View File

@ -0,0 +1,12 @@
<div style="background-color: #4CAF50; color: white; padding: 10px;">
<h1>Ocena Zachowania</h1>
<p>Zalogowany jako: <span id="user-role">Nauczyciel</span></p>
</div>
<script>
// Skrypt do ustawiania roli użytkownika po zalogowaniu
// Można pobrać rolę z sesji po wdrożeniu API
const userRole = 'Nauczyciel'; // Tymczasowe dane
document.getElementById('user-role').innerText = userRole;
</script>

27
templates/statistics.html Normal file
View File

@ -0,0 +1,27 @@
<div>
<h2>Statystyki i Ustalanie Wag</h2>
<!-- Wprowadź elementy do zarządzania wagami, np. suwaki lub pola numeryczne -->
<label for="waga-pomoc">Pomoc nauczycielowi:</label>
<input type="number" id="waga-pomoc" value="10"><br>
<label for="waga-spoznienie">Spóźnienie:</label>
<input type="number" id="waga-spoznienie" value="-5"><br>
<!-- Więcej wag dla innych kryteriów -->
<h3>Statystyki dla uczniów</h3>
<!-- Tabela statystyk dla uczniów -->
<table>
<thead>
<tr>
<th>Uczeń</th>
<th>Punkty</th>
<th>Ocena</th>
</tr>
</thead>
<tbody>
<!-- Dane będą dynamicznie ładowane -->
</tbody>
</table>
</div>