-
Notifications
You must be signed in to change notification settings - Fork 0
Feat: Introduce knowledge retainment score to KnowledgeCheckCard #258
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Marty-Byrde
wants to merge
20
commits into
canary
Choose a base branch
from
feat/knowledgeCheck-degrading-score
base: canary
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
064c2c8
ref: added aria label to edit-question button
Marty-Byrde aea7ce6
ref: added translations to role in `KnowCheckCard`
Marty-Byrde 7e14fb7
ref: moved `Field` description into `Tooltip`
Marty-Byrde 8c4897c
style: updated `color-scheme` to change with color-mode
Marty-Byrde bc6ef0d
style: improved `Input` disabled color intensity
Marty-Byrde 96df01d
style: prefixed hover, focus styles with enabled in `Button`
Marty-Byrde 81a8979
style: updated outline `Button` variant ring styles
Marty-Byrde b2540a1
feat: introduce `DegradingScoreIndicator` component
Marty-Byrde 9018bdc
ref: positioned `DegSIndicator` top left
Marty-Byrde 09819e1
ref: positioned `DegSIndicator` in footer
Marty-Byrde 122a322
style: improved `DegrScoreIndic` color range
Marty-Byrde 5d1ef09
ref: updated retainment level based tooltip contents
Marty-Byrde a7fd286
ref: re-introduced `DegrSIndicator` to card header
Marty-Byrde 0bf1d38
style: added light mode colors to `DegSIndicator`
Marty-Byrde c11a095
ref: fixed typos in color and text declarations
Marty-Byrde da282a6
feat: drafted `computeKnowledgeRetainment` module
Marty-Byrde 43abd96
Merge branch 'ref/minor-code-and-styling-improvements' into feat/know…
Marty-Byrde 2a95d4c
Merge branch 'canary' into feat/knowledgeCheck-degrading-score
Marty-Byrde c749d09
ref: moved user role into top center of `KnowCCard`
Marty-Byrde d674f9d
style: aligned `DegScoreIndicator` with card header
Marty-Byrde File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| import Tooltip from '@/src/components/Shared/Tooltip' | ||
| import { cn } from '@/src/lib/Shared/utils' | ||
|
|
||
| /** | ||
| * | ||
| * @param knowledgeCheckScore A number between 0 and 100 where 100 means the user has likely retained 100% of the knowledge that he learned and had his exam about. | ||
| */ | ||
| export default function DegradingScoreIndicator({ knowledgeCheckScore, className }: { knowledgeCheckScore: number | undefined; className?: string }) { | ||
| // very well retained, well-retained, good overview, mediocre, basic, lost | ||
| let level: '95-100' | '80-95' | '60-80' | '40-60' | '20-40' | '0-20' | 'none' = 'none' | ||
|
|
||
| if (knowledgeCheckScore === undefined) level = 'none' | ||
| else if (knowledgeCheckScore >= 95) level = '95-100' | ||
| else if (knowledgeCheckScore >= 80) level = '80-95' | ||
| else if (knowledgeCheckScore >= 60) level = '60-80' | ||
| else if (knowledgeCheckScore >= 40) level = '40-60' | ||
| else if (knowledgeCheckScore >= 20) level = '20-40' | ||
| else if (knowledgeCheckScore >= 0) level = '0-20' | ||
|
|
||
| if (knowledgeCheckScore && knowledgeCheckScore > 100) knowledgeCheckScore = 100 | ||
|
|
||
| let scoreMessage: string = '' | ||
|
|
||
| switch (level) { | ||
| case '95-100': { | ||
| scoreMessage = 'Almost 100% of the Knowledge is most likely still retained' | ||
| break | ||
| } | ||
| case '80-95': { | ||
| scoreMessage = 'Most of the Knowledge gained by this check is retained' | ||
| break | ||
| } | ||
| case '60-80': { | ||
| scoreMessage = 'Big Chunks of Knowledge are still retained' | ||
| break | ||
| } | ||
| case '40-60': { | ||
| scoreMessage = 'While some Knowledge parts are retained, a large part might have been forgotten' | ||
| break | ||
| } | ||
| case '20-40': { | ||
| scoreMessage = 'Most of the Knowledge delivered by this check is no longer retained' | ||
| break | ||
| } | ||
| case '0-20': { | ||
| scoreMessage = 'The contents and knowledge delivered by this check are no longer retained' | ||
| break | ||
| } | ||
| case 'none': | ||
| } | ||
|
Marty-Byrde marked this conversation as resolved.
|
||
|
|
||
| return ( | ||
| <Tooltip content={scoreMessage} delay={100}> | ||
| <div | ||
| className={cn( | ||
| 'relative bg-neutral-300 text-xs select-none dark:bg-neutral-500/80', | ||
|
|
||
| level === '0-20' && 'bg-[oklch(80%_0.25_30)] dark:bg-[oklch(40%_0.12_30)]', | ||
| level === '20-40' && 'bg-[oklch(88%_0.08_45)] dark:bg-[oklch(30%_0.09_30)]', | ||
| level === '40-60' && 'bg-[oklch(88%_0.08_110)] dark:bg-[oklch(32%_0.2_110)]', | ||
| level === '60-80' && 'bg-[oklch(85%_0.08_116)] dark:bg-[oklch(32%_0.2_116)]', | ||
| level === '80-95' && 'bg-[oklch(85%_0.10_155)] dark:bg-[oklch(35%_0.3_155)]', | ||
| level === '95-100' && 'bg-[oklch(85%_0.2_140)] dark:bg-[oklch(40%_0.37_155)]', | ||
| className, | ||
| )}> | ||
| <span className='flex items-center justify-center'>{knowledgeCheckScore ?? 0}</span> | ||
| </div> | ||
| </Tooltip> | ||
| ) | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| import { KnowledgeCheck } from '@/src/schemas/KnowledgeCheck' | ||
|
|
||
| /** | ||
| * This function computes the knowledge retainment score of a given user for a given check based on the difficulty and last practice / examination and the respective score. | ||
| * The more time has passed and the more difficult a check is the faster knowledge degrades --> thus lower retainment score. | ||
| * @param | ||
| */ | ||
| export function computeKnowledgeRetainment({ difficulty }: Pick<KnowledgeCheck, 'difficulty'>) { | ||
| const randomScore = Math.random() * 100 | ||
| const skewedScore = randomScore * 1.7 | ||
|
|
||
| return skewedScore > 100 ? 100 : Math.floor(skewedScore) | ||
|
Marty-Byrde marked this conversation as resolved.
|
||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Localize user-facing score messages.
These strings bypass i18n, while the rest of the card uses localized labels. Please wire them through
useScopedI18n(or equivalent) to keep translations consistent.🤖 Prompt for AI Agents