Skip to content

Commit

Permalink
feat: simple api to update learning context links status
Browse files Browse the repository at this point in the history
  • Loading branch information
navinkarkera committed Jan 20, 2025
1 parent d287508 commit eb706d7
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions openedx_learning/apps/authoring/linking/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
'get_entity_links',
'get_or_create_learning_context_link_status',
'update_or_create_entity_link',
'update_learning_context_link_status',
]


Expand Down Expand Up @@ -48,6 +49,23 @@ def get_or_create_learning_context_link_status(
return status


def update_learning_context_link_status(
context_key: str,
status: LearningContextLinksStatusChoices,
updated: datetime | None = None
) -> LearningContextLinksStatus:
"""
Updates entity links processing status of given learning context.
"""
if not updated:
updated = datetime.now(tz=timezone.utc)
status = LearningContextLinksStatus.objects.filter(context_key=context_key).update(
status=status,
updated=updated,
)
return status


def get_entity_links(filters: dict[str, Any]) -> QuerySet[PublishableEntityLink]:
"""
Get entity links based on passed filters.
Expand Down

0 comments on commit eb706d7

Please sign in to comment.