def set_grades_secret_route(): if validate_secret(secret=request.form.get("secret")) != get_course(): return jsonify({"success": False}) data = request.form.get("data") with transaction_db() as db: set_grades(data, get_course(), db) return jsonify({"success": True})
def set_grades_route(): if not is_staff(get_course()): return jsonify({"success": False}) data = request.form.get("data") with transaction_db() as db: set_grades(data, get_course(), db) return jsonify({"success": True})
def set_grades_route(): if not is_staff(get_course()): return jsonify({"success": False}) if not DEV and not can_user( course=get_course(), email=get_user()["email"], action="configure_howamidoing", ): return jsonify({"success": False}) data = request.form.get("data") with transaction_db() as db: set_grades(data, get_course(), db) return jsonify({"success": True})
def upload_grades(data: str): with transaction_db() as db: set_grades(data, get_course(), db)
db("""CREATE TABLE IF NOT EXISTS regrade_requests ( courseCode varchar(128), email varchar(128), assignment varchar(128), backup_id varchar(6), description varchar(255), status varchar(128), assigned_to varchar(128), resolution_reason varchar(255), emailed varchar(128) )""") if DEV and not IS_SPHINX: with connect_db() as db: with open("./public/config/dummy_grade_data.csv") as grades: set_grades(grades.read(), "cs61a", db) set_default_config(db) def last_updated(): """Finds the timestamp of when the current database was last updated for this course. Uses a database query function yielded by :func:`common.db.connect_db` and the course code returned by :func:`common.course_config.get_course` :return: Timestamp or ``Unknown`` (string) if any exceptions occur while fetching from the current database """ try: with connect_db() as db: return db(