Skip to content

Fix redemption display error; add toggle to turn redemption data off#3281

Open
jkachel wants to merge 1 commit intomainfrom
jkachel/minor-fix-b2b_codes
Open

Fix redemption display error; add toggle to turn redemption data off#3281
jkachel wants to merge 1 commit intomainfrom
jkachel/minor-fix-b2b_codes

Conversation

@jkachel
Copy link
Contributor

@jkachel jkachel commented Feb 6, 2026

What are the relevant tickets?

n/a

Description (What does it do?)

Noticed when working through mitodl/hq#10117 - when I ran b2b_codes output for the contract, it kept returning codes that apparently had been used. They had learner email addresses listed in the Attach Redemptions column. This seemed weird to me; looking at the code, I realized that there was a typo in the output generation code. The output lists email addresses for redemptions for attachment and for enrollment and the enrollment part was putting the data in the wrong place. So, this fixes that; the attach column should now be blank if the code has only been used for enrollment.

I also updated the output subcommand to allow the redemption data to be toggled off. The default mode for b2b_codes output is to generate a list of codes that are available for use for contract attachment, with the intent of sending the list to the contract contacts so they can disperse the codes. You don't need to see the enrollment attachments for that. (You may still want to, so it's a toggle.) The toggle is called --no-redemptions and it defaults to off (show redemption metadata). It does not apply if --all is specified.

How can this be tested?

  1. Create a seat-limited contract and add at least two course runs to it. The courses need to be enrollable.
  2. Get the codes list out with b2b_codes output --contract <id> --all.
  3. Use one of them to attach your user to the contract. Note which course run that code was attached to for the next step. Ideally, use a code from the bottom of the list, that is attached to a course run that is not present in the top of the list.
  4. From the Learn dashboard, enroll in the other course run.
  5. Run b2b_codes output --contract <id> (skipping the --all flag). You should see that one of your codes has an enroll redemption, and the email address in there should be correct. You should not see any attach redemptions.
  6. Run b2b_codes output --contract <id> --no-redemptions. You should see the same list of codes but you shouldn't see any redemptions listed.

The reasoning for choosing codes from the top and bottom of the list is to increase the probability that you'll see the enroll redemption in the output.

@github-actions
Copy link

github-actions bot commented Feb 6, 2026

OpenAPI Changes

Show/hide ## Changes for v0.yaml:
## Changes for v0.yaml:


## Changes for v1.yaml:


## Changes for v2.yaml:


Unexpected changes? Ensure your branch is up-to-date with main (consider rebasing).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant