arbrandes
(Adolfo R. Brandes)
December 13, 2022, 8:26pm
21
P.S.
I can’t stress this enough: an issue report without instructions to reproduce the problem from scratch is a very difficult one to fix. Even experienced developers (perhaps specially them!), when browsing bug reports to try and fix, will instinctively skip these.
Reproducing the bug gets you half way to fixing it. I see folks are trying to do that here, which is encouraging.
1 Like
@arbrandes @sambapete @ghassan
We put in a PR with the master
branch here to use a Django CMS management command to bulk update course advanced settings using the existing update_course_advanced_settings
found at cms/djangoapps/contentstore/views/course.py.
openedx:master
← CUCWD:feature.master/ztraboo/cms-mgmt-set-advanced-fields-all-courses
opened 08:34PM - 14 Dec 22 UTC
## Description
Needed a way to set course advanced fields through the Django … management command line. Instead of call the REST PATCH endpoint here cms/djangoapps/contentstore/rest_api/v0/views/advanced_settings.py we utilized the `update_course_advanced_settings` method here cms/djangoapps/contentstore/views/course.py to pass JSON override values for one or more courses.
A `--force-update-catalog-visibility-about` command option was added to include advanced setting. When upgrading from an older release to `Maple` we had this `catalog_visibility` set to `none` which produced the `There was an error loading this course` message when viewing the course MFE Learning frontend. It was necessary to make sure these courses didn't have the `none` value and received `about` or `both` settings to have the page load properly. This command sets the value to `about` to prevent the course from uploading to the `course-discovery` service and out to the marketing frontend.
```
{
"catalog_visibility": {
"value": "about"
}
}
```
## Supporting information
We’re running into this issue mentioned above for students to be able to view the MFE learning page when Course Visibility in Catalog is set to none. The students receive the `There was an error loading this course.` message and nothing loads on the Course Home page. Also the LMS log files indicate no error messages so we were lucky to find this discussion article.
Reference: https://discuss.openedx.org/t/how-to-programmatically-set-a-course-advanced-fields/8901
## Testing instructions
When upgrading from prior release to `Maple` we had several courses with `course_visibility` set to `none` value. With this setting we traversed to the MFE Learning frontend and saw error message with `There was an error loading this course.` and a HTTP 404 response from an EdX API endpoint in the JavaScript console was indicated.
![image](https://user-images.githubusercontent.com/5641338/207708976-8cb10613-aa01-4770-82fe-9131f097c7fd.png)
HTTP 404 Response was at this address.
https://{{ LMS_HOST }}/api/course_home/course_metadata/course-v1:CUCWD+FAA-ACS-AM-ID-FLF+DOCUMENTATION?browser_timezone=America%2FNew_York
We added in a --limit-bulk-update-operation {0-N}
command option to prevent the command from consuming all server memory and crashing the server. So far this looks promising.
cc @traek728 @becdavid
2 Likes