-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Sjang92/advanced settings feedback #4454
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
Sjang92/advanced settings feedback #4454
Conversation
|
When you're through your feedback, you'll need to squash and recommit. When you do, the commit message needs some editing: Insert a blank line after the first line. Are these two thoughts, or one? If they're part of the same thought, eliminate the internal linebreak. If they're separate, insert an extra linebreak. Also, this sentence saying that instructors aren't notified is unclear to me: are you saying that before this commit, they weren't being notified, or are you saying that as of this commit, they are no longer being notified? This could use a little clarification. Also, window should have a w. This is good. I like it. 'discrepancy' has an 'a' in the middle. Comma splices are controversial. Perhaps you could just say, "POST requests to course.py call to..."? |
|
There's a UI component here for error reporting that @caesar2164 should look at. |
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 these two lines, you refer to request.json[ADVANCED_COMPONENT_POLICY_KEY]["value"] twice; you should probably memoize it, like:
# Check if the user has incorrectl failed to put the value in an iterable.
policy_value = request.json[ADVANCED_COMPONENT_POLICY_KEY]["value"]
if isinstance(policy_key, collections.Iterable):
if ac_type in policy_key:
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.
But I'd rather you not use isinstance() if you don't have to.
http://stackoverflow.com/questions/1952464/in-python-how-do-i-determine-if-an-object-is-iterable has some alternatives, including using hasattr() to look for the iter and getitem magic methods, calling iter() on it and catching the exception, or just assuming it's iterable and catching the exception.
If this check isn't here and the thing returned isn't a container type, what happens?
|
UI wise this is good! So that's good, but tests are failing :( |
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.
If you're indenting the code below you should indent the comment too.
|
Oh, nice screenshot. |
|
As I mentioned on @njdup's last PR, you can find a lot of nitpicky stuff by logging into your devstack box, going to the edx-platform directory and running: |
|
Python tests are failing for me, but that may be my devstack box. But I notice the Jenkins build failed too. |
|
Way to go controlling the whitespace. |
|
@cahrens or @andy-armstrong ? |
|
@nedbat Studio review of this PR will need to be scheduled-- it's not something we can pick up right away. I will talk to our product owner about it. |
|
Reflected Joe's comments & tests all passing now |
|
@cahrens just in case this is useful info for scheduling, @sjang92 is a On Thu, Jul 17, 2014 at 8:22 AM, Christina Roberts <notifications@github.com
|
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 put a newline above this line.
|
Nitpick on the commit message: 'discrepancy' still has an 'a' in the middle. :-) |
|
Additional nitpick on commit message: last stanza still contains a comma splice that I find somewhat strange. Rewriting the sentence that begins "course.py, upon receiving a POST ajax request," so that is either in the form 'X done to Y causes Z' or the form 'Z when X done to Y' would probably help it be clearer. |
aca7753 to
233f892
Compare
|
@cahrens jshint conforming and suggested fixes are in place now. |
3120870 to
db32fa8
Compare
|
Hi @sjang92. I'm taking over this review for Christina as she's on vacation this week. I'm going to try it out now, but I was wondering about the test failure. Is this a problem that you know about and that you can fix, or do you need help? I'd like to get a clean build so I can verify the code quality and coverage reports. |
905f82a to
b486c87
Compare
|
@sjang92 I've verified the changes and they look great to me. This is an excellent improvement over what we had. One minor thing that I noticed: the validation of JSON inputs appears to be incomplete. It correctly rejects values of different types, e.g. a number, but it silently rejects parseable but invalid JSON strings. For example, I edited the "Cohort Configuration" field and it silently rejected the string Once there's a clean build and the coverage looks good then I'll go ahead and merge this. |
|
@andy-armstrong Could you tell me more about the invalid json string input? Is it supposed to parse it and take it as a valid input? |
|
I just tried feeding a number of pareseable inputs to List and Dict type fields (ex. Advanced Modules List) and they seem to be parsing correctly before saving. So no Validation error is seen in these cases. Cohort Configuration does fail though. Maybe it doesn't go through parsing? (It says Cohort Configuration is not supported by Edx? ) |
|
@sjang92 Another example is entering As I said, this is probably out of scope for this PR because I know we need to get it merged. It is just an interesting validation problem. |
|
Hmm once I get a clean build and get this merged, I'll look into it! |
|
Sounds great, thanks! |
d902dd1 to
c33287f
Compare
|
@andy-armstrong All tests passing :) |
|
Congrats @sjang92! The build reports show a couple of issues that should be addressed, and then we should be good to go:
https://jenkins.testeng.edx.org/job/edx-platform-report/6103/Diff_Coverage_Report/
https://jenkins.testeng.edx.org/job/edx-platform-report/6103/Diff_Quality_Report/ |
c33287f to
2ff4f1f
Compare
|
@andy-armstrong Tests in for JsonResponseBadRequest. For PyLint, I left the incomplete-protocol one. I'm not quite sure if I have to touch that? |
|
@sjang92 Thanks, that's looking a lot better. I'm okay with ignoring the incomplete-prototocol warning as there are a lot of discussions on the internet about how unreasonable that warning is. However, can you fix the missing docstring reported by PyLint, and it would also be preferable if your tests caused advanced_settings_handler to return a JsonResponseBadRequest to get coverage on that line too. Wherever possible we prefer to have 100% diff coverage and right now course.py is only at 86.7% https://jenkins.testeng.edx.org/job/edx-platform-report/6111/Diff_Coverage_Report/ |
This commit adds validation for course advanced settings. Currently when course
administrators make invalid changes in the Settings/Advanced Settings tab,
they're not notified through a new modal window of the list of invalid settings
changes.
* Extending CourseMetadata
- Previously, we only had update_from_json method in CourseMetadata.py,
and it was only validating one field every POST request.
- Now we have validate_and_update_from_json method that encapsulates the
functionality of update_from_json into a validation call
- To avoid discrepancy of validation standards between modules, validation
uses the from_json method implemented to each field in xblock.
* Different Response in advanced settings ajax requests
- After receiving a POST ajax request, course.py calls
validate_and_update_from_json, and sends a json object of either:
1) valid course metadata model
2) error objects
* Error Messages shown in validation-error-modal
- error objects passed through ajax are shown in a separate modal.
2ff4f1f to
11d2609
Compare
|
@andy-armstrong I fixed the coverage and pylint issues. I've been running jenkins to get a clean build but it's one of those flakey tests that keep failing.. Should I keep re-running it? |
…gs_feedback Sjang92/advanced settings feedback
|
@sjang92 Thanks for all the hard work on this. I've merged the PR now. |
|
@andy-armstrong Thank You! |
@jrbl @njdup
There were no validations being done in Studio's course advanced settings tab.
Now course instructors receive feed back as a list of settings changes that has formatting/value errors.