Notları ayarlama ve güncelleme

Bu kılavuzda, Classroom API ile ilgili notlandırma kod örnekleri verilmektedir. Bu belgede, temel Classroom not verme sürecine (StudentSubmission durumlarını ve notları yönetme) odaklanılmaktadır.

Classroom'daki not verme kavramları hakkında bilgi edinmek için Notlar kılavuzunu okuyun.

Öğrenci gönderimlerinin durumlarını yönetme

StudentSubmission teslimi iptal edilebilir, teslim edilebilir veya geri verilebilir. state alanı mevcut durumu gösterir. Notlandırma işlemi genellikle StudentSubmission TURNED_IN durumuna geçtikten sonra yapılır.

Classroom API'yi kullanarak durumu değiştirmek için aşağıdaki yöntemlerden birini çağırın:

Bu yöntemlerin tümü, aşağıdaki örnekte gösterildiği gibi boş bir body parametresini kabul eder:

Python

service.courses().courseWork().studentSubmission().turnIn(
    courseId=course_id,
    courseWorkId=coursework_id,
    id=studentsubmission_id,
    body={}).execute()

Java

classroom/snippets/src/main/java/ReturnStudentSubmission.java
try {
  service
      .courses()
      .courseWork()
      .studentSubmissions()
      .classroomReturn(courseId, courseWorkId, id, null)
      .execute();
} catch (GoogleJsonResponseException e) {
  // TODO (developer) - handle error appropriately
  GoogleJsonError error = e.getDetails();
  if (error.getCode() == 404) {
    System.out.printf(
        "The courseId (%s), courseWorkId (%s), or studentSubmissionId (%s) does "
            + "not exist.\n",
        courseId, courseWorkId, id);
  } else {
    throw e;
  }
} catch (Exception e) {
  throw e;
}

Öğrenci gönderimleri için not belirleme

StudentSubmission kaynağında, not verilen CourseWork çalışmaların genel notunu depolamak için iki alan bulunur:

  • draftGrade, yalnızca öğretmenlerin görebileceği, geçici bir nottur.
  • assignedGrade, öğrencilere bildirilen nottur.

Bu alanlar, aşağıdaki örnekte gösterildiği gibi courses.courseWork.studentSubmissions.patch kullanılarak güncellenir:

Python

studentSubmission = {
  'assignedGrade': 99,
  'draftGrade': 80
}

service.courses().courseWork().studentSubmissions().patch(
    courseId=course_id,
    courseWorkId=coursework_id,
    id=studentsubmission_id,
    updateMask='assignedGrade,draftGrade',
    body=studentSubmission).execute()

Java

classroom/snippets/src/main/java/PatchStudentSubmission.java
StudentSubmission studentSubmission = null;
try {
  // Updating the draftGrade and assignedGrade fields for the specific student submission.
  StudentSubmission content =
      service
          .courses()
          .courseWork()
          .studentSubmissions()
          .get(courseId, courseWorkId, id)
          .execute();
  content.setAssignedGrade(90.00);
  content.setDraftGrade(80.00);

  // The updated studentSubmission object is returned with the new draftGrade and assignedGrade.
  studentSubmission =
      service
          .courses()
          .courseWork()
          .studentSubmissions()
          .patch(courseId, courseWorkId, id, content)
          .set("updateMask", "draftGrade,assignedGrade")
          .execute();

  /* Prints the updated student submission. */
  System.out.printf(
      "Updated student submission draft grade (%s) and assigned grade (%s).\n",
      studentSubmission.getDraftGrade(), studentSubmission.getAssignedGrade());
} catch (GoogleJsonResponseException e) {
  // TODO (developer) - handle error appropriately
  GoogleJsonError error = e.getDetails();
  if (error.getCode() == 404) {
    System.out.printf(
        "The courseId (%s), courseWorkId (%s), or studentSubmissionId (%s) does "
            + "not exist.\n",
        courseId, courseWorkId, id);
  } else {
    throw e;
  }
} catch (Exception e) {
  throw e;
}
return studentSubmission;

