Commit cf9c01a9 by Braden MacDonald Committed by GitHub

Merge pull request #164 from open-craft/bogdan-fix-apros-instructor-tool

Fix Instructor Tool in Apros
parents a88e37be 5a1489b5
...@@ -288,7 +288,7 @@ function InstructorToolBlock(runtime, element) { ...@@ -288,7 +288,7 @@ function InstructorToolBlock(runtime, element) {
// Returns the <option> element so that it can be enabled later, // Returns the <option> element so that it can be enabled later,
// if it's found to have a descendant that is enabled. // if it's found to have a descendant that is enabled.
var appendBlock = function(block) { var appendBlock = function(block) {
var blockId = block.id.split('+block@').pop(), var blockId = block.id,
padding = Array(2*block.depth).join('&nbsp;'), padding = Array(2*block.depth).join('&nbsp;'),
disabled = (block.enabled ? undefined : 'disabled'), disabled = (block.enabled ? undefined : 'disabled'),
labelAttr, labelAttr,
......
...@@ -6,7 +6,8 @@ import time ...@@ -6,7 +6,8 @@ import time
from celery.task import task from celery.task import task
from celery.utils.log import get_task_logger from celery.utils.log import get_task_logger
from lms.djangoapps.instructor_task.models import ReportStore from lms.djangoapps.instructor_task.models import ReportStore
from opaque_keys.edx.keys import CourseKey from opaque_keys import InvalidKeyError
from opaque_keys.edx.keys import CourseKey, UsageKey
from student.models import user_by_anonymous_id from student.models import user_by_anonymous_id
from xmodule.modulestore.django import modulestore from xmodule.modulestore.django import modulestore
from xmodule.modulestore.exceptions import ItemNotFoundError from xmodule.modulestore.exceptions import ItemNotFoundError
...@@ -29,11 +30,12 @@ def export_data(course_id, source_block_id_str, block_types, user_ids, match_str ...@@ -29,11 +30,12 @@ def export_data(course_id, source_block_id_str, block_types, user_ids, match_str
logger.debug("Beginning data export") logger.debug("Beginning data export")
try: try:
course_key = CourseKey.from_string(course_id) course_key = CourseKey.from_string(course_id)
src_block = modulestore().get_items(course_key, qualifiers={'name': source_block_id_str}, depth=0)[0] usage_key = UsageKey.from_string(source_block_id_str)
except IndexError: except InvalidKeyError:
raise ValueError("Could not find the specified Block ID.") raise ValueError("Could not find the specified Block ID.")
course_key_str = unicode(course_key)
src_block = modulestore().get_item(usage_key)
course_key_str = unicode(course_key)
type_map = {cls.__name__: cls for cls in [MCQBlock, RatingBlock, AnswerBlock]} type_map = {cls.__name__: cls for cls in [MCQBlock, RatingBlock, AnswerBlock]}
if not block_types: if not block_types:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment