def evaluation_response(cls, answer_comment): activity = Activity( id=ResourceIRI.evaluation_response(answer_comment.course_uuid, answer_comment.assignment_uuid, answer_comment.answer_uuid, answer_comment.uuid), definition=ActivityDefinition( type=XAPIActivity.activity_types.get('solution'), description=LanguageMap({ 'en-US': LearningRecord.trim_text_to_size_limit(answer_comment.content) }), extensions=Extensions() ) ) activity.definition.extensions['http://id.tincanapi.com/extension/isDraft'] = answer_comment.draft return activity
def evaluation_response(cls, answer_comment, evaluation_number): ret = { "id": ResourceIRI.evaluation_response(answer_comment.course_uuid, answer_comment.assignment_uuid, answer_comment.answer_uuid, answer_comment.uuid), "type": CALIPER_ENTITY_TYPES["RESPONSE"], "dateCreated": answer_comment.created.replace(tzinfo=pytz.utc).isoformat(), "dateModified": answer_comment.modified.replace(tzinfo=pytz.utc).isoformat(), "extensions": { "isDraft": answer_comment.draft } } ret["extensions"].update(cls._basic_content_extension(answer_comment.content)) if answer_comment.attempt_uuid: ret["attempt"] = CaliperEntities.evaluation_attempt(answer_comment, evaluation_number) return ret
def evaluation_response(cls, answer_comment): activity = Activity( id=ResourceIRI.evaluation_response(answer_comment.course_uuid, answer_comment.assignment_uuid, answer_comment.answer_uuid, answer_comment.uuid), definition=ActivityDefinition( type=XAPIActivity.activity_types.get('solution'), description=LanguageMap({ 'en-US': LearningRecord.trim_text_to_size_limit( answer_comment.content) }), extensions=Extensions())) activity.definition.extensions[ 'http://id.tincanapi.com/extension/isDraft'] = answer_comment.draft return activity
def evaluation_response(cls, answer_comment, evaluation_number): attempt = None extensions = {"isDraft": answer_comment.draft} if answer_comment.attempt_uuid: attempt = CaliperEntities.evaluation_attempt( answer_comment, evaluation_number) extensions.update(cls._basic_content_extension(answer_comment.content)) return caliper.entities.Response( id=ResourceIRI.evaluation_response(answer_comment.course_uuid, answer_comment.assignment_uuid, answer_comment.answer_uuid, answer_comment.uuid), attempt=attempt, dateCreated=answer_comment.created.replace( tzinfo=pytz.utc).strftime('%Y-%m-%dT%H:%M:%S.%f')[:-3] + 'Z', dateModified=answer_comment.modified.replace( tzinfo=pytz.utc).strftime('%Y-%m-%dT%H:%M:%S.%f')[:-3] + 'Z', extensions=extensions)