-
Notifications
You must be signed in to change notification settings - Fork 121
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
[WIP]Optimize gradebook csv export/import #456
base: main
Are you sure you want to change the base?
Conversation
Codecov Report
@@ Coverage Diff @@
## master #456 +/- ##
==========================================
+ Coverage 67.36% 68.31% +0.95%
==========================================
Files 46 46
Lines 10933 11119 +186
Branches 2041 2087 +46
==========================================
+ Hits 7365 7596 +231
+ Misses 2936 2893 -43
+ Partials 632 630 -2
Continue to review full report at Codecov.
|
f204428
to
9d8bc55
Compare
f6d99b5
to
7c54fc0
Compare
7c54fc0
to
ded9cbe
Compare
ded9cbe
to
99e8f6f
Compare
@inducer How do you feel about this PR? I am not confident in the naming. Thanks. |
842d8ca
to
2c6a17f
Compare
2c6a17f
to
d08c457
Compare
course/grades.py
Outdated
initial=0, | ||
min_value=0, | ||
max_value=100 * MAX_EXTRA_CREDIT_FACTOR, | ||
label=_("Minimum points"), |
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.
Could use a help text. Don't know what it does.
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.
All done.
course/grades.py
Outdated
min_value=0, | ||
initial=0, | ||
max_value=2, | ||
label=_("Round Digits"), |
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.
Help text.
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.
Or maybe change label to "Round point counts to N digits" and "Round percentages to N digits". Also, why max out at 2?
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 previously set that to 4, and I found (in tests) the value are all rounded to 2 digits already, had thought that's preset behavior. Since you commented on this, I'll check that.
course/grades.py
Outdated
required=False, | ||
initial=False, | ||
label=_("Use 0 point for grade state `NONE`, which possibly " | ||
"means the opptunity had not been graded."), |
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.
Why "possibly"?
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.
That's why I opened #457 . I think it's quite confusing. both not-graded-yet and graded can result in None
. Also, those participations who didn't open a session for the grading opportunity also get None
.
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 just opened an issue #461 about NONE
.
course/grades.py
Outdated
self.fields["exclude_tas"] = forms.BooleanField( | ||
required=False, | ||
initial=True, | ||
label=_("Exclude Grades of Teaching assistants"), |
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.
"Teaching assistant" and "Instructor" are not concepts in Relate. That means you may not use them in any UI. (They used to be, but they no longer are.) Right now, there are just arbitrarily-defined roles. The only thing available is a "permission" that says whether a role's/participant's grades are to be included in the grades.
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.
course/utils.py
Outdated
@@ -1320,4 +1324,215 @@ def _render_notebook_from_source( | |||
|
|||
# }}} | |||
|
|||
|
|||
class RelateCsvHandler(object): | |||
# Tests ref tests.template_backends.test_django.DjangoTemplatesTests |
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 have no idea what this does and why it belongs here.
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.
Why is this not in checks.py
?
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.
It could stand renaming to RelateCSVSettingsValidator
or some such maybe?
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 have no idea what this does and why it belongs here.
It's something that make the a csv configuration (currently for csv export) from settings.RelateCSVSetting, by check and add some default value if not configured, and packaged some methods like generate the user attribute choice fields (in the ExportCsvForm) for csv export.
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.
Why is this not in
checks.py
?
As mentioned above, it's functionalities are not limited to check only, do you prefer to put that in checks.py
? Won't it look weird to import a function from checks.py
?.
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.
It could stand renaming to RelateCSVSettingsValidator or some such maybe?
What about RelateCSVSettingsInitializer
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.
docstring added.
af9bd54
to
8f22e8f
Compare
Updated. |
) | ||
|
||
csv_settings = RelateCSVSettingsInitializer() |
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.
Can we do without this global variable somehow?
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'd much prefer a function, for example.)
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.
In fact, the csv_setting
object created here is intended to be an app global object, since I am creating the object with its properties to be cached_properties
, each of which need to be calculated only once.
However, I agree it's not elegant to use it here in this way. What about initialize the csv_settings
object, i.e.,
csv_settings = RelateCSVSettingsInitializer()
in utils.py
, and then import it in grades.py
. Will that be better?
label=_("0 percentage for graded 'NONE'"), | ||
help_text=string_concat( | ||
_("Use 0 percentage for graded opportunities which have " | ||
"`NONE` points."), |
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.
"NONE
points" reads awkwardly. Maybe "that do not currently have a defined point count."
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.
That's fair. I think then we should notice user if False
, it will result in NONE
in the csv.
help_text=_( | ||
"If selected, grades of course staff (participations who " | ||
"have '%(permission)s' permissions) will be excluded." | ||
% {"permission": pperm.assign_grade}), |
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.
Why not base this on the existing pperm.included_in_grade_statistics
?
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.
That's fair.
I felt this PR should be WIP before #461 is resolved, so that we can full test grade status and gradebook behavior. |
Features: