Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions src/platform_plugin_aspects/sinks/course_overview_sink.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,14 @@
"completion_mode": getattr(item, "completion_mode", ""),
}

if block_type == "video":
json_data["video_start_time"] = XBlockSink.get_seconds(
getattr(item, "start_time", None)
)
json_data["video_end_time"] = XBlockSink.get_seconds(

Check failure on line 184 in src/platform_plugin_aspects/sinks/course_overview_sink.py

View workflow job for this annotation

GitHub Actions / py

Missing coverage

Missing coverage on lines 181-184
getattr(item, "end_time", None)
)

# Core table data, if things change here it's a big deal.
serialized_block = {
"org": course_key.org,
Expand All @@ -194,6 +202,18 @@

return serialized_block

@staticmethod
def get_seconds(value):
"""
Convert a video RelativeTime field (a timedelta) to seconds.
Args:
value: a timedelta, or None if the field is not set.
Returns: the number of seconds as a float, 0.0 if not set.
"""
if not value:
return 0.0
return value.total_seconds()

Check failure on line 215 in src/platform_plugin_aspects/sinks/course_overview_sink.py

View workflow job for this annotation

GitHub Actions / py

Missing coverage

Missing coverage on lines 213-215

@staticmethod
def strip_branch_and_version(location):
"""
Expand Down
Loading