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

🐛(backend) generate certificates with product type certificate #1065

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

jonathanreveille
Copy link
Member

@jonathanreveille jonathanreveille commented Feb 24, 2025

Purpose

We have fixed the generation of certificates for orders with product of type certificate from the BO. It was missing a filter queryset to get all the orders that are with product type certificate (has enrollment and no course).

Since we only want the admin users to use the BO to generate certificates (because it uses celery to launch the task in background), we have decided to remove the action to generate certificates through the django admin views (course, product, and order). The reason why through django admin the users would get a Server Error 500 is because the generation takes a while.

Proposal

  • Fix queryset that retrieves all the orders ids for product of type certificate from a course product relation
  • Remove generate_certificate action in django admin views (course, product, order)

@jonathanreveille jonathanreveille self-assigned this Feb 24, 2025
@jonathanreveille jonathanreveille added the bug Something isn't working label Feb 24, 2025
@jonathanreveille jonathanreveille force-pushed the bug/bulk_certification_generation_joanie_django_admin_fails branch 2 times, most recently from b1dc0fa to 2582167 Compare February 24, 2025 18:44
@jonathanreveille jonathanreveille force-pushed the bug/bulk_certification_generation_joanie_django_admin_fails branch 2 times, most recently from bcda62c to 4842912 Compare February 25, 2025 08:39
@jonathanreveille jonathanreveille force-pushed the bug/bulk_certification_generation_joanie_django_admin_fails branch 4 times, most recently from d0192f4 to fdeaf46 Compare February 25, 2025 11:04
It is now possible to launch the generation of certificates
for orders with product of type certificate from the BO.

Fix #1063
Since we have fixed the generation of certificates into the BO for
orders with product type certificate, we don't want our admin users
to use the django admin anymore for this task. We decided to remove
the action from the admin courses, products and orders views. It is
now impossible to generate certificate through the django admin views.

Fix #1061
@jonathanreveille jonathanreveille force-pushed the bug/bulk_certification_generation_joanie_django_admin_fails branch from fdeaf46 to b3eaa19 Compare February 25, 2025 11:21
Comment on lines 33 to 37
Q(order__course=course_product_relation.course, order__enrollment__isnull=True)
| Q(order__course__isnull=True, order__enrollment__isnull=False),
order__product=course_product_relation.product,
order__course=course_product_relation.course,
order__certificate__isnull=False,
order__state=ORDER_STATE_COMPLETED,
Copy link
Member

@jbpenrath jbpenrath Feb 26, 2025

Choose a reason for hiding this comment

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

Something is wrong here as you will try to generate certificate for all completed certificate products.

You have to filter per enrollment__course_run__course in case of certificate product

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
back-office bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants