From 7055c6d8ba0ba7f7638aa05cf726eabec81cd403 Mon Sep 17 00:00:00 2001 From: sjschlapbach Date: Mon, 26 Aug 2024 22:59:47 +0200 Subject: [PATCH 1/4] style: simplify styling of element stack and improve placement of element feedback icons --- .../groupActivity/GroupActivityStack.tsx | 9 +++--- .../src/components/practiceQuiz/Bookmark.tsx | 30 +++++++++++-------- .../components/practiceQuiz/ElementStack.tsx | 11 ++++--- .../practiceQuiz/InstanceHeader.tsx | 8 +++-- .../shared-components/src/ChoicesQuestion.tsx | 2 +- .../shared-components/src/ContentElement.tsx | 2 +- .../src/FreeTextQuestion.tsx | 2 +- .../src/NumericalQuestion.tsx | 2 +- 8 files changed, 38 insertions(+), 28 deletions(-) diff --git a/apps/frontend-pwa/src/components/groupActivity/GroupActivityStack.tsx b/apps/frontend-pwa/src/components/groupActivity/GroupActivityStack.tsx index 8e54b0fc0b..1480b58f56 100644 --- a/apps/frontend-pwa/src/components/groupActivity/GroupActivityStack.tsx +++ b/apps/frontend-pwa/src/components/groupActivity/GroupActivityStack.tsx @@ -171,6 +171,7 @@ function GroupActivityStack({ stackInstanceIds={ stack.elements?.map((element) => element.id) ?? [] } + showSeparator={element.elementType === ElementType.Flashcard} withParticipant />
{t(`pwa.groupActivity.answer${correctness}`)}
-
{`${grading.score}/${ +
{`${grading.score}/${ grading.maxPoints } ${t('shared.generic.points')}`}
@@ -225,7 +226,7 @@ function GroupActivityStack({ {!decisions ? ( ) : ( -
+
{t.rich('pwa.groupActivity.alreadySubmittedAt', { br: () =>
, date: submittedAt, diff --git a/apps/frontend-pwa/src/components/practiceQuiz/Bookmark.tsx b/apps/frontend-pwa/src/components/practiceQuiz/Bookmark.tsx index 55b44d7af2..920aa276b2 100644 --- a/apps/frontend-pwa/src/components/practiceQuiz/Bookmark.tsx +++ b/apps/frontend-pwa/src/components/practiceQuiz/Bookmark.tsx @@ -64,18 +64,22 @@ function Bookmark({ bookmarks, quizId, stackId }: BookmarkProps) { }) return ( -
bookmarkElementStack()} + data={{ cy: 'bookmark-element-stack' }} + className={{ + root: twMerge( + 'flex flex-row items-center text-sm shadow-none', + bookmarks === null || typeof bookmarks === 'undefined' + ? 'hidden' + : undefined + ), + }} > -
{t('shared.generic.bookmark')}
- -
+ + ) } diff --git a/apps/frontend-pwa/src/components/practiceQuiz/ElementStack.tsx b/apps/frontend-pwa/src/components/practiceQuiz/ElementStack.tsx index a3dae08a3c..56cb8da6ae 100644 --- a/apps/frontend-pwa/src/components/practiceQuiz/ElementStack.tsx +++ b/apps/frontend-pwa/src/components/practiceQuiz/ElementStack.tsx @@ -121,7 +121,7 @@ function ElementStack({
)} -
+
{stack.elements && stack.elements.length > 0 && stack.elements.map((element, elementIx) => { @@ -139,6 +139,9 @@ function ElementStack({ stackInstanceIds={ stack.elements?.map((element) => element.id) ?? [] } + showSeparator={ + element.elementType === ElementType.Flashcard + } /> { setStudentResponse({}) @@ -177,7 +180,7 @@ function ElementStack({ {/* display mark all as read button, if only content elements have not been answered yet */} {typeof stackStorage === 'undefined' && showMarkAsRead && (
-
+ {showSeparator &&
}
) } diff --git a/packages/shared-components/src/ChoicesQuestion.tsx b/packages/shared-components/src/ChoicesQuestion.tsx index cb707ab06a..952df38b65 100644 --- a/packages/shared-components/src/ChoicesQuestion.tsx +++ b/packages/shared-components/src/ChoicesQuestion.tsx @@ -48,7 +48,7 @@ function ChoicesQuestion({ {content !== '
' && (
diff --git a/packages/shared-components/src/ContentElement.tsx b/packages/shared-components/src/ContentElement.tsx index 60b808119b..388d93dc02 100644 --- a/packages/shared-components/src/ContentElement.tsx +++ b/packages/shared-components/src/ContentElement.tsx @@ -27,7 +27,7 @@ function ContentElement({ return (
' && (
diff --git a/packages/shared-components/src/NumericalQuestion.tsx b/packages/shared-components/src/NumericalQuestion.tsx index f29f7e9b7d..5b194f52e5 100644 --- a/packages/shared-components/src/NumericalQuestion.tsx +++ b/packages/shared-components/src/NumericalQuestion.tsx @@ -40,7 +40,7 @@ function NumericalQuestion({ {content !== '
' && (
From 24bb5af4164d57bfbc933cc2c12d1e2242c301c5 Mon Sep 17 00:00:00 2001 From: sjschlapbach Date: Tue, 27 Aug 2024 17:48:41 +0200 Subject: [PATCH 2/4] fix(packages/shared-components): fix debounced validation of username field --- packages/shared-components/src/DebouncedUsernameField.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/shared-components/src/DebouncedUsernameField.tsx b/packages/shared-components/src/DebouncedUsernameField.tsx index 01c3e0266d..83eb66a454 100644 --- a/packages/shared-components/src/DebouncedUsernameField.tsx +++ b/packages/shared-components/src/DebouncedUsernameField.tsx @@ -72,7 +72,6 @@ function DebouncedUsernameField({ return ( Date: Tue, 27 Aug 2024 18:10:53 +0200 Subject: [PATCH 3/4] chore(release): 3.2.0-alpha.10 --- CHANGELOG.md | 12 ++++++++++++ apps/auth/package.json | 2 +- apps/backend-docker/package.json | 2 +- apps/docs/package.json | 2 +- apps/frontend-control/package.json | 2 +- apps/frontend-manage/package.json | 2 +- apps/frontend-pwa/package.json | 2 +- apps/func-incoming-responses/package.json | 2 +- apps/func-migration-v2-export/package.json | 2 +- apps/func-migration-v3-import/package.json | 2 +- apps/func-response-processor/package.json | 2 +- apps/office-addin/package.json | 2 +- package.json | 2 +- packages/grading/package.json | 2 +- packages/graphql/package.json | 2 +- packages/markdown/package.json | 2 +- packages/prisma/package.json | 2 +- 17 files changed, 28 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ff20317c49..35584fc4bd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,18 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +## [3.2.0-alpha.10](https://github.com/uzh-bf/klicker-uzh/compare/v3.2.0-alpha.9...v3.2.0-alpha.10) (2024-08-27) + + +### Bug Fixes + +* **packages/shared-components:** fix debounced validation of username field ([24bb5af](https://github.com/uzh-bf/klicker-uzh/commit/24bb5af4164d57bfbc933cc2c12d1e2242c301c5)) + + +### Other + +* simplify styling of element stack and improve placement of element feedback icons ([7055c6d](https://github.com/uzh-bf/klicker-uzh/commit/7055c6d8ba0ba7f7638aa05cf726eabec81cd403)) + ## [3.2.0-alpha.9](https://github.com/uzh-bf/klicker-uzh/compare/v3.2.0-alpha.8...v3.2.0-alpha.9) (2024-08-25) diff --git a/apps/auth/package.json b/apps/auth/package.json index e9f04112c6..26adb99b8a 100644 --- a/apps/auth/package.json +++ b/apps/auth/package.json @@ -1,6 +1,6 @@ { "name": "@klicker-uzh/auth", - "version": "3.2.0-alpha.9", + "version": "3.2.0-alpha.10", "license": "AGPL-3.0", "dependencies": { "@klicker-uzh/i18n": "workspace:*", diff --git a/apps/backend-docker/package.json b/apps/backend-docker/package.json index f38c11cbfe..0f65382a1e 100644 --- a/apps/backend-docker/package.json +++ b/apps/backend-docker/package.json @@ -1,6 +1,6 @@ { "name": "@klicker-uzh/backend-docker", - "version": "3.2.0-alpha.9", + "version": "3.2.0-alpha.10", "license": "AGPL-3.0", "type": "module", "main": "dist/index.js", diff --git a/apps/docs/package.json b/apps/docs/package.json index 5cc770adbe..011d8035af 100644 --- a/apps/docs/package.json +++ b/apps/docs/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@klicker-uzh/docs", - "version": "3.2.0-alpha.9", + "version": "3.2.0-alpha.10", "license": "AGPL-3.0", "dependencies": { "@docusaurus/core": "3.0.0-alpha.0", diff --git a/apps/frontend-control/package.json b/apps/frontend-control/package.json index ddbece1122..bebe30ae44 100644 --- a/apps/frontend-control/package.json +++ b/apps/frontend-control/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@klicker-uzh/frontend-control", - "version": "3.2.0-alpha.9", + "version": "3.2.0-alpha.10", "license": "AGPL-3.0", "dependencies": { "@apollo/client": "3.8.3", diff --git a/apps/frontend-manage/package.json b/apps/frontend-manage/package.json index f337cbbc48..a2a2600c93 100644 --- a/apps/frontend-manage/package.json +++ b/apps/frontend-manage/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@klicker-uzh/frontend-manage", - "version": "3.2.0-alpha.9", + "version": "3.2.0-alpha.10", "license": "AGPL-3.0", "dependencies": { "@apollo/client": "3.8.3", diff --git a/apps/frontend-pwa/package.json b/apps/frontend-pwa/package.json index 7b2fed6813..ac82e2412b 100644 --- a/apps/frontend-pwa/package.json +++ b/apps/frontend-pwa/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@klicker-uzh/frontend-pwa", - "version": "3.2.0-alpha.9", + "version": "3.2.0-alpha.10", "license": "AGPL-3.0", "dependencies": { "@apollo/client": "3.8.3", diff --git a/apps/func-incoming-responses/package.json b/apps/func-incoming-responses/package.json index fb53b2448c..2f41df3853 100644 --- a/apps/func-incoming-responses/package.json +++ b/apps/func-incoming-responses/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@klicker-uzh/func-incoming-responses", - "version": "3.2.0-alpha.9", + "version": "3.2.0-alpha.10", "license": "AGPL-3.0", "main": "dist/index.js", "files": [ diff --git a/apps/func-migration-v2-export/package.json b/apps/func-migration-v2-export/package.json index 7a3a2ea57b..b27ac37c1a 100644 --- a/apps/func-migration-v2-export/package.json +++ b/apps/func-migration-v2-export/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@klicker-uzh/func-migration-v2-export", - "version": "3.2.0-alpha.9", + "version": "3.2.0-alpha.10", "license": "AGPL-3.0", "main": "dist/index.js", "files": [ diff --git a/apps/func-migration-v3-import/package.json b/apps/func-migration-v3-import/package.json index 4e371d9d52..29c005693f 100644 --- a/apps/func-migration-v3-import/package.json +++ b/apps/func-migration-v3-import/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@klicker-uzh/func-migration-v3-import", - "version": "3.2.0-alpha.9", + "version": "3.2.0-alpha.10", "license": "AGPL-3.0", "main": "dist/index.js", "files": [ diff --git a/apps/func-response-processor/package.json b/apps/func-response-processor/package.json index 97b3d37d2e..3d044e1aa8 100644 --- a/apps/func-response-processor/package.json +++ b/apps/func-response-processor/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@klicker-uzh/func-response-processor", - "version": "3.2.0-alpha.9", + "version": "3.2.0-alpha.10", "license": "AGPL-3.0", "main": "dist/index.js", "files": [ diff --git a/apps/office-addin/package.json b/apps/office-addin/package.json index d76b990bc2..538a02614e 100644 --- a/apps/office-addin/package.json +++ b/apps/office-addin/package.json @@ -1,6 +1,6 @@ { "name": "@klicker-uzh/office-addin", - "version": "3.2.0-alpha.9", + "version": "3.2.0-alpha.10", "license": "AGPL-3.0", "dependencies": { "@uzh-bf/design-system": "3.0.0-alpha.22", diff --git a/package.json b/package.json index 40732d873b..7c75c6e89f 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "private": true, "name": "@klicker-uzh/monorepo", "description": "KlickerUZH instant-class-response system.", - "version": "3.2.0-alpha.9", + "version": "3.2.0-alpha.10", "repository": "uzh-bf/klicker-uzh.git", "homepage": "https://www.klicker.uzh.ch/", "bugs": "https://github.com/uzh-bf/klicker-uzh/issues", diff --git a/packages/grading/package.json b/packages/grading/package.json index 8bd2141951..d8057a503d 100644 --- a/packages/grading/package.json +++ b/packages/grading/package.json @@ -1,6 +1,6 @@ { "name": "@klicker-uzh/grading", - "version": "3.2.0-alpha.9", + "version": "3.2.0-alpha.10", "license": "AGPL-3.0", "type": "module", "main": "dist/index.js", diff --git a/packages/graphql/package.json b/packages/graphql/package.json index 8abfe021c9..8bc8d8b5e2 100644 --- a/packages/graphql/package.json +++ b/packages/graphql/package.json @@ -1,6 +1,6 @@ { "name": "@klicker-uzh/graphql", - "version": "3.2.0-alpha.9", + "version": "3.2.0-alpha.10", "license": "AGPL-3.0", "type": "module", "main": "dist/index.js", diff --git a/packages/markdown/package.json b/packages/markdown/package.json index be7e6ba22f..07f0b02017 100644 --- a/packages/markdown/package.json +++ b/packages/markdown/package.json @@ -1,6 +1,6 @@ { "name": "@klicker-uzh/markdown", - "version": "3.2.0-alpha.9", + "version": "3.2.0-alpha.10", "license": "AGPL-3.0", "type": "module", "main": "dist/index.js", diff --git a/packages/prisma/package.json b/packages/prisma/package.json index bab061fd87..b4c0b66f28 100644 --- a/packages/prisma/package.json +++ b/packages/prisma/package.json @@ -1,6 +1,6 @@ { "name": "@klicker-uzh/prisma", - "version": "3.2.0-alpha.9", + "version": "3.2.0-alpha.10", "license": "AGPL-3.0", "type": "module", "main": "dist/index.js", From d6beef83f8b246133557e8ff92ddee9d39b800b0 Mon Sep 17 00:00:00 2001 From: sjschlapbach Date: Tue, 27 Aug 2024 18:53:17 +0200 Subject: [PATCH 4/4] fix(packages/graphql): ensure that practice quiz stacks are only ordered based on answers when spaced repetition logic is enabled --- .../graphql/src/services/practiceQuizzes.ts | 29 ++++++++++--------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/packages/graphql/src/services/practiceQuizzes.ts b/packages/graphql/src/services/practiceQuizzes.ts index 66eb8ee546..4f3bceefb0 100644 --- a/packages/graphql/src/services/practiceQuizzes.ts +++ b/packages/graphql/src/services/practiceQuizzes.ts @@ -114,10 +114,11 @@ export async function getPracticeQuizData( } if (ctx.user?.sub && ctx.user.role === UserRole.PARTICIPANT) { - // TODO: add time decay as well // TODO: adapt the implementation to multiple instances per stack - resorting inside the stack does probably not make sense - // const orderedStacks = quiz.stacks.toSorted((a, b) => { // TODO: use once nodejs 20 is used - const orderedStacks = orderStacks(quiz.stacks) + const orderedStacks = + quiz.orderType === ElementOrderType.SPACED_REPETITION + ? orderStacks(quiz.stacks) + : quiz.stacks return { ...quiz, @@ -178,8 +179,8 @@ function combineCorrectnessParams({ increment: correct ? 1 : existingResponse - ? -existingResponse.correctCountStreak - : 0, + ? -existingResponse.correctCountStreak + : 0, }, lastCorrectAt: correct ? new Date() : undefined, @@ -561,14 +562,14 @@ async function respondToFlashcard( response === FlashcardCorrectness.CORRECT ? 1 : response === FlashcardCorrectness.PARTIAL - ? 0.5 - : 0 + ? 0.5 + : 0 const responseCorrectness = correctness === 1 ? ResponseCorrectness.CORRECT : correctness === 0 - ? ResponseCorrectness.WRONG - : ResponseCorrectness.PARTIAL + ? ResponseCorrectness.WRONG + : ResponseCorrectness.PARTIAL const resultSpacedRepetition = updateSpacedRepetition({ eFactor: existingResponse?.eFactor || 2.5, interval: existingResponse?.interval || 1, @@ -1605,8 +1606,8 @@ export async function respondToQuestion( correctness === 1 ? ResponseCorrectness.CORRECT : correctness === 0 - ? ResponseCorrectness.WRONG - : ResponseCorrectness.PARTIAL + ? ResponseCorrectness.WRONG + : ResponseCorrectness.PARTIAL promises.push( ctx.prisma.questionResponse.upsert({ @@ -1812,8 +1813,8 @@ export async function respondToQuestion( evaluation?.percentile === 0 ? StackFeedbackStatus.INCORRECT : evaluation?.percentile === 1 - ? StackFeedbackStatus.CORRECT - : StackFeedbackStatus.PARTIAL + ? StackFeedbackStatus.CORRECT + : StackFeedbackStatus.PARTIAL console.log({ ...evaluation, @@ -2153,7 +2154,7 @@ export async function manipulatePracticeQuiz( const availabilityTime = availableFrom && dayjs(availableFrom).isBefore(dayjs()) ? null - : availableFrom ?? undefined + : (availableFrom ?? undefined) const createOrUpdateJSON = { name: name.trim(),