-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Fix LTI max_score method. #1819
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -88,7 +88,13 @@ class LTIFields(object): | |
| custom_parameters = List(help="Custom parameters (vbid, book_location, etc..)", scope=Scope.settings) | ||
| open_in_a_new_page = Boolean(help="Should LTI be opened in new page?", default=True, scope=Scope.settings) | ||
| graded = Boolean(help="Grades will be considered in overall score.", default=False, scope=Scope.settings) | ||
| weight = Float(help="Weight for student grades.", default=1.0, scope=Scope.settings) | ||
| weight = Float( | ||
| help="Weight for student grades.", | ||
| default=1.0, | ||
| scope=Scope.settings, | ||
| values={"min": 0}, | ||
| ) | ||
| has_score = Boolean(help="Does this LTI module have score?", default=False, scope=Scope.settings) | ||
|
|
||
|
|
||
| class LTIModule(LTIFields, XModule): | ||
|
|
@@ -375,7 +381,7 @@ def oauth_params(self, custom_parameters, client_key, client_secret): | |
| return params | ||
|
|
||
| def max_score(self): | ||
| return self.weight | ||
| return self.weight if self.has_score else None | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. LTI has no get_score, and it works successfully. Why it needs get_score? @cpennington
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
|
||
|
|
||
| @XBlock.handler | ||
|
|
@@ -581,6 +587,5 @@ class LTIDescriptor(LTIFields, MetadataOnlyEditingDescriptor, EmptyDataRawDescri | |
| """ | ||
| Descriptor for LTI Xmodule. | ||
| """ | ||
| has_score = True | ||
| module_class = LTIModule | ||
| grade_handler = module_attr('grade_handler') | ||
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 doesn't look like the right way to do this.
has_scoreis a class attribute that is never modified. Is it correct to make it a field in this module that shadows the class attribute? @cpennington ?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.
@nedbat This is result of discussion with @cpennington
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.
Note, that class attribute is removed.
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.
Yeah, we talked about this this morning.
has_scoreis never accessed as a class attribute, and it covers exactly the use-case that @auraz was concerned about (distinguishing between non-scored and scored LTI modules), in a way that 'graded' doesn't.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.
OK.