Skip to content
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: 500 error during opening program certificate page (master) #4182

Merged
merged 1 commit into from
Dec 26, 2023

Conversation

DmytroAlipov
Copy link
Contributor

Description:

Error 500 occurs when going to the Program certificate page if an organization is connected to the Authoring organizations field with an empty field Certificate logo image:
screen_105


Steps to Reproduce:

  1. The program is created.
  2. In the Discovery admin panel, connect an organization in the Authoring organizations field that does not have an image loaded for the Certificate logo image field:
screen_106 screen_107
  1. Earn a program certificate as a user.
  2. Go to the program certificate page.

I propose that before saving the program, verify if the Certificate logo image field of the associated organizations is empty. Also, make the certificate_logo_image field required to be filled in the admin panel, but not in the model, to prevent unnecessary migrations.

On the Program page https://<discovery>/admin/course_metadata/program/:
screen_220

On the Organization page https://<discovery>/admin/course_metadata/organization/:
screen_221

@openedx-webhooks
Copy link

Thanks for the pull request, @DmytroAlipov! Please note that it may take us up to several weeks or months to complete a review and merge your PR.

Feel free to add as much of the following information to the ticket as you can:

  • supporting documentation
  • Open edX discussion forum threads
  • timeline information ("this must be merged by XX date", and why that is)
  • partner information ("this is a course on edx.org")
  • any other information that can help Product understand the context for the PR

All technical communication about the code itself will be done via the GitHub pull request interface. As a reminder, our process documentation is here.

Please let us know once your PR is ready for our review and all tests are green.

@mphilbrick211
Copy link

Hi @openedx/2u-phoenix! Would someone be able to please review / merge this for us?

Comment on lines 93 to 94
super().__init__(*args, **kwargs)
self.fields['certificate_logo_image'].required = True
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This field is not required necessarily for Discovery's functioning. Discovery's codebase assumes it is None in certain places (like API). It is better to set these expectations in consumer rather than requiring the field here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since organizations are edited via admin, it can impact the editors/admins when they have to add the value even if they dont need it.

Copy link
Contributor Author

@DmytroAlipov DmytroAlipov Dec 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @DawoudSheraz. You’re correct, the certificate_logo_image is not required in the database. However, the proper display of the program certificate page is directly dependent on this field. That’s why I’ve implemented checks for the Programs and also suggest making this field required for Organizations to fill out. What potential risks do you foresee, apart from the fact that administrators might be compelled to add a logo even if they don’t need it?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What potential risks do you foresee, apart from the fact that administrators might be compelled to add a logo even if they don’t need it?

At this point, the admins getting blocked on the field and having to add a logo (default or otherwise) is the main issue. This is why I suggested having the appropriate checks on the consumer side. Or you can add these changes behind a toggle/switch(?).

@DmytroAlipov
Copy link
Contributor Author

Hi @DawoudSheraz! I reconsidered my decision, and I agree with you that there's no need to make the "Certificate logo image" field required. Now this code is not available in all PRs (master, Palm, Quince).

@DmytroAlipov
Copy link
Contributor Author

@DawoudSheraz Could you help me with the pipeline problem? I don't understand why test_typeahead_org_course_runs_come_up_first fails. Moreover, it does not work only for the master branch. In the PR version of Quince and Palm, everything is fine.

@@ -68,6 +68,21 @@ def clean(self):

return self.cleaned_data

def clean_authoring_organizations(self):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: add method docstring

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error 500 occurs when going to the program certificate page if
an organization is connected to the Authoring organizations
field with an empty field Certificate logo image.
@DawoudSheraz DawoudSheraz merged commit 5ae20e6 into openedx:master Dec 26, 2023
14 checks passed
@openedx-webhooks
Copy link

@DmytroAlipov 🎉 Your pull request was merged! Please take a moment to answer a two question survey so we can improve your experience in the future.

@DmytroAlipov DmytroAlipov deleted the fix-org-image branch December 26, 2023 09:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
open-source-contribution PR author is not from Axim or 2U
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

5 participants