From 6b59cca3a4eea056bd975140201df22a3de28961 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrik=20Mint=C4=9Bl?= Date: Sat, 5 Oct 2024 16:56:59 +0200 Subject: [PATCH] Lint code --- api/views.py | 4 +- common/models.py | 1 - frontend/src/components/Loader.vue | 81 ++++++++++++++++-------------- web/views/teacher.py | 7 +-- 4 files changed, 46 insertions(+), 47 deletions(-) diff --git a/api/views.py b/api/views.py index 388610a8..53b973e0 100644 --- a/api/views.py +++ b/api/views.py @@ -56,6 +56,7 @@ def tasks_list(request): ) return JsonResponse({"tasks": result}) + def tasks_list_all(request: HttpRequest): result = [] filters = {} @@ -78,7 +79,6 @@ def tasks_list_all(request: HttpRequest): if "search" in request.GET: filters["name__icontains"] = request.GET["search"] - if len(filters) == 0: tasks = Task.objects.all() else: @@ -90,7 +90,7 @@ def tasks_list_all(request: HttpRequest): if start is not None: tasks = tasks[start:] - + if count is not None: tasks = tasks[:count] diff --git a/common/models.py b/common/models.py index c249d9a9..bf904d82 100644 --- a/common/models.py +++ b/common/models.py @@ -81,7 +81,6 @@ class Task(models.Model): plagiarism_key = models.CharField(max_length=255, null=True) created_at = models.DateTimeField(auto_now_add=True) - def path_to_code(path): path = os.path.realpath(os.path.abspath(path)) return os.path.relpath(path, os.path.abspath("./tasks")) diff --git a/frontend/src/components/Loader.vue b/frontend/src/components/Loader.vue index 5f066be0..77b97edb 100644 --- a/frontend/src/components/Loader.vue +++ b/frontend/src/components/Loader.vue @@ -7,54 +7,57 @@ const unit = 'px'; diff --git a/web/views/teacher.py b/web/views/teacher.py index d488e78e..2decbbe0 100644 --- a/web/views/teacher.py +++ b/web/views/teacher.py @@ -20,7 +20,7 @@ from notifications.signals import notify from common.evaluate import evaluate_submit, get_meta -from common.models import AssignedTask, Class, Subject, Submit, Task, assignedtask_results +from common.models import AssignedTask, Class, Submit, Task, assignedtask_results from common.plagcheck.moss import PlagiarismMatch from common.utils import is_teacher from evaluator.results import EvaluationResult @@ -308,10 +308,7 @@ def download_csv_per_class(request, class_id: int): @user_passes_test(is_teacher) def all_tasks(request): - return render( - request, - "web/all_tasks.html" - ) + return render(request, "web/all_tasks.html") @user_passes_test(is_teacher)