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

"Invalid Date" appears in "Unused Enrollment Codes" UI in certain conditions. #2512

Open
mbertrand opened this issue Dec 6, 2022 · 6 comments
Labels
Bug Something isn't working

Comments

@mbertrand
Copy link
Member

Steps to Reproduce

Create a course run with a null start date.
Create a coupon for a course run (the same above or another), give the CouponPaymentVersion a null expiration date.
Assign the coupon code to one of your users.
Log in as that user.
Go to https://xpro.mit.edu/dashboard/

Expected Behavior

Under the "Unredeemed Enrollment Code(s)" section, you should see appropriate text (TBD) for "Use code by ____" and "Start Date: ____"

Actual Behavior

"Use code by Invalid Date"
"Start Date: Invalid Date"

Screenshot or Screencast

Screen Shot 2022-12-05 at 4 17 49 PM

@mbertrand mbertrand added the Bug Something isn't working label Dec 6, 2022
@pdpinch
Copy link
Member

pdpinch commented Dec 6, 2022

What database fields are used to populate "Use code by ____" and "Start Date: ____" ?

@cachob
Copy link

cachob commented Dec 6, 2022

@mbertrand
Copy link
Member Author

"Use code by": CouponPaymentVersion.expiration_date
"Start date": Product.start_date

@mbertrand
Copy link
Member Author

Above spreadsheet was generated via:

ces = CouponEligibility.objects.filter(coupon__payment__versions__expiration_date__isnull=True)
for ce in ces:
    print(f"{ce.coupon.payment.name}\t{ce.coupon.coupon_code}\t{ce.product.id}\t{ce.product.title}\t{ce.coupon.payment.latest_version.activation_date}\t{ce.coupon.payment.latest_version.expiration_date}")

and then filtering out some whose latest PaymentVersion.expiration_date was not null (one of their earlier versions was).

@pdpinch
Copy link
Member

pdpinch commented Dec 8, 2022

No user has ever mentioned this, so I don't think it's a high-priority issue. But it does perhaps reveal some unexpected issues with our data and practices.

TL;DR, I think we should change this UI to protect against missing data.

However, I'm going to assert a couple of things:

  1. The only coupons that should be referenced in these banners are coupons that have been assigned via the bulk enrollment process (i.e. via google sheets)

  2. missing "Use code by": CouponPaymentVersion.expiration_date

    1. Some coupons deliberately have no expiration date. However, these "evergreen" coupons should never be assigned to users.
    2. All enrollment code coupons, assigned via google sheets, should have expiration dates. If they do not, we should review the process for creating them, and possibly discuss them with Sales and Accounts Receivable (Finance)
  3. "Start date": Product.start_date
    Products should always have a start date. However, these are pulled from edX studio, so I don't think a simple validation is sufficient.

@rhysyngsun
Copy link
Collaborator

Nit: the message is also using the product data model type string (i.e. model class name lowercased):

to enroll in {enrollmentCode.product_type} for

This should probably be a human-readable value instead, because it displays "courserun" for courses.

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

No branches or pull requests

4 participants