示例#1
0
 def answer_comment(cls, answer_comment):
     return caliper.entities.Comment(
         id=ResourceIRI.answer_comment(answer_comment.course_uuid,
                                       answer_comment.assignment_uuid,
                                       answer_comment.answer_uuid,
                                       answer_comment.uuid),
         commenter=CaliperActor.generate_actor(answer_comment.user),
         commentedOn=CaliperEntities.answer(answer_comment.answer),
         value=LearningRecord.trim_text_to_size_limit(
             answer_comment.content),
         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={
             "type":
             answer_comment.comment_type.value,
             "isDraft":
             answer_comment.draft,
             "characterCount":
             LearningRecord.character_count(answer_comment.content)
             if answer_comment.content else 0,
             "wordCount":
             LearningRecord.word_count(answer_comment.content)
             if answer_comment.content else 0
         })
示例#2
0
文件: object.py 项目: ubc/acj-versus
    def answer_comment(cls, answer_comment):
        activity = Activity(
            id=ResourceIRI.answer_comment(answer_comment.course_uuid, answer_comment.assignment_uuid,
                answer_comment.answer_uuid, answer_comment.uuid),
            definition=ActivityDefinition(
                type=XAPIActivity.activity_types.get('comment'),
                name=LanguageMap({ 'en-US': "Assignment answer comment" }),
                extensions=Extensions()
            )
        )
        activity.definition.extensions['http://id.tincanapi.com/extension/type'] = answer_comment.comment_type.value
        activity.definition.extensions['http://id.tincanapi.com/extension/isDraft'] = answer_comment.draft

        return activity
示例#3
0
    def answer_comment(cls, answer_comment):
        activity = Activity(
            id=ResourceIRI.answer_comment(answer_comment.course_uuid,
                                          answer_comment.assignment_uuid,
                                          answer_comment.answer_uuid,
                                          answer_comment.uuid),
            definition=ActivityDefinition(
                type=XAPIActivity.activity_types.get('comment'),
                name=LanguageMap({'en-US': "Assignment answer comment"}),
                extensions=Extensions()))
        activity.definition.extensions[
            'http://id.tincanapi.com/extension/type'] = answer_comment.comment_type.value
        activity.definition.extensions[
            'http://id.tincanapi.com/extension/isDraft'] = answer_comment.draft

        return activity
示例#4
0
 def answer_comment(cls, answer_comment):
     #TODO: this isn't in the Caliper spec yet
     return {
         "id": ResourceIRI.answer_comment(answer_comment.course_uuid, answer_comment.assignment_uuid,
             answer_comment.answer_uuid, answer_comment.uuid),
         "type": "Comment",
         "commenter": CaliperActor.generate_actor(answer_comment.user),
         "commented": CaliperEntities.answer(answer_comment.answer),
         "value": LearningRecord.trim_text_to_size_limit(answer_comment.content),
         "dateCreated": answer_comment.created.replace(tzinfo=pytz.utc).isoformat(),
         "dateModified": answer_comment.modified.replace(tzinfo=pytz.utc).isoformat(),
         "extensions": {
             "type": answer_comment.comment_type.value,
             "isDraft": answer_comment.draft,
             "characterCount": LearningRecord.character_count(answer_comment.content) if answer_comment.content else 0,
             "wordCount": LearningRecord.word_count(answer_comment.content) if answer_comment.content else 0
         }
     }