-
-
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
base: main
Are you sure you want to change the base?
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 705ca92): https://sharezone-test--pr1810-test-subject-weights-hdzacmrr.web.app (expires Fri, 07 Feb 2025 16:36:34 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: 4cb3ae61e1e018abfd9841fd3239f5b49ccc034b |
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. |
Fixes #1803