From 28b280f8c896899c5a14b4b6ab1581ec9af85f97 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C3=ABl=20Minelli?= <michael@minelli.me>
Date: Mon, 27 May 2024 19:09:28 +0200
Subject: [PATCH] Assignment => Do not export corrections of unpublished
 assignment

---
 .../src/helpers/Prisma/Extensions/AssignmentResultExtension.ts  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ExpressAPI/src/helpers/Prisma/Extensions/AssignmentResultExtension.ts b/ExpressAPI/src/helpers/Prisma/Extensions/AssignmentResultExtension.ts
index 41919c8..c67786c 100644
--- a/ExpressAPI/src/helpers/Prisma/Extensions/AssignmentResultExtension.ts
+++ b/ExpressAPI/src/helpers/Prisma/Extensions/AssignmentResultExtension.ts
@@ -30,7 +30,7 @@ export default Prisma.defineExtension(client => {
                                    assignment: {
                                        corrections: {
                                            compute(assignment) {
-                                               return new LazyVal<Array<Partial<Exercise>> | undefined>(() => getCorrections(assignment));
+                                               return new LazyVal<Array<Partial<Exercise>> | undefined>(() => assignment.published ? getCorrections(assignment) : []);
                                            }
                                        }
                                    }
-- 
GitLab