diff --git a/backend/app/core/admin.py b/backend/app/core/admin.py
index 6e9a948..a22eedd 100644
--- a/backend/app/core/admin.py
+++ b/backend/app/core/admin.py
@@ -3,11 +3,18 @@
from .models import Student, Instructor, Course, CourseClass, Exercise, ExerciseTag, TelemetryData
-
+class TelemetryDataAdmin(admin.ModelAdmin):
+ list_filter = ("author", "exercise")
+ readonly_fields = ('solution',)
+
admin.site.register(Student, UserAdmin)
admin.site.register(Instructor, UserAdmin)
admin.site.register(Course)
admin.site.register(CourseClass)
admin.site.register(Exercise)
admin.site.register(ExerciseTag)
-admin.site.register(TelemetryData)
+admin.site.register(TelemetryData, TelemetryDataAdmin)
+
+
+
+
diff --git a/backend/app/core/models.py b/backend/app/core/models.py
index 87b9cda..ea85352 100644
--- a/backend/app/core/models.py
+++ b/backend/app/core/models.py
@@ -1,6 +1,7 @@
from django.db import models
from django.contrib.auth.models import AbstractUser, UserManager
from django.utils import timezone
+from django.utils.html import format_html
class User(AbstractUser):
@@ -102,5 +103,18 @@ class TelemetryData(models.Model):
log = models.JSONField()
last = models.BooleanField(default=True)
+ def solution(self):
+ formatted = ''
+ for chave, valor in self.log.get('student_input', {}).items():
+ codigo = valor.replace("\n", "
")
+ codigo = codigo.replace(' ', ' ')
+ formatted += f'
{codigo}
+ ''' + + return format_html(formatted) + + def __str__(self) -> str: return f"{self.exercise} -> {self.author.username} ({self.submission_date})"