Skip to content

Commit

Permalink
feat: send event when ora submission is created
Browse files Browse the repository at this point in the history
  • Loading branch information
BryanttV committed Apr 11, 2024
1 parent 79bad49 commit 4547106
Show file tree
Hide file tree
Showing 8 changed files with 104 additions and 94 deletions.
23 changes: 23 additions & 0 deletions openassessment/xblock/ui_mixins/legacy/handlers_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import logging

from openedx_events.learning.data import ORASubmissionData
from openedx_events.learning.signals import ORA_SUBMISSION_CREATED
from xblock.core import XBlock
from submissions import api as submissions_api
from openassessment.assessment.errors.peer import (
Expand Down Expand Up @@ -61,6 +63,26 @@ class LegacyHandlersMixin:
Exposes actions (@XBlock.json_handlers) used in our legacy ORA UI
"""

@staticmethod
def send_ora_submission_created_event(submission: dict) -> None:
"""
Send an event when a submission is created
Args:
submission (dict): The submission data
"""
from openassessment.xblock.openassessmentblock import OpenAssessmentBlock

file_downloads = OpenAssessmentBlock.get_download_urls_from_submission(
submission
)
ORA_SUBMISSION_CREATED.send_event(
submission=ORASubmissionData(
id=submission.get("uuid"),
file_downloads=file_downloads,
)
)

# Submissions

@XBlock.json_handler
Expand All @@ -79,6 +101,7 @@ def submit(self, data, suffix=""): # pylint: disable=unused-argument
self.submission_data,
self.workflow_data
)
self.send_ora_submission_created_event(submission)
return (
True,
submission.get("student_item"),
Expand Down
31 changes: 16 additions & 15 deletions requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ backports-zoneinfo==0.2.1 ; python_version < "3.9"
# via
# -c requirements/constraints.txt
# django
# djangorestframework
bleach==6.1.0
# via -r requirements/base.in
boto3==1.34.72
boto3==1.34.82
# via -r requirements/base.in
botocore==1.34.72
botocore==1.34.82
# via
# boto3
# s3transfer
Expand All @@ -30,7 +31,7 @@ click==8.1.7
# via
# code-annotations
# edx-django-utils
code-annotations==1.7.0
code-annotations==1.8.0
# via edx-toggles
defusedxml==0.7.1
# via -r requirements/base.in
Expand All @@ -51,7 +52,7 @@ django-crum==0.7.9
# via
# edx-django-utils
# edx-toggles
django-model-utils==4.4.0
django-model-utils==4.5.0
# via
# -r requirements/base.in
# edx-submissions
Expand All @@ -63,21 +64,21 @@ django-waffle==4.1.0
# via
# edx-django-utils
# edx-toggles
djangorestframework==3.14.0
djangorestframework==3.15.1
# via
# -r requirements/base.in
# edx-submissions
edx-django-utils==5.11.0
edx-django-utils==5.12.0
# via
# -r requirements/base.in
# edx-toggles
edx-i18n-tools==1.3.0
edx-i18n-tools==1.5.0
# via -r requirements/base.in
edx-opaque-keys==2.5.1
# via -r requirements/base.in
edx-submissions==3.6.0
edx-submissions==3.7.0
# via -r requirements/base.in
edx-toggles==5.1.1
edx-toggles==5.2.0
# via -r requirements/base.in
fs==2.0.18
# via
Expand Down Expand Up @@ -107,10 +108,11 @@ loremipsum==1.0.5
# -r requirements/base.in
lxml==4.9.4
# via
# -c requirements/constraints.txt
# -r requirements/base.in
# edx-i18n-tools
# xblock
mako==1.3.2
mako==1.3.3
# via xblock
markupsafe==2.1.5
# via
Expand All @@ -132,7 +134,7 @@ polib==1.2.0
# via edx-i18n-tools
psutil==5.9.8
# via edx-django-utils
pycparser==2.21
pycparser==2.22
# via cffi
pymongo==3.13.0
# via edx-opaque-keys
Expand All @@ -152,7 +154,6 @@ python-swiftclient==3.13.1
pytz==2024.1
# via
# -r requirements/base.in
# djangorestframework
# edx-submissions
# fs
# xblock
Expand Down Expand Up @@ -183,7 +184,7 @@ stevedore==5.2.0
# edx-opaque-keys
text-unidecode==1.3
# via python-slugify
typing-extensions==4.10.0
typing-extensions==4.11.0
# via
# asgiref
# edx-opaque-keys
Expand All @@ -195,15 +196,15 @@ voluptuous==0.14.2
# via
# -c requirements/constraints.txt
# -r requirements/base.in
web-fragments==2.1.0
web-fragments==2.2.0
# via xblock
webencodings==0.5.1
# via
# bleach
# html5lib
webob==1.8.7
# via xblock
xblock==2.0.0
xblock==3.1.0
# via -r requirements/base.in

# The following packages are considered to be unsafe in a requirements file:
Expand Down
2 changes: 1 addition & 1 deletion requirements/ci.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ distlib==0.3.8
# virtualenv
docopt==0.6.2
# via coveralls
filelock==3.13.3
filelock==3.13.4
# via
# -r requirements/tox.txt
# tox
Expand Down
2 changes: 1 addition & 1 deletion requirements/docs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ sphinxcontrib-serializinghtml==1.1.5
# via sphinx
tornado==6.4
# via livereload
typing-extensions==4.10.0
typing-extensions==4.11.0
# via pydata-sphinx-theme
urllib3==2.2.1
# via requests
Expand Down
47 changes: 21 additions & 26 deletions requirements/quality.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ backports-zoneinfo[tzdata]==0.2.1 ; python_version < "3.9"
# -r requirements/test.txt
# celery
# django
# djangorestframework
# kombu
billiard==4.2.0
# via
Expand All @@ -41,12 +42,12 @@ binaryornot==0.4.4
# cookiecutter
bleach==6.1.0
# via -r requirements/test.txt
boto3==1.34.72
boto3==1.34.82
# via
# -r requirements/test.txt
# fs-s3fs
# moto
botocore==1.34.72
botocore==1.34.82
# via
# -r requirements/test.txt
# boto3
Expand Down Expand Up @@ -102,7 +103,7 @@ click-repl==0.3.0
# via
# -r requirements/test.txt
# celery
code-annotations==1.7.0
code-annotations==1.8.0
# via
# -r requirements/test.txt
# edx-lint
Expand Down Expand Up @@ -154,7 +155,7 @@ django-crum==0.7.9
# -r requirements/test.txt
# edx-django-utils
# edx-toggles
django-model-utils==4.4.0
django-model-utils==4.5.0
# via
# -r requirements/test.txt
# edx-submissions
Expand All @@ -167,35 +168,35 @@ django-waffle==4.1.0
# -r requirements/test.txt
# edx-django-utils
# edx-toggles
djangorestframework==3.14.0
djangorestframework==3.15.1
# via
# -r requirements/test.txt
# edx-submissions
edx-django-utils==5.11.0
edx-django-utils==5.12.0
# via
# -r requirements/test.txt
# edx-toggles
edx-i18n-tools==1.3.0
edx-i18n-tools==1.5.0
# via -r requirements/test.txt
edx-lint==5.3.6
# via -r requirements/quality.in
edx-opaque-keys==2.5.1
# via -r requirements/test.txt
edx-submissions==3.6.0
edx-submissions==3.7.0
# via -r requirements/test.txt
edx-toggles==5.1.1
edx-toggles==5.2.0
# via -r requirements/test.txt
exceptiongroup==1.2.0
# via
# -r requirements/test.txt
# pytest
factory-boy==3.3.0
# via -r requirements/test.txt
faker==24.4.0
faker==24.8.0
# via
# -r requirements/test.txt
# factory-boy
filelock==3.13.3
filelock==3.13.4
# via
# -r requirements/test.txt
# tox
Expand Down Expand Up @@ -243,7 +244,7 @@ jsonfield==3.1.0
# via
# -r requirements/test.txt
# edx-submissions
kombu==5.3.6
kombu==5.3.7
# via
# -r requirements/test.txt
# celery
Expand All @@ -255,11 +256,12 @@ loremipsum==1.0.5
# -r requirements/test.txt
lxml==4.9.4
# via
# -c requirements/constraints.txt
# -r requirements/test.txt
# edx-i18n-tools
# xblock
# xblock-sdk
mako==1.3.2
mako==1.3.3
# via
# -r requirements/test.txt
# xblock
Expand Down Expand Up @@ -335,7 +337,7 @@ psutil==5.9.8
# edx-django-utils
pycodestyle==2.11.1
# via -r requirements/quality.in
pycparser==2.21
pycparser==2.22
# via
# -r requirements/test.txt
# cffi
Expand Down Expand Up @@ -404,7 +406,6 @@ python-swiftclient==3.13.1
pytz==2024.1
# via
# -r requirements/test.txt
# djangorestframework
# edx-submissions
# fs
# xblock
Expand Down Expand Up @@ -484,7 +485,7 @@ types-python-dateutil==2.9.0.20240316
# via
# -r requirements/test.txt
# arrow
typing-extensions==4.10.0
typing-extensions==4.11.0
# via
# -r requirements/test.txt
# asgiref
Expand Down Expand Up @@ -523,7 +524,7 @@ wcwidth==0.2.13
# via
# -r requirements/test.txt
# prompt-toolkit
web-fragments==2.1.0
web-fragments==2.2.0
# via
# -r requirements/test.txt
# xblock
Expand All @@ -538,21 +539,15 @@ webob==1.8.7
# -r requirements/test.txt
# xblock
# xblock-sdk
werkzeug==3.0.1
werkzeug==3.0.2
# via
# -r requirements/test.txt
# moto
wrapt==1.11.2
xblock==3.1.0
# via
# -c requirements/constraints.txt
# -r requirements/test.txt
# aws-xray-sdk
xblock==2.0.0
# via
# -c requirements/constraints.txt
# -r requirements/test.txt
# xblock-sdk
xblock-sdk==0.9.0
xblock-sdk==0.10.0
# via -r requirements/test.txt
xmltodict==0.13.0
# via
Expand Down
Loading

0 comments on commit 4547106

Please sign in to comment.