diff --git a/src/back/tests/views.py b/src/back/tests/views.py index 1e8414dd3..1906a5351 100644 --- a/src/back/tests/views.py +++ b/src/back/tests/views.py @@ -55,8 +55,12 @@ class GetTests(generics.ListAPIView): return status_filters.get(status, Test.objects.none()).order_by('dateend') def set_attemps_number(self, user, tests): + test_ids = [test.id for test in tests] + attempt_counts = TestAttempt.objects.filter(user=user, test__id__in=test_ids).values('test').annotate(count=Count('test')) + attempt_counts = {item['test']: item['count'] for item in attempt_counts} + for test in tests: - test.attemps_number = get_attempt_count(user=user, test=test) + test.attemps_number = test.attemps_number - attempt_counts.get(test.id, 0) class TestDetail(generics.RetrieveUpdateDestroyAPIView): queryset = Test.objects.all() diff --git a/src/front/src/components/testing/DetailCardTest.vue b/src/front/src/components/testing/DetailCardTest.vue new file mode 100644 index 000000000..26386ca69 --- /dev/null +++ b/src/front/src/components/testing/DetailCardTest.vue @@ -0,0 +1,18 @@ + + + \ No newline at end of file diff --git a/src/front/src/components/testing/HeaderDetailTesting.vue b/src/front/src/components/testing/HeaderDetailTesting.vue new file mode 100644 index 000000000..febd445d1 --- /dev/null +++ b/src/front/src/components/testing/HeaderDetailTesting.vue @@ -0,0 +1,36 @@ + + + \ No newline at end of file diff --git a/src/front/src/router/index.js b/src/front/src/router/index.js index 41ff8d488..ddf603cc8 100644 --- a/src/front/src/router/index.js +++ b/src/front/src/router/index.js @@ -177,6 +177,12 @@ const routes = [ ico: "mdi-account", }, }, + { + path: "/test/testdetail/:id", + name: "TestDetail", + component: () => + import("@/components/testing/DetailCardTest.vue") + }, { path: '/secret', name: 'Secret Page', diff --git a/src/front/src/views/TestHomePage.vue b/src/front/src/views/TestHomePage.vue index 235971cb2..b369b71c4 100644 --- a/src/front/src/views/TestHomePage.vue +++ b/src/front/src/views/TestHomePage.vue @@ -1,223 +1,98 @@ + setup() { + const activeTab = ref(0); + const currentTest = ref('') + + const getAllTests = ref([]) - + \ No newline at end of file diff --git a/src/front/src/views/secret/SecretPage.vue b/src/front/src/views/secret/SecretPage.vue index 88347628f..c305349eb 100644 --- a/src/front/src/views/secret/SecretPage.vue +++ b/src/front/src/views/secret/SecretPage.vue @@ -20,11 +20,12 @@ +