Skip to content

Conversation

@mbertrand
Copy link
Member

@mbertrand mbertrand commented Oct 29, 2024

What are the relevant tickets?

Closes https://github.com/mitodl/hq/issues/5911

Description (What does it do?)

Handles situations where another field besides readable_id also needs to be unique (url for prolearn), and an existing resource with that readable_id exists with a different url than what the API returns.

How can this be tested?

  • Start on the main branch.
  • If you don't already have it, create a LearningResource with a readable_id of prolearn-mitpe-712:
    from learning_resources.models import *
    LearningResource.objects.update_or_create(
      readable_id="prolearn-mitpe-712",
      etl_source="prolearn",
      platform=LearningResourcePlatform.objects.get(code="mitpe"),
      offered_by=LearningResourceOfferor.objects.get(code="mitpe"),
      defaults = {
        "url": "https://professional.mit.edu/course-catalog/designing-efficient-deep-learning-systems-live-virtual"
      }
    )
  • Run ./manage.py backpopulate_prolearn_data, it should fail with a duplicate key error.
  • Switch to this branch, restart containers, and try again. It should complete successfully.
  • Check that the resource with readable_id=prolearn-mitpe-712 has a new url of https://professional.mit.edu/course-catalog/designing-efficient-deep-learning-systems-live-online

@mbertrand mbertrand added the Needs Review An open Pull Request that is ready for review label Oct 29, 2024
@abeglova abeglova self-assigned this Oct 30, 2024
Copy link
Contributor

@abeglova abeglova left a comment

Choose a reason for hiding this comment

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

lgtm

@mbertrand mbertrand merged commit c752253 into main Oct 30, 2024
11 checks passed
@odlbot odlbot mentioned this pull request Oct 30, 2024
5 tasks
@rhysyngsun rhysyngsun deleted the mb/prolearn_fix branch February 7, 2025 20:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs Review An open Pull Request that is ready for review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants