示例#1
0
def updategradecontroller():
    if session.get('login'):
        grade = Grade(dsn=app.config['dsn'])
        grade_id = request.form['grade']
        operation = request.form['updateordelete']
        if str(operation) == 'update':
            new_explanation = request.form['new_explanation']
            new_grade = request.form['new_grade']
            my_grade = grade.get_grade(grade_id)
            grade.update_grade(grade_id, my_grade[1], my_grade[2], new_grade,
                               new_explanation)
            return "Guncelleme basarili"
        else:
            grade.delete_grade(grade_id)
            return "Silme basarili"

    else:
        return redirect(url_for('home_page'))
示例#2
0
def main():
    g = Grade(rubric, weights, '../data/')

    try:
        test_data = pandas.read_csv('../data/test_set.tsv',
                                    sep='\t',
                                    encoding='ISO-8859-1')

        # Grade each essay
        a = 0
        for i in test_data['essay']:
            a += 1
            print(
                "-------------------------------------------------------------------------------------------------\n"
            )
            print("Essay: ", a)
            db, gd, out = g.get_grade(i)
            print(db + "Grade: " + str(gd) + "\n" + out)

    except FileNotFoundError:
        print("../data/test_set.tsv not found")