Skip to content

Commit

Permalink
Merge pull request #8 from Stanford-Online/giulio/fix-empty-xblock-save
Browse files Browse the repository at this point in the history
Make empty xblock fail gracefully
  • Loading branch information
caesar2164 authored Feb 22, 2017
2 parents 2213aad + 38d7572 commit 7790363
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion invideoquiz/invideoquiz.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class InVideoQuizXBlock(StudioEditableXBlockMixin, XBlock):

timemap = String(
display_name=_('Problem Timemap'),
default='',
default={},
scope=Scope.settings,
help=_(
'A simple string field to define problem IDs '
Expand Down
9 changes: 4 additions & 5 deletions invideoquiz/public/js/src/invideoquiz.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
/* Javascript for InVideoQuizXBlock. */
function InVideoQuizXBlock(runtime, element) {
var videoId = $('.in-video-quiz-block').data('videoid');
if (!videoId || !InVideoQuizXBlock.config.hasOwnProperty(videoId)) {
return;
}
var problemTimesMap = InVideoQuizXBlock.config[videoId];
var studentMode = $('.in-video-quiz-block').data('mode') !== 'staff';
var problemTimesMap = InVideoQuizXBlock.config[videoId] || {};
var extraVideoButton = '<button class="in-video-continue">Continue</button>';
var video;
var videoState;
Expand All @@ -18,10 +21,6 @@ function InVideoQuizXBlock(runtime, element) {
$(function () {
$('.in-video-quiz-block').closest('.vert').hide();

if (!videoId || !problemTimesMap) {
return;
}

$('#seq_content .vert-mod .vert').each(function () {
var component = $(this);

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def run_tests(self):

setup(
name='invideoquiz-xblock',
version='0.1.3',
version='0.2.0',
description='Helper XBlock to locate CAPA problems within videos.',
license='AGPL v3',
packages=[
Expand Down

0 comments on commit 7790363

Please sign in to comment.