diff --git a/__pycache__/app.cpython-313.pyc b/__pycache__/app.cpython-313.pyc index 1f5382a..05c01a1 100644 Binary files a/__pycache__/app.cpython-313.pyc and b/__pycache__/app.cpython-313.pyc differ diff --git a/app.py b/app.py index 5605e90..dc16d02 100644 --- a/app.py +++ b/app.py @@ -2817,4 +2817,54 @@ def get_fallback_mindmap_data(node_id): "edges": edges } -# Diese Routen wurden an den Anfang der Datei verschoben und werden nicht mehr benötigt \ No newline at end of file +# Diese Routen wurden an den Anfang der Datei verschoben und werden nicht mehr benötigt + +@app.route('/api/mindmap/science') +def get_science_mindmap(): + """ + Gibt die Wissenschafts-Mindmap zurück für Frontend-Kompatibilität. + """ + app.logger.info("Wissenschafts-Mindmap-Daten werden angefordert.") + + try: + nodes = [ + { + "id": "physics", + "name": "Physik", + "description": "Lehre von der Materie und ihren Wechselwirkungen", + "category": "Wissenschaft", + "has_children": True, + "color_code": "#f4b400" + }, + { + "id": "biology", + "name": "Biologie", + "description": "Lehre von den Lebewesen und ihren Lebensprozessen", + "category": "Wissenschaft", + "has_children": True, + "color_code": "#f4b400" + }, + { + "id": "chemistry", + "name": "Chemie", + "description": "Wissenschaft von den Stoffen und ihren Reaktionen", + "category": "Wissenschaft", + "has_children": True, + "color_code": "#f4b400" + } + ] + + edges = [ + {"source_id": "science", "target_id": "physics", "strength": 0.8}, + {"source_id": "science", "target_id": "biology", "strength": 0.8}, + {"source_id": "science", "target_id": "chemistry", "strength": 0.8} + ] + + return jsonify({ + "nodes": nodes, + "edges": edges + }) + + except Exception as e: + app.logger.error(f"Fehler beim Abrufen der Wissenschafts-Mindmap-Daten: {str(e)}") + return jsonify({"error": "Fehler beim Abrufen der Mindmap-Daten"}), 500 \ No newline at end of file diff --git a/logs/app.log b/logs/app.log index b7ee9b9..f09d30e 100644 --- a/logs/app.log +++ b/logs/app.log @@ -1462,3 +1462,195 @@ werkzeug.exceptions.NotFound: 404 Not Found: The requested URL was not found on 2025-05-11 00:22:24,158 INFO: Anwendung gestartet [in C:\Users\TTOMCZA.EMEA\Dev\website\app.py:76] 2025-05-11 00:22:26,170 INFO: Anwendung gestartet [in C:\Users\TTOMCZA.EMEA\Dev\website\app.py:76] 2025-05-11 00:22:26,170 INFO: Anwendung gestartet [in C:\Users\TTOMCZA.EMEA\Dev\website\app.py:76] +2025-05-11 00:23:28,446 INFO: Anwendung gestartet [in C:\Users\TTOMCZA.EMEA\Dev\website\app.py:76] +2025-05-11 00:23:30,235 INFO: Anwendung gestartet [in C:\Users\TTOMCZA.EMEA\Dev\website\app.py:76] +2025-05-11 00:23:30,235 INFO: Anwendung gestartet [in C:\Users\TTOMCZA.EMEA\Dev\website\app.py:76] +2025-05-11 00:24:04,692 ERROR: Fehler 404: 404 Not Found: The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again. +Endpoint: /api/mindmap/root, Method: GET, IP: 127.0.0.1 +User: 1 (admin) +Traceback (most recent call last): + File "C:\Users\TTOMCZA.EMEA\AppData\Roaming\Python\Python313\site-packages\flask\app.py", line 1823, in full_dispatch_request + rv = self.dispatch_request() + File "C:\Users\TTOMCZA.EMEA\AppData\Roaming\Python\Python313\site-packages\flask\app.py", line 1788, in dispatch_request + self.raise_routing_exception(req) + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^ + File "C:\Users\TTOMCZA.EMEA\AppData\Roaming\Python\Python313\site-packages\flask\app.py", line 1770, in raise_routing_exception + raise request.routing_exception # type: ignore + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "C:\Users\TTOMCZA.EMEA\AppData\Roaming\Python\Python313\site-packages\flask\ctx.py", line 351, in match_request + result = self.url_adapter.match(return_rule=True) # type: ignore + File "C:\Users\TTOMCZA.EMEA\AppData\Roaming\Python\Python313\site-packages\werkzeug\routing\map.py", line 624, in match + raise NotFound() from None +werkzeug.exceptions.NotFound: 404 Not Found: The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again. + [in C:\Users\TTOMCZA.EMEA\Dev\website\app.py:92] +2025-05-11 00:24:04,692 ERROR: Fehler 404: 404 Not Found: The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again. +Endpoint: /api/mindmap/root, Method: GET, IP: 127.0.0.1 +User: 1 (admin) +Traceback (most recent call last): + File "C:\Users\TTOMCZA.EMEA\AppData\Roaming\Python\Python313\site-packages\flask\app.py", line 1823, in full_dispatch_request + rv = self.dispatch_request() + File "C:\Users\TTOMCZA.EMEA\AppData\Roaming\Python\Python313\site-packages\flask\app.py", line 1788, in dispatch_request + self.raise_routing_exception(req) + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^ + File "C:\Users\TTOMCZA.EMEA\AppData\Roaming\Python\Python313\site-packages\flask\app.py", line 1770, in raise_routing_exception + raise request.routing_exception # type: ignore + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "C:\Users\TTOMCZA.EMEA\AppData\Roaming\Python\Python313\site-packages\flask\ctx.py", line 351, in match_request + result = self.url_adapter.match(return_rule=True) # type: ignore + File "C:\Users\TTOMCZA.EMEA\AppData\Roaming\Python\Python313\site-packages\werkzeug\routing\map.py", line 624, in match + raise NotFound() from None +werkzeug.exceptions.NotFound: 404 Not Found: The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again. + [in C:\Users\TTOMCZA.EMEA\Dev\website\app.py:92] +2025-05-11 00:24:05,404 INFO: Anwendung gestartet [in c:\Users\TTOMCZA.EMEA\Dev\website\app.py:76] +2025-05-11 00:24:07,202 INFO: Anwendung gestartet [in c:\Users\TTOMCZA.EMEA\Dev\website\app.py:76] +2025-05-11 00:24:07,202 INFO: Anwendung gestartet [in c:\Users\TTOMCZA.EMEA\Dev\website\app.py:76] +2025-05-11 00:24:07,640 INFO: Anwendung gestartet [in C:\Users\TTOMCZA.EMEA\Dev\website\app.py:76] +2025-05-11 00:24:09,535 INFO: Anwendung gestartet [in C:\Users\TTOMCZA.EMEA\Dev\website\app.py:76] +2025-05-11 00:24:09,535 INFO: Anwendung gestartet [in C:\Users\TTOMCZA.EMEA\Dev\website\app.py:76] +2025-05-11 00:24:11,258 INFO: Anwendung gestartet [in c:\Users\TTOMCZA.EMEA\Dev\website\app.py:76] +2025-05-11 00:24:12,041 ERROR: Fehler 404: 404 Not Found: The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again. +Endpoint: /api/mindmap/root, Method: GET, IP: 127.0.0.1 +User: 1 (admin) +Traceback (most recent call last): + File "C:\Users\TTOMCZA.EMEA\AppData\Roaming\Python\Python313\site-packages\flask\app.py", line 1823, in full_dispatch_request + rv = self.dispatch_request() + File "C:\Users\TTOMCZA.EMEA\AppData\Roaming\Python\Python313\site-packages\flask\app.py", line 1788, in dispatch_request + self.raise_routing_exception(req) + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^ + File "C:\Users\TTOMCZA.EMEA\AppData\Roaming\Python\Python313\site-packages\flask\app.py", line 1770, in raise_routing_exception + raise request.routing_exception # type: ignore + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "C:\Users\TTOMCZA.EMEA\AppData\Roaming\Python\Python313\site-packages\flask\ctx.py", line 351, in match_request + result = self.url_adapter.match(return_rule=True) # type: ignore + File "C:\Users\TTOMCZA.EMEA\AppData\Roaming\Python\Python313\site-packages\werkzeug\routing\map.py", line 624, in match + raise NotFound() from None +werkzeug.exceptions.NotFound: 404 Not Found: The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again. + [in C:\Users\TTOMCZA.EMEA\Dev\website\app.py:92] +2025-05-11 00:24:12,041 ERROR: Fehler 404: 404 Not Found: The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again. +Endpoint: /api/mindmap/root, Method: GET, IP: 127.0.0.1 +User: 1 (admin) +Traceback (most recent call last): + File "C:\Users\TTOMCZA.EMEA\AppData\Roaming\Python\Python313\site-packages\flask\app.py", line 1823, in full_dispatch_request + rv = self.dispatch_request() + File "C:\Users\TTOMCZA.EMEA\AppData\Roaming\Python\Python313\site-packages\flask\app.py", line 1788, in dispatch_request + self.raise_routing_exception(req) + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^ + File "C:\Users\TTOMCZA.EMEA\AppData\Roaming\Python\Python313\site-packages\flask\app.py", line 1770, in raise_routing_exception + raise request.routing_exception # type: ignore + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "C:\Users\TTOMCZA.EMEA\AppData\Roaming\Python\Python313\site-packages\flask\ctx.py", line 351, in match_request + result = self.url_adapter.match(return_rule=True) # type: ignore + File "C:\Users\TTOMCZA.EMEA\AppData\Roaming\Python\Python313\site-packages\werkzeug\routing\map.py", line 624, in match + raise NotFound() from None +werkzeug.exceptions.NotFound: 404 Not Found: The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again. + [in C:\Users\TTOMCZA.EMEA\Dev\website\app.py:92] +2025-05-11 00:24:12,282 ERROR: Fehler 404: 404 Not Found: The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again. +Endpoint: /api/mindmap/root, Method: GET, IP: 127.0.0.1 +User: 1 (admin) +Traceback (most recent call last): + File "C:\Users\TTOMCZA.EMEA\AppData\Roaming\Python\Python313\site-packages\flask\app.py", line 1823, in full_dispatch_request + rv = self.dispatch_request() + File "C:\Users\TTOMCZA.EMEA\AppData\Roaming\Python\Python313\site-packages\flask\app.py", line 1788, in dispatch_request + self.raise_routing_exception(req) + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^ + File "C:\Users\TTOMCZA.EMEA\AppData\Roaming\Python\Python313\site-packages\flask\app.py", line 1770, in raise_routing_exception + raise request.routing_exception # type: ignore + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "C:\Users\TTOMCZA.EMEA\AppData\Roaming\Python\Python313\site-packages\flask\ctx.py", line 351, in match_request + result = self.url_adapter.match(return_rule=True) # type: ignore + File "C:\Users\TTOMCZA.EMEA\AppData\Roaming\Python\Python313\site-packages\werkzeug\routing\map.py", line 624, in match + raise NotFound() from None +werkzeug.exceptions.NotFound: 404 Not Found: The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again. + [in C:\Users\TTOMCZA.EMEA\Dev\website\app.py:92] +2025-05-11 00:24:12,282 ERROR: Fehler 404: 404 Not Found: The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again. +Endpoint: /api/mindmap/root, Method: GET, IP: 127.0.0.1 +User: 1 (admin) +Traceback (most recent call last): + File "C:\Users\TTOMCZA.EMEA\AppData\Roaming\Python\Python313\site-packages\flask\app.py", line 1823, in full_dispatch_request + rv = self.dispatch_request() + File "C:\Users\TTOMCZA.EMEA\AppData\Roaming\Python\Python313\site-packages\flask\app.py", line 1788, in dispatch_request + self.raise_routing_exception(req) + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^ + File "C:\Users\TTOMCZA.EMEA\AppData\Roaming\Python\Python313\site-packages\flask\app.py", line 1770, in raise_routing_exception + raise request.routing_exception # type: ignore + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "C:\Users\TTOMCZA.EMEA\AppData\Roaming\Python\Python313\site-packages\flask\ctx.py", line 351, in match_request + result = self.url_adapter.match(return_rule=True) # type: ignore + File "C:\Users\TTOMCZA.EMEA\AppData\Roaming\Python\Python313\site-packages\werkzeug\routing\map.py", line 624, in match + raise NotFound() from None +werkzeug.exceptions.NotFound: 404 Not Found: The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again. + [in C:\Users\TTOMCZA.EMEA\Dev\website\app.py:92] +2025-05-11 00:24:13,080 INFO: Anwendung gestartet [in c:\Users\TTOMCZA.EMEA\Dev\website\app.py:76] +2025-05-11 00:24:13,080 INFO: Anwendung gestartet [in c:\Users\TTOMCZA.EMEA\Dev\website\app.py:76] +2025-05-11 00:24:14,077 ERROR: Fehler 404: 404 Not Found: The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again. +Endpoint: /api/mindmap/science, Method: GET, IP: 127.0.0.1 +User: 1 (admin) +Traceback (most recent call last): + File "C:\Users\TTOMCZA.EMEA\AppData\Roaming\Python\Python313\site-packages\flask\app.py", line 1823, in full_dispatch_request + rv = self.dispatch_request() + File "C:\Users\TTOMCZA.EMEA\AppData\Roaming\Python\Python313\site-packages\flask\app.py", line 1788, in dispatch_request + self.raise_routing_exception(req) + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^ + File "C:\Users\TTOMCZA.EMEA\AppData\Roaming\Python\Python313\site-packages\flask\app.py", line 1770, in raise_routing_exception + raise request.routing_exception # type: ignore + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "C:\Users\TTOMCZA.EMEA\AppData\Roaming\Python\Python313\site-packages\flask\ctx.py", line 351, in match_request + result = self.url_adapter.match(return_rule=True) # type: ignore + File "C:\Users\TTOMCZA.EMEA\AppData\Roaming\Python\Python313\site-packages\werkzeug\routing\map.py", line 624, in match + raise NotFound() from None +werkzeug.exceptions.NotFound: 404 Not Found: The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again. + [in C:\Users\TTOMCZA.EMEA\Dev\website\app.py:92] +2025-05-11 00:24:14,077 ERROR: Fehler 404: 404 Not Found: The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again. +Endpoint: /api/mindmap/science, Method: GET, IP: 127.0.0.1 +User: 1 (admin) +Traceback (most recent call last): + File "C:\Users\TTOMCZA.EMEA\AppData\Roaming\Python\Python313\site-packages\flask\app.py", line 1823, in full_dispatch_request + rv = self.dispatch_request() + File "C:\Users\TTOMCZA.EMEA\AppData\Roaming\Python\Python313\site-packages\flask\app.py", line 1788, in dispatch_request + self.raise_routing_exception(req) + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^ + File "C:\Users\TTOMCZA.EMEA\AppData\Roaming\Python\Python313\site-packages\flask\app.py", line 1770, in raise_routing_exception + raise request.routing_exception # type: ignore + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "C:\Users\TTOMCZA.EMEA\AppData\Roaming\Python\Python313\site-packages\flask\ctx.py", line 351, in match_request + result = self.url_adapter.match(return_rule=True) # type: ignore + File "C:\Users\TTOMCZA.EMEA\AppData\Roaming\Python\Python313\site-packages\werkzeug\routing\map.py", line 624, in match + raise NotFound() from None +werkzeug.exceptions.NotFound: 404 Not Found: The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again. + [in C:\Users\TTOMCZA.EMEA\Dev\website\app.py:92] +2025-05-11 00:24:14,752 ERROR: Fehler 404: 404 Not Found: The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again. +Endpoint: /api/mindmap/science, Method: GET, IP: 127.0.0.1 +User: 1 (admin) +Traceback (most recent call last): + File "C:\Users\TTOMCZA.EMEA\AppData\Roaming\Python\Python313\site-packages\flask\app.py", line 1823, in full_dispatch_request + rv = self.dispatch_request() + File "C:\Users\TTOMCZA.EMEA\AppData\Roaming\Python\Python313\site-packages\flask\app.py", line 1788, in dispatch_request + self.raise_routing_exception(req) + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^ + File "C:\Users\TTOMCZA.EMEA\AppData\Roaming\Python\Python313\site-packages\flask\app.py", line 1770, in raise_routing_exception + raise request.routing_exception # type: ignore + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "C:\Users\TTOMCZA.EMEA\AppData\Roaming\Python\Python313\site-packages\flask\ctx.py", line 351, in match_request + result = self.url_adapter.match(return_rule=True) # type: ignore + File "C:\Users\TTOMCZA.EMEA\AppData\Roaming\Python\Python313\site-packages\werkzeug\routing\map.py", line 624, in match + raise NotFound() from None +werkzeug.exceptions.NotFound: 404 Not Found: The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again. + [in C:\Users\TTOMCZA.EMEA\Dev\website\app.py:92] +2025-05-11 00:24:14,752 ERROR: Fehler 404: 404 Not Found: The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again. +Endpoint: /api/mindmap/science, Method: GET, IP: 127.0.0.1 +User: 1 (admin) +Traceback (most recent call last): + File "C:\Users\TTOMCZA.EMEA\AppData\Roaming\Python\Python313\site-packages\flask\app.py", line 1823, in full_dispatch_request + rv = self.dispatch_request() + File "C:\Users\TTOMCZA.EMEA\AppData\Roaming\Python\Python313\site-packages\flask\app.py", line 1788, in dispatch_request + self.raise_routing_exception(req) + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^ + File "C:\Users\TTOMCZA.EMEA\AppData\Roaming\Python\Python313\site-packages\flask\app.py", line 1770, in raise_routing_exception + raise request.routing_exception # type: ignore + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "C:\Users\TTOMCZA.EMEA\AppData\Roaming\Python\Python313\site-packages\flask\ctx.py", line 351, in match_request + result = self.url_adapter.match(return_rule=True) # type: ignore + File "C:\Users\TTOMCZA.EMEA\AppData\Roaming\Python\Python313\site-packages\werkzeug\routing\map.py", line 624, in match + raise NotFound() from None +werkzeug.exceptions.NotFound: 404 Not Found: The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again. + [in C:\Users\TTOMCZA.EMEA\Dev\website\app.py:92] diff --git a/static/js/update_mindmap.js b/static/js/update_mindmap.js index 4145129..ab3f6f2 100644 --- a/static/js/update_mindmap.js +++ b/static/js/update_mindmap.js @@ -803,7 +803,20 @@ function createFlashContainer() { // Funktion zum Laden der Mindmap-Daten aus der Datenbank async function loadMindmapData(nodeId = null) { try { - const response = await fetch(`/api/mindmap/${nodeId || 'root'}`); + let url; + // Wir müssen zwischen numerischen IDs und String-IDs unterscheiden + if (nodeId === null || nodeId === undefined) { + // Wenn keine ID angegeben ist, verwende 'root' + url = '/api/mindmap/root'; + } else if (isNaN(parseInt(nodeId))) { + // Für String-IDs wie 'root', 'technology', 'arts' - direkte Route + url = `/api/mindmap/${nodeId}`; + } else { + // Für numerische IDs - neue Route mit /id/ Präfix + url = `/api/mindmap/id/${nodeId}`; + } + + const response = await fetch(url); if (!response.ok) throw new Error('Fehler beim Laden der Mindmap-Daten'); return await response.json(); } catch (error) {