Compare commits

...

2 commits

Author SHA1 Message Date
Sami Mokaddem
e2cd688eff fix: [backend] Fixed unbound variable and AuditLog support 2024-07-12 15:47:57 +02:00
Sami Mokaddem
e662e5b7aa chg: [app] Added build files 2024-07-12 15:47:17 +02:00
6 changed files with 1504 additions and 1487 deletions

File diff suppressed because one or more lines are too long

1484
dist/assets/index-Bxk5297m.js vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

4
dist/index.html vendored
View file

@ -5,8 +5,8 @@
<link rel="icon" href="/favicon.ico">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Vite App</title>
<script type="module" crossorigin src="/assets/index-DwAImxSO.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index--WxSYaVD.css">
<script type="module" crossorigin src="/assets/index-Bxk5297m.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-BaLleNnd.css">
</head>
<body>
<div id="app"></div>

View file

@ -61,6 +61,7 @@ def read_exercise_dir():
def backup_exercises_progress():
global LAST_BACKUP
toBackup = {
'EXERCISES_STATUS': db.EXERCISES_STATUS,
'SELECTED_EXERCISES': db.SELECTED_EXERCISES,
@ -247,8 +248,8 @@ def get_available_tasks_for_user(user_id: int) -> list[str]:
def get_model_action(data: dict):
if 'Log' in data:
data = data['Log']
if 'Log' in data or 'AuditLog' in data:
data = data['Log'] if 'Log' in data else data['AuditLog']
if 'model' in data and 'action' in data:
return (data['model'], data['action'],)
return (None, None,)
@ -260,6 +261,7 @@ def is_accepted_query(data: dict) -> bool:
# # improved condition below. It blocks some queries
# if data['Log']['change'].startswith('attribute_count'):
# return False
if 'Log' in data:
if data['Log']['change'].startswith('Validation errors:'):
return False
return True
@ -430,6 +432,13 @@ def parse_event_id_from_log(data: dict) -> Union[int, None]:
if event_id_search is not None:
event_id = event_id_search.group(1)
return event_id
elif 'AuditLog' in data:
log = data['AuditLog']
if 'model' in log and 'model_id' in log and log['model'] == 'Event':
return int(log['model_id'])
if 'change' in log:
if 'event_id' in log:
return int(log['event_id'])
return None

View file

@ -75,6 +75,10 @@ def get_user_id(data: dict):
data = data['Log']
if 'user_id' in data:
return int(data['user_id'])
if 'AuditLog' in data:
data = data['AuditLog']
if 'user_id' in data:
return int(data['user_id'])
return None