예제 #1
0
    def validate_draft(cls, draftstring, configstring):
        draft = json.loads(draftstring)
        cls.validate_dict(draft, DraftValidationError, {'approved': bool,
                                                        'points': int,
                                                        'grade': basestring,
                                                        'feedback': basestring})

        cls.validate_gradeeditor_key(draft, 'manual')

        if draft['grade'] == '':
            raise DraftValidationError('Grade-field cannot be empty')

    @classmethod
    def draft_to_staticfeedback_kwargs(cls, draftstring, configstring):
        draft = json.loads(draftstring)
        is_approved = draft['approved']
        points = draft['points']
        grade = draft['grade']
        feedback = draft['feedback']

        approved = 'not approved'
        if is_approved:
            approved = 'approved'

        return dict(is_passing_grade=is_approved,
                    grade=grade,
                    points=points,
                    rendered_view=markdown_full(feedback))

gradeeditor_registry.register(Manual)
예제 #2
0
        points = draft['points']
        feedback = draft['feedback']

        cls.validate_dict(draft, DraftValidationError, {'points': int,
                                                        'feedback': basestring})
        cls.validate_gradeeditor_key(draft, 'autograde')

        if points > config['maxpoints'] or points < 0:
            raise DraftValidationError('The points-field must be a value between 0 and {}'.format(config['maxpoints']))


    @classmethod
    def draft_to_staticfeedback_kwargs(cls, draftstring, configstring):
        config = cls.decode_configstring(configstring)
        buf = json.loads(draftstring)
        points = buf['points']
        feedback = buf['feedback']

        grade = cls.getGrade(points, config['grades'])

        is_approved = False
        if points >= config['approvedlimit']:
            is_approved = True

        return dict(is_passing_grade=is_approved,
                    grade=grade,
                    points=points,
                    rendered_view=markdown_full(feedback))

gradeeditor_registry.register(Autograde)
예제 #3
0

    @classmethod
    def draft_to_staticfeedback_kwargs(cls, draftstring, configstring):
        #TODO: For now, 'grade' is just set to be points, but all info from configs and drafts is available here, so anything can be shown to the student.
        # might want to add grade-calculation like autograde in the config though..
        draft = json.loads(draftstring)
        config = json.loads(configstring)
        draftval = draft['values']
        confval = config['formValues']
        points = 0

        for i in xrange(0, len(draftval)):
            if confval[i][0]=='check':
                if draftval[i]:
                    points+=int(confval[i][1])

            elif confval[i][0] == 'number':
                points+=draftval[i]

        is_approved = False
        if points >= config['approvedLimit']:
            is_approved = True

        return dict(is_passing_grade=is_approved,
                    grade=points,
                    points=points,
                    rendered_view=markdown_full(draft['feedback']))

gradeeditor_registry.register(BasicForm)
예제 #4
0
    gradeeditorid = 'approved'
    title = 'Approved'
    description = 'A simple gradeeditor that allows examiners to select if delivery is approved or not approved, and give a feedback text.'
    config_editor_url = None
    draft_editor_url = settings.DEVILRY_STATIC_URL + '/approved_gradeeditor/drafteditor.js'

    @classmethod
    def validate_draft(cls, draftstring, configstring):
        draft = json.loads(draftstring)
        cls.validate_dict(draft, DraftValidationError, {
            'approved': bool,
            'feedback': basestring
        })
        cls.validate_gradeeditor_key(draft, 'approved')

    @classmethod
    def draft_to_staticfeedback_kwargs(cls, draftstring, configstring):
        draft = json.loads(draftstring)
        is_approved = draft['approved']
        if is_approved:
            grade = 'approved'
        else:
            grade = 'not approved'
        return dict(is_passing_grade=is_approved,
                    grade=grade,
                    points=int(is_approved),
                    rendered_view=markdown_full(draft['feedback']))


