Skip to content

Conversation

jferrl
Copy link
Contributor

@jferrl jferrl commented Sep 24, 2025

Fixes: #3684.

Summary

This PR adds support for two missing GitHub Classroom API endpoints by implementing the ListAcceptedAssignments and GetAssignmentGrades methods in the ClassroomService.

Changes

New Methods

  • ListAcceptedAssignments - Lists accepted assignments for a specific assignment
  • GetAssignmentGrades - Retrieves assignment grades for a specific assignment

API Coverage

This completes the implementation of all 6 available GitHub Classroom API endpoints:

  • GET /assignments/{assignment_id}GetAssignment()
  • GET /assignments/{assignment_id}/accepted_assignmentsListAcceptedAssignments() ← NEW
  • GET /assignments/{assignment_id}/gradesGetAssignmentGrades() ← NEW
  • GET /classroomsListClassrooms()
  • GET /classrooms/{classroom_id}GetClassroom()
  • GET /classrooms/{classroom_id}/assignmentsListClassroomAssignments()

@jferrl
Copy link
Contributor Author

jferrl commented Sep 24, 2025

@gmlewis this is the latest PR to close #3684 😃

@gmlewis
Copy link
Collaborator

gmlewis commented Sep 24, 2025

Fixes: #3684.

Copy link

codecov bot commented Sep 24, 2025

Codecov Report

❌ Patch coverage is 91.42857% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.11%. Comparing base (1b53270) to head (9bce5fc).
⚠️ Report is 10 commits behind head on master.

Files with missing lines Patch % Lines
github/classroom.go 91.42% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3732      +/-   ##
==========================================
- Coverage   91.11%   91.11%   -0.01%     
==========================================
  Files         187      187              
  Lines       16686    16697      +11     
==========================================
+ Hits        15204    15213       +9     
- Misses       1295     1296       +1     
- Partials      187      188       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Collaborator

@gmlewis gmlewis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, @jferrl!
LGTM.
Awaiting second LGTM+Approval from any other contributor to this repo before merging.

cc: @stevehipwell - @alexandear

Passing *bool `json:"passing,omitempty"`
CommitCount *int `json:"commit_count,omitempty"`
Grade *string `json:"grade,omitempty"`
Students []*User `json:"students,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it's better to create a separate struct ClassroomUser and use it instead of the User?

This struct will contain only 4 fields while the User has more than 20 fields:

          "title": "Simple Classroom User",
          "description": "A GitHub user simplified for Classroom.",
          "type": "object",
          "properties": {
            "id": {
              "type": "integer",
              "examples": [
                1
              ]
            },
            "login": {
              "type": "string",
              "examples": [
                "octocat"
              ]
            },
            "avatar_url": {
              "type": "string",
              "format": "uri",
              "examples": [
                "https://github.com/images/error/octocat_happy.gif"
              ]
            },
            "html_url": {
              "type": "string",
              "format": "uri",
              "examples": [
                "https://github.com/octocat"
              ]
            }
          },
          "required": [
            "id",
            "login",
            "avatar_url",
            "html_url"
          ]

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

AssignmentName *string `json:"assignment_name,omitempty"`
AssignmentURL *string `json:"assignment_url,omitempty"`
StarterCodeURL *string `json:"starter_code_url,omitempty"`
GithubUsername *string `json:"github_username,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
GithubUsername *string `json:"github_username,omitempty"`
GitHubUsername *string `json:"github_username,omitempty"`

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, we decided years ago that in this repo, we are going to strictly follow the capitalization of the JSON tag, so that GithubUsername in this case is correct.

If they had named the field git_hub_username, then you would be right, but they don't, so we don't.

I'll see if I can find the conversation.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's one instance, but am still trying to find the original decision with the repo's original author.
#2851 (comment)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this is what I'm thinking of, although I'm pretty sure there was a separate discussion specifically about Github vs GitHub.
#605

@alexandear
Copy link
Contributor

Can we improve also PR's title? The PR is definitely not a "chore" but a "feature".

@gmlewis gmlewis changed the title chore: Add ListAcceptedAssignments and GetAssignmentGrades methods to Classroom API feat: Add ListAcceptedAssignments and GetAssignmentGrades methods to Classroom API Sep 25, 2025
@jferrl jferrl requested a review from alexandear September 25, 2025 19:51
@gmlewis
Copy link
Collaborator

gmlewis commented Sep 26, 2025

Thank you, @alexandear!
Merging.

@gmlewis gmlewis merged commit 49c0748 into google:master Sep 26, 2025
6 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for GitHub Classroom API

3 participants