-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
[#12547] Empty weights for MCQ #13282
base: master
Are you sure you want to change the base?
[#12547] Empty weights for MCQ #13282
Conversation
Hi @peasantbird, thank you for your interest in contributing to TEAMMATES!
Please address the above before we proceed to review your PR. |
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.
Sorry this review took so long.. You're PR is on the right track! Some observations:
- Users cannot give the "other" option an empty weight. System will always change it to 0.
Screen.Recording.2025-03-24.at.4.04.58.PM.mov
- In the below image, for the column titles for Per Recipient Statistics, let's add a space between the option label and assigned weight for readability. For instance, "option 1 [-]".

- Also would it be possible to add a tooltip icon behind "Per Recipient Statistics" to indicate the format used for "Option 1 [-]"? Similar to this:

- When I download the results, the display of the null values should be handled too (i.e., display using "-"). You can refer to [#12544] Rubric Question Statistics: Handle empty weights #12545 and see how I modified
src/web/app/components/question-types/question-statistics/rubric-question-statistics.component.ts
to fix this similar problem

const weight: number = this.weightPerOption[answer]; | ||
if (weight === null) { | ||
continue; | ||
} |
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.
This code is correct! but I was just initially puzzled by how we can set weight to be null
when it's of number
type. Turns out we can.. by doing const weight: number = null as any;
to bypass the type checking, and i think that's what we're doing here.
I think we should follow TypeScript's type safety as best as we can for both type safety and readability. Thus, I think we need to change the following:
Line 17: weightPerOption: Record<string, number | null> = {};
Line 18: weightedPercentagePerOption: Record<string, number | null> = {};
Line 48: const weight: number | null = this.question.mcqWeights[i];
Line 57: const weight: number | null = this.weightPerOption[answer];
Line 58: Add a null check, similar to what you did here
Line 63: const weight: number | null = this.weightPerOption[answer];
... probably many more, please add as you see fit
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.
I realized I did not do this in #12545 and set a bad example 🙏
Fixes #12547
Outline of Solution
validateQuestionDetails()
weighted percentages
for options with empty weightsheaders
in per recipient statistics to show empty weights (denoted by Option[-])total
andaverage
scores (skip over empty weights)total
andaverage
when all options have empty weightsScreenshots
MCQ with empty weights can be saved:
MSQ with empty weights can be saved:
MCQ Feedback session results:
When all weights are empty:
With one or more non-empty weights:
MSQ Feedback session results:
When all weights are empty:
With one or more non-empty weights: