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

feat: model for upstream-downstream links #269

Draft
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

navinkarkera
Copy link
Contributor

@navinkarkera navinkarkera commented Jan 15, 2025

Adds models and api's for Publishable entity links.

See openedx/edx-platform#36111 for more information and testing instructions.

@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Jan 15, 2025
@openedx-webhooks
Copy link

Thanks for the pull request, @navinkarkera!

This repository is currently maintained by @axim-engineering.

Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review.

🔘 Get product approval

If you haven't already, check this list to see if your contribution needs to go through the product review process.

  • If it does, you'll need to submit a product proposal for your contribution, and have it reviewed by the Product Working Group.
    • This process (including the steps you'll need to take) is documented here.
  • If it doesn't, simply proceed with the next step.

🔘 Provide context

To help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:

  • Dependencies

    This PR must be merged before / after / at the same time as ...

  • Blockers

    This PR is waiting for OEP-1234 to be accepted.

  • Timeline information

    This PR must be merged by XX date because ...

  • Partner information

    This is for a course on edx.org.

  • Supporting documentation
  • Relevant Open edX discussion forum threads

🔘 Get a green build

If one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green.

🔘 Update the status of your PR

Your PR is currently marked as a draft. After completing the steps above, update its status by clicking "Ready for Review", or removing "WIP" from the title, as appropriate.


Where can I find more information?

If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources:

When can I expect my changes to be merged?

Our goal is to get community contributions seen and reviewed as efficiently as possible.

However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:

  • The size and impact of the changes that it introduces
  • The need for product review
  • Maintenance status of the parent repository

💡 As a result it may take up to several weeks or months to complete a review and merge your PR.

@navinkarkera navinkarkera force-pushed the navin/link-table branch 2 times, most recently from e06f148 to aa3e463 Compare January 15, 2025 15:21
Copy link
Contributor

@pomegranited pomegranited left a comment

Choose a reason for hiding this comment

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

👍 I left a few nits/questions about some field types and naming conventions, but this is working well :)

  • I tested this using the test instructions on feat: upstream-downstream entity linking edx-platform#36111
  • I read through the code
  • I checked for accessibility issues by using my keyboard to navigate N/A
  • Includes documentation -- code comments for modules and classes
  • User-facing strings are extracted for translation -- mostly, but I've noted where the model verbose_name fields need marking too.

version_synced = models.IntegerField()
version_declined = models.IntegerField(null=True, blank=True)
created = manual_date_time_field()
updated = manual_date_time_field()
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: shouldn't the updated date have auto_now=True like most modified date fields do? Without this, I can't see when the entity link gets updated.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok -- but why have this field if it's always the same as created?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No it should not be always same, it should be different when you

  • accept or reject an update from upstream (version_synced or version_declined field should be updated along with updated field).
  • you change course name.

help_text=_("Status of links in given course."),
)
created = manual_date_time_field()
updated = manual_date_time_field()
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto nit: shouldn't the updated date have auto_now=True like most modified date fields do? Without this, I can't see when the status gets force-updated.

" and useful to track upstream library blocks that do not exist yet"
)
)
upstream_context_key = case_sensitive_char_field(
Copy link
Contributor

Choose a reason for hiding this comment

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

Why isn't this a key_field like the downstream_context_key and CourseLinksStatus.context_key?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Initially I was planning to keep the field nullable which is why I did not use key_field but after giving it a bit more thought, used key_field and made sure that field is always added.

class CourseLinksStatus(models.Model):
"""
This table stores current processing status of upstream-downstream links in PublishableEntityLink table for a
course.
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there ever a case where we'd want to re-process the downstream links for a given library (and therefore want to track them too)? I ask only because the naming for this model is very course-specific, but the data itself doesn't care about courses -- any learning context should work fine here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Dave suggested tracking these courses so that we can trigger processing when a course author visits sync page of a course, to avoid processing all of them in a migration.

Copy link
Contributor Author

@navinkarkera navinkarkera Jan 17, 2025

Choose a reason for hiding this comment

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

any learning context should work fine here.

True, we should probably rename the table.

update: Renamed.

openedx_learning/apps/authoring/linking/models.py Outdated Show resolved Hide resolved
openedx_learning/apps/authoring/linking/models.py Outdated Show resolved Hide resolved
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
Status: Waiting on Author
Development

Successfully merging this pull request may close these issues.

3 participants