gradeeditor_registry.register(Approved)
예제 #5
0
                        val) + " points:** " + confval[i][3]) + "</li>\n"

            elif confval[i][0] == 'number':
                points += draftval[i]
                val = int(draftval[i])
                if (val > 0):
                    prefix = "+"
                else:
                    prefix = u"\u00f7"
                    val = -val
                if val != 0:
                    feedback += "<li>" + markdown_full("**" + prefix + str(
                        val) + " points:** " + confval[i][3]) + "</li>\n"

        feedback += "</ul>\n"

        is_approved = False
        if points >= config['approvedLimit']:
            is_approved = True

        # Putting the feedback text and the full feedback together
        feedback = markdown_full(draft['feedback']) + "\n" + feedback

        return dict(is_passing_grade=is_approved,
                    grade=points,
                    points=points,
                    rendered_view=feedback)


gradeeditor_registry.register(CommentForm)
예제 #6
0
            'points': int,
            'feedback': basestring
        })
        cls.validate_gradeeditor_key(draft, 'autograde')

        if points > config['maxpoints'] or points < 0:
            raise DraftValidationError(
                'The points-field must be a value between 0 and {}'.format(
                    config['maxpoints']))

    @classmethod
    def draft_to_staticfeedback_kwargs(cls, draftstring, configstring):
        config = cls.decode_configstring(configstring)
        buf = json.loads(draftstring)
        points = buf['points']
        feedback = buf['feedback']

        grade = cls.getGrade(points, config['grades'])

        is_approved = False
        if points >= config['approvedlimit']:
            is_approved = True

        return dict(is_passing_grade=is_approved,
                    grade=grade,
                    points=points,
                    rendered_view=markdown_full(feedback))


gradeeditor_registry.register(Autograde)
예제 #7
0
    """
    Serves as a minimal example of a grade editor, and as a well suited grade
    editor for use in test cases.
    """
    gradeeditorid = 'approved'
    title = 'Approved/not approved'
    description = '<p>A simple gradeeditor that allows examiners to select if delivery is approved or not approved, and give a feedback text.</p>'
    config_editor_url = None
    draft_editor_url = settings.DEVILRY_STATIC_URL + '/approved_gradeeditor/drafteditor.js'
    shortformat = ApprovedShortFormat

    @classmethod
    def validate_draft(cls, draftstring, configstring):
        draft = json.loads(draftstring)
        cls.validate_dict(draft, DraftValidationError, {'approved': bool,
                                                        'feedback': basestring})
        cls.validate_gradeeditor_key(draft, 'approved')


    @classmethod
    def draft_to_staticfeedback_kwargs(cls, draftstring, configstring):
        draft = json.loads(draftstring)
        is_approved = draft['approved']
        grade = _grade_from_is_passing_grade(is_approved)
        return dict(is_passing_grade=is_approved,
                    grade=grade,
                    points=int(is_approved),
                    rendered_view=markdown_full(draft['feedback']))

gradeeditor_registry.register(Approved)
예제 #8
0
    @classmethod
    def draft_to_staticfeedback_kwargs(cls, draftstring, configstring):
        #TODO: For now, 'grade' is just set to be points, but all info from configs and drafts is available here, so anything can be shown to the student.
        # might want to add grade-calculation like autograde in the config though..
        draft = json.loads(draftstring)
        config = json.loads(configstring)
        draftval = draft['values']
        confval = config['formValues']
        points = 0

        for i in xrange(0, len(draftval)):
            if confval[i][0] == 'check':
                if draftval[i]:
                    points += int(confval[i][1])

            elif confval[i][0] == 'number':
                points += draftval[i]

        is_approved = False
        if points >= config['approvedLimit']:
            is_approved = True

        return dict(is_passing_grade=is_approved,
                    grade=points,
                    points=points,
                    rendered_view=markdown_full(draft['feedback']))


