Skip to content
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

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

peasantbird
Copy link
Contributor

Fixes #12547

Outline of Solution

  1. Allow weights to be null in validateQuestionDetails()
  2. Update tooltip for "Options are weighted" checkbox
  3. Show '-' for weighted percentages for options with empty weights
  4. Update headers in per recipient statistics to show empty weights (denoted by Option[-])
  5. Calculate correct total and average scores (skip over empty weights)
  6. Show '-' for total and average when all options have empty weights

Screenshots

MCQ with empty weights can be saved:

image

MSQ with empty weights can be saved:

image

MCQ Feedback session results:

When all weights are empty:

image

With one or more non-empty weights:

image

MSQ Feedback session results:

When all weights are empty:

image

With one or more non-empty weights:

image

Copy link

Hi @peasantbird, thank you for your interest in contributing to TEAMMATES!
However, your PR does not appear to follow our contribution guidelines:

  • Title must start with the issue number the PR is fixing in square brackets, e.g. [#<issue-number>]

Please address the above before we proceed to review your PR.

@peasantbird peasantbird changed the title Feat/empty weights for mcq msq [#12547] Empty weights for MCQ Mar 24, 2025
@jasonqiu212 jasonqiu212 self-requested a review March 24, 2025 05:31
@peasantbird peasantbird self-assigned this Mar 24, 2025
Copy link
Contributor

@jasonqiu212 jasonqiu212 left a 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:

  1. 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
  1. 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 [-]".
Screenshot 2025-03-24 at 4 08 05 PM
  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:
Screenshot 2025-03-24 at 4 23 58 PM
  1. 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
Screenshot 2025-03-24 at 4 17 36 PM

Comment on lines 63 to +66
const weight: number = this.weightPerOption[answer];
if (weight === null) {
continue;
}
Copy link
Contributor

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

Copy link
Contributor

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 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Empty weights for MCQ
2 participants