-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #60 from openedx/pwnage101/ENT-8389
feat: Add parent_content_key field to Transaction model
- Loading branch information
Showing
8 changed files
with
71 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
0008 ``parent_content_key`` Field | ||
################################# | ||
|
||
Status | ||
****** | ||
**Accepted** (February 2024) | ||
|
||
Context | ||
******* | ||
Today, we store a ``Transaction.content_key`` field which points at the content into which a learner is enrolled. | ||
Currently in the openedx ecosystem that would be a "course run key". However, we'd also like to know the parent | ||
identifier for the content, most often the "course key" associated with a "course run key" within the openedx ecosystem. | ||
In some downstream systems and frontends which consume transaction data it is essential to know the parent content key, | ||
but dynamically fetching it from APIs can be slow when working with many transactions. | ||
|
||
Decision | ||
******** | ||
We'll introduce a ``parent_content_key`` field to the ``Transaction`` model. Similarly to ``content_title``, this new | ||
field will essentially locally cache slow-changing data (content keys are arguably the slowest of slow-changing). | ||
|
||
Consequences | ||
************ | ||
* Creating transactions will additionally be required to pass a ``parent_content_key``, but this should be | ||
straightforward since they already pass ``content_title``, which is already co-located with the parent content key | ||
(``course_key``) within the system of record. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
""" | ||
A library that records transactions against a ledger, denominated in units of value. | ||
""" | ||
__version__ = "1.3.3" | ||
__version__ = "1.4.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
openedx_ledger/migrations/0010_transaction_parent_content_key.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Generated by Django 3.2.23 on 2024-02-15 16:22 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('openedx_ledger', '0009_add_email_and_title_to_transactions'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='historicaltransaction', | ||
name='parent_content_key', | ||
field=models.CharField(blank=True, db_index=True, help_text='Identifier for the parent of the content_key. Also should be joinable with ContentMetadata.content_key in enterprise-catalog. In practice, this is the course key corresponding to a course run key.', max_length=255, null=True), | ||
), | ||
migrations.AddField( | ||
model_name='transaction', | ||
name='parent_content_key', | ||
field=models.CharField(blank=True, db_index=True, help_text='Identifier for the parent of the content_key. Also should be joinable with ContentMetadata.content_key in enterprise-catalog. In practice, this is the course key corresponding to a course run key.', max_length=255, null=True), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters