def update_verification_partitions(course_key): """ Create a user partition for each verification checkpoint in the course. This will modify the published version of the course descriptor. It ensures that any in-course reverification XBlocks in the course have an associated user partition. Other user partitions (e.g. cohorts) will be preserved. Partitions associated with deleted reverification checkpoints will be marked as inactive and will not be used to restrict access. Arguments: course_key (CourseKey): identifier for the course. Returns: None """ # Batch all the queries we're about to do and suppress # the "publish" signal to avoid an infinite call loop. with modulestore().bulk_operations(course_key, emit_signals=False): # Retrieve all in-course reverification blocks in the course icrv_blocks = get_course_blocks(course_key, VERIFICATION_BLOCK_CATEGORY) # Update the verification definitions in the course descriptor # This will also clean out old verification partitions if checkpoints # have been deleted. _set_verification_partitions(course_key, icrv_blocks)
def _get_xblocks(course_key, category): """ Retrieve all XBlocks in the course for a particular category. Returns only XBlocks that are published and haven't been deleted. """ xblocks = get_course_blocks(course_key, category) return xblocks
def _get_xblocks(course_key, category): """ Retrieve all XBlocks in the course for a particular category. Returns only XBlocks that are published and haven't been deleted. """ xblocks = get_course_blocks(course_key, category) # Secondary sort on credit requirement name xblocks = sorted(xblocks, key=lambda block: block.get_credit_requirement_display_name()) # Primary sort on start date xblocks = sorted(xblocks, key=lambda block: ( block.start if block.start is not None else datetime.datetime(datetime.MINYEAR, 1, 1).replace(tzinfo=UTC) )) return xblocks
def _get_xblocks(course_key, category): """ Retrieve all XBlocks in the course for a particular category. Returns only XBlocks that are published and haven't been deleted. """ xblocks = get_course_blocks(course_key, category) # Secondary sort on credit requirement name xblocks = sorted( xblocks, key=lambda block: block.get_credit_requirement_display_name()) # Primary sort on start date xblocks = sorted(xblocks, key=lambda block: (block.start if block.start is not None else datetime.datetime( datetime.MINYEAR, 1, 1).replace(tzinfo=UTC))) return xblocks