Skip to content

Commit

Permalink
fix: Caliper transform of video events without duration (#315)
Browse files Browse the repository at this point in the history
* fix: Caliper transform of video events without duration

* test: Add a test for null durations in video events
  • Loading branch information
bmtcril authored Jul 11, 2023
1 parent 57b9622 commit bc672fb
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 8 deletions.
2 changes: 1 addition & 1 deletion event_routing_backends/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
Various backends for receiving edX LMS events..
"""

__version__ = '5.5.0'
__version__ = '5.5.1'

default_app_config = 'event_routing_backends.apps.EventRoutingBackendsConfig' # pylint: disable=invalid-name
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@
- edx.video.position.changed
- edx.video.completed (proposed)
"""
from datetime import timedelta

from isodate import duration_isoformat

from event_routing_backends.helpers import convert_seconds_to_iso, make_video_block_id
from event_routing_backends.processors.caliper.registry import CaliperTransformersRegistry
from event_routing_backends.processors.caliper.transformer import CaliperTransformer
Expand Down Expand Up @@ -95,9 +91,9 @@ def get_object(self):
caliper_object.update({
'id': self.get_object_iri('xblock', object_id),
'type': 'VideoObject',
'duration': duration_isoformat(timedelta(
seconds=data.get('duration', 0)
))
'duration': convert_seconds_to_iso(
seconds=data.get('duration', 0)
)
})

return caliper_object
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "edx.video.closed_captions.hidden",
"timestamp": "2022-11-16T08:05:01.963139+00:00",
"data": {
"id": "0b9e39477cf34507a7a48f74be381fdd",
"code": "html5",
"duration": null,
"current_time": 21.133524
},
"context": {
"session": "95522acebdda19758bd98a456a640afa",
"user_id": 19,
"username": "test",
"ip": "172.20.0.1",
"host": "localhost:18000",
"agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36",
"path": "/event",
"referer": "http://localhost:18000/xblock/block-v1:edX+DemoX+Demo_Course+type@vertical+block@vertical_0270f6de40fc?show_title=0&show_bookmark_button=0&recheck_access=1&view=student_view",
"accept_language": "en-US,en;q=0.9",
"client_id": "1309536091.1619499525",
"course_id": "course-v1:edX+DemoX+Demo_Course",
"org_id": "edX",
"enterprise_uuid": "",
"event_source": "browser",
"page": "http://localhost:18000/xblock/block-v1:edX+DemoX+Demo_Course+type@vertical+block@vertical_0270f6de40fc?show_title=0&show_bookmark_button=0&recheck_access=1&view=student_view"
}
}

0 comments on commit bc672fb

Please sign in to comment.