我希望我的脚本在Google课堂作业中设置成绩。我希望您能从下面的代码中获得一些帮助,这些代码我还不知道如何将请求中的studentSubmission传递给gapi.client.classroom.courses.courseWork.studentSubmissions.patch。
我设置的授权范围: https://www.googleapis.com/auth/classroom.coursework.students https://www.googleapis.com/auth/classroom.coursework.me
我可以确认associatedWithDeveloper确实返回true,所以我要评分的作业确实是由我编写的程序创建的。另外,gcourseId,gcourseWorkId和gstudentSubmissionID都是正确的。
(注意:此脚本在第三方网站上运行,而不是在Google Apps脚本中运行)
function gradeInGClassroom(gStdSubmissionID){
var studentSubmission = {
'assignedGrade': 94,
'draftGrade': 94
}
gapi.client.classroom.courses.courseWork.studentSubmissions.patch({
//======================================
// HERE: This is where I need to pass the var "studentSubmission" to patch(), but I do not know the syntax...
//I tried "studentSubmission: " as a key, but field not found...
//======================================
courseId: gCourseId,
courseWorkId: gCourseWorkId,
id: gStdSubmissionID,
updateMask: 'assignedGrade,draftGrade'
}).then(function(response) {
// Some success message here...
});
}
感谢您的帮助!
(一旦解决此问题,我需要解决PERMISSION_DENIED的问题)。