Skip to content

Commit

Permalink
feat: add ora submission created event
Browse files Browse the repository at this point in the history
  • Loading branch information
BryanttV committed Feb 2, 2024
1 parent a7be393 commit e8270de
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 3 deletions.
2 changes: 1 addition & 1 deletion platform_plugin_turnitin/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class PlatformPluginTurnitinConfig(AppConfig):
"receivers": [
{
"receiver_func_name": "ora_submission_created",
"signal_path": "openedx_events.learning.signals.ORA_SUBMISSION_CREATED",
"signal_path": "platform_plugin_turnitin.events.signals.ORA_SUBMISSION_CREATED",
},
],
}
Expand Down
Empty file.
15 changes: 15 additions & 0 deletions platform_plugin_turnitin/events/data.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
"""Data classes for Turnitin events."""

from typing import List

import attr


@attr.s(frozen=True)
class ORASubmissionData:
"""
ORA submission data.
"""

id: str = attr.ib()
file_downloads: List[dict] = attr.ib()
16 changes: 16 additions & 0 deletions platform_plugin_turnitin/events/signals.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"""Event signals for the Turnitin platform plugin."""

from openedx_events.tooling import OpenEdxPublicSignal

from platform_plugin_turnitin.events.data import ORASubmissionData

# .. event_type: org.openedx.learning.ora.submission.created.v1
# .. event_name: ORA_SUBMISSION_CREATED
# .. event_description: Emitted when a new ORA submission is created
# .. event_data: ORASubmissionData
ORA_SUBMISSION_CREATED = OpenEdxPublicSignal(
event_type="org.openedx.learning.ora.submission.created.v1",
data={
"submission": ORASubmissionData,
},
)
4 changes: 2 additions & 2 deletions platform_plugin_turnitin/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import requests

# from celery import shared_task
from celery import shared_task
from django.conf import settings
from rest_framework import status
from submissions import api as submissions_api
Expand All @@ -14,7 +14,7 @@
from platform_plugin_turnitin.edxapp_wrapper import user_by_anonymous_id


# @shared_task
@shared_task
def ora_submission_created(submission, **kwargs):
"""
Task to handle the creation of a new ora submission.
Expand Down

0 comments on commit e8270de

Please sign in to comment.