-
-
Notifications
You must be signed in to change notification settings - Fork 51
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
Fix changing subject weights #1810
Conversation
…s to prevent developer confusion.
…no weights if term has no default weights and subject has no weights'
…ct has no weights and inherits them from term'
…eightType.inheritFromTerm}'
…tType.perGradeType}'
…s we dont support it yet'
…s final grade type'
Visit the preview URL for this PR (updated for commit 5d2522f): https://sharezone-test--pr1810-test-subject-weights-0k96zc4i.web.app (expires Tue, 11 Feb 2025 21:40:18 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: 4cb3ae61e1e018abfd9841fd3239f5b49ccc034b |
(Just a note for myself) Inside the private grade logic a class called class NonNegativeWeight extends Weight {
factory NonNegativeWeight.fromWeight(Weight weight) =>
NonNegativeWeight.factor(weight.asFactor);
NonNegativeWeight.factor(num factor) : super.factor(factor) {
if (factor < 0) {
throw ArgumentError('Weight must be non-negative');
}
}
NonNegativeWeight.percent(num percent) : super.percent(percent) {
if (percent < 0) {
throw ArgumentError('Weight must be non-negative');
}
}
} Inside late IMap<GradeTypeId, Weight> _weights;
// ...
SubjectSettingsPageController({
required this.subRef,
required this.gradesService,
}) {
//...
_weights = _getTerm()!.gradeTypeWeightings;
//...
} This threw the following error:
This is unexpected for the consuming code of the grades logic. |
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.
Thanks for fixing ❤️ I added the bug back then 😭
Fixes #1803