gradeeditor_registry.register(BasicForm)
예제 #9
0
                'approved': bool,
                'points': int,
                'grade': basestring,
                'feedback': basestring
            })

        cls.validate_gradeeditor_key(draft, 'manual')

        if draft['grade'] == '':
            raise DraftValidationError('Grade-field cannot be empty')

    @classmethod
    def draft_to_staticfeedback_kwargs(cls, draftstring, configstring):
        draft = json.loads(draftstring)
        is_approved = draft['approved']
        points = draft['points']
        grade = draft['grade']
        feedback = draft['feedback']

        approved = 'not approved'
        if is_approved:
            approved = 'approved'

        return dict(is_passing_grade=is_approved,
                    grade=grade,
                    points=points,
                    rendered_view=markdown_full(feedback))


gradeeditor_registry.register(Manual)
예제 #10
0
    draft_editor_url = settings.DEVILRY_STATIC_URL + '/asminimalaspossible_gradeeditor/drafteditor.js'

    @classmethod
    def validate_config(cls, configstring):
        config = cls.decode_configstring(configstring)
        cls.validate_dict(config, ConfigValidationError, {'defaultvalue': bool,
                                                          'fieldlabel': basestring})

    @classmethod
    def validate_draft(cls, draftstring, configstring):
        is_approved = cls.decode_draftstring(draftstring)
        if not isinstance(is_approved, bool):
            raise DraftValidationError('The draft string must contain a single boolean value.')
        ## Uncomment to see how validation errors work:
        #raise DraftValidationError('Some error occurred.')

    @classmethod
    def draft_to_staticfeedback_kwargs(cls, draftstring, configstring):
        is_approved = json.loads(draftstring)
        if is_approved:
            grade = 'approved'
        else:
            grade = 'not approved'
        return dict(is_passing_grade=is_approved,
                    grade=grade,
                    points=int(is_approved),
                    rendered_view='Your grade is: {0}'.format(grade))


gradeeditor_registry.register(AsMinimalAsPossible)
예제 #11
0
                        val = - val
                    feedback += "<li>" + markdown_full("**" + prefix + str(val) + " points:** " + confval[i][3]) +  "</li>\n"
                nr += 1
            elif confval[i][0] == 'number':
                points+=draftval[nr]
                val = int(draftval[nr])
                if(val > 0):                                                       
                    prefix = "+"
                else:                                                                             
                    prefix = u"\u2012"
                    val = - val
                if val != 0:
                    feedback += "<li>" + markdown_full("**" + prefix + str(val) + " points:** " + confval[i][3] ) + "</li>\n"
                nr += 1

        feedback += "</ul>\n"

        is_approved = False
        if points >= config['approvedLimit']:
            is_approved = True

        # Putting the feedback text and the full feedback together
        feedback = markdown_full(draft['feedback']) + "\n" + feedback

        return dict(is_passing_grade=is_approved,
                    grade=points,
                    points=points,
                    rendered_view=feedback)

gradeeditor_registry.register(CommentForm)
예제 #12
0
        config = cls.decode_configstring(configstring)
        cls.validate_dict(config, ConfigValidationError, {
            'defaultvalue': bool,
            'fieldlabel': basestring
        })

    @classmethod
    def validate_draft(cls, draftstring, configstring):
        is_approved = cls.decode_draftstring(draftstring)
        if not isinstance(is_approved, bool):
            raise DraftValidationError(
                'The draft string must contain a single boolean value.')
        ## Uncomment to see how validation errors work:
        #raise DraftValidationError('Some error occurred.')

    @classmethod
    def draft_to_staticfeedback_kwargs(cls, draftstring, configstring):
        is_approved = json.loads(draftstring)
        if is_approved:
            grade = 'approved'
        else:
            grade = 'not approved'
        return dict(is_passing_grade=is_approved,
                    grade=grade,
                    points=int(is_approved),
                    rendered_view='Your grade is: {0}'.format(
                        grade.encode(CHARSET)))


gradeeditor_registry.register(AsMinimalAsPossible)