def _get_student_submissions(block_id, course_id, locator): """ Returns valid submission file paths with the username of the student that submitted them. Args: course_id (unicode): edx course id block_id (unicode): edx block id locator (BlockUsageLocator): BlockUsageLocator for the sga module Returns: list(tuple): A list of 2-element tuples - (student username, submission file path) """ submissions = submissions_api.get_all_submissions( course_id, block_id, ITEM_TYPE ) return [ ( user_by_anonymous_id(submission['student_id']).username, get_file_storage_path( locator, submission['answer']['sha1'], submission['answer']['filename'] ) ) for submission in submissions if submission['answer'] ]
def file_storage_path(self, file_hash, original_filename): # pylint: disable=no-member """ Helper method to get the path of an uploaded file """ return get_file_storage_path(self.location, file_hash, original_filename)
def _get_student_submissions(block_id, course_id, locator): """ Returns valid submission file paths with the username of the student that submitted them. Args: course_id (unicode): edx course id block_id (unicode): edx block id locator (BlockUsageLocator): BlockUsageLocator for the sga module Returns: list(tuple): A list of 2-element tuples - (student username, submission file path) """ submissions = submissions_api.get_all_submissions( course_id, block_id, ITEM_TYPE ) return [ ( user_by_anonymous_id(submission['student_id']).username, get_file_storage_path( locator, submission['answer']['sha1'], submission['answer']['filename'] ) ) for submission in submissions if submission['answer'] ]
def file_storage_path(self, file_hash, original_filename): # pylint: disable=no-member """ Helper method to get the path of an uploaded file """ return get_file_storage_path(self.location, file_hash, original_filename)