Classroom kullanıcı arayüzüyle çalışırken öğretmenler, draftGrade kaydetmeden assignedGrade ayarlayamaz. assignedGrade daha sonra öğrenciye geri verilebilir. Uygulamanız, öğrencinin ödevini iki şekilde notlandırabilir:

  • Yalnızca draftGrade değerini atayın. Bu özellik, örneğin, öğretmenlerin notları sonlandırmadan önce manuel olarak incelemesine olanak tanımak için kullanışlıdır. Öğrenciler taslak notları göremez.

  • Bir ödevi tam olarak notlandırmak için hem draftGrade hem de assignedGrade değerini atayın.

Hangi alanın ayarlanacağını yapılandırmak için updateMask bağımsız değişkenini kullanın.

StudentSubmissions değiştirme için gereken kapsamları ve izinleri anlamak üzere Öğrenci yanıtına ek ekleme başlıklı makaleyi inceleyin.

Atanan notları okuma

Belirli bir CourseWork için tüm notlara erişmek istiyorsanız tüm ilgili StudentSubmissions değerlerini almak üzere courses.courseWork.studentSubmissions.list yöntemini kullanın ve uygun assignedGrade ile draftGrade alanlarını inceleyin:

Python

response = coursework.studentSubmissions().list(
    courseId=course_id,
    courseWorkId=coursework_id,
    # optionally include `pageSize` to restrict the number of student
    # submissions included in the response.
    pageSize=10
).execute()
submissions.extend(response.get('studentSubmissions', []))

if not submissions:
    print('No student submissions found.')

print('Student Submissions:')

for submission in submissions:
    print(f"Submitted at:"
          f"{(submission.get('userId'), submission.get('assignedGrade'))}")

Java

classroom/snippets/src/main/java/ListStudentSubmissions.java
  ListStudentSubmissionsResponse response =
      service
          .courses()
          .courseWork()
          .studentSubmissions()
          .list(courseId, courseWorkId)
          .setPageToken(pageToken)
          .execute();

  /* Ensure that the response is not null before retrieving data from it to avoid errors. */
  if (response.getStudentSubmissions() != null) {
    studentSubmissions.addAll(response.getStudentSubmissions());
    pageToken = response.getNextPageToken();
  }
} while (pageToken != null);

if (studentSubmissions.isEmpty()) {
  System.out.println("No student submissions found.");
} else {
  for (StudentSubmission submission : studentSubmissions) {
    System.out.printf(
        "User ID %s, Assigned grade: %s\n",
        submission.getUserId(), submission.getAssignedGrade());
  }
}

Kapsamları ve StudentSubmissions okumak için gereken izinleri anlamak üzere Öğrenci yanıtlarını alma başlıklı makaleyi inceleyin.

Genel kurs notlarını belirleme

Classroom API, geliştiricilerin genel kurs notunu okumasına veya yazmasına izin vermez ancak bu notu programlı olarak hesaplayabilirsiniz. Genel notu hesaplamak istiyorsanız Notlar kılavuzunu okuyarak önemli kavramlar (ör. muaf CourseWork, notlandırma dönemleri ve farklı notlandırma sistemleri) hakkında bilgi edinin.

Eklenti eklerine not verme

Classroom eklentileri geliştiricisiyseniz tek tek eklenti ekleri için not belirleyebilir ve notu, öğretmenler öğrenci çalışmalarını incelerken görünür olacak şekilde yapılandırabilirsiniz. Daha fazla bilgi için Etkinlik türü ekleri ve Notları geri aktarma ile ilgili adım adım açıklamaları inceleyin.

Puan anahtarı notları

StudentSubmissions, Rubrics temelinde verilen puanları temsil eden alanlara sahip olmalıdır:

  • draftRubricGrade, yalnızca öğretmenler tarafından görülebilen Criterion puanlarının deneme amaçlı bir kümesidir.
  • assignedRubricGrade, öğrencilere bildirilen Criterion puanları kümesidir.

Puanlama anahtarı puanları Google Classroom API kullanılarak ayarlanamaz ancak okunabilir. Daha fazla bilgi edinmek için Rubrikler kılavuzu ve sınırlamalar bölümüne bakın.