Skip to content

feat: implement instructor API v2 grading GET endpoints#37890

Open
brianjbuck-wgu wants to merge 1 commit intoopenedx:masterfrom
WGU-Open-edX:feature/37889-instructor-dashboard-grading-get-endpoints
Open

feat: implement instructor API v2 grading GET endpoints#37890
brianjbuck-wgu wants to merge 1 commit intoopenedx:masterfrom
WGU-Open-edX:feature/37889-instructor-dashboard-grading-get-endpoints

Conversation

@brianjbuck-wgu
Copy link
Contributor

@brianjbuck-wgu brianjbuck-wgu commented Jan 14, 2026

Summary

This PR implements three new GET endpoints for the Instructor Dashboard API v2 grading operations, as specified in the OpenAPI schema from #37743.

New Endpoints:

  1. GET /api/instructor/v2/courses/{course_id}/learners/{email_or_username}

    • Retrieves comprehensive learner information including profile, enrollment status, progress URLs, and current grading data
    • Accepts either username or email as identifier
  2. GET /api/instructor/v2/courses/{course_id}/problems/{location}

    • Retrieves problem metadata with display name and course hierarchy breadcrumbs
    • Helps instructors navigate and identify specific problems within course structure
  3. GET /api/instructor/v2/courses/{course_id}/tasks/{task_id}

    • Checks status of background tasks (e.g., bulk grading operations)
    • Returns task state (pending/running/completed/failed) with progress tracking and results

All endpoints follow existing instructor API v2 patterns with proper authentication, permission checks, and error handling.

@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Jan 14, 2026
@openedx-webhooks
Copy link

openedx-webhooks commented Jan 14, 2026

Thanks for the pull request, @brianjbuck-wgu!

This repository is currently maintained by @openedx/wg-maintenance-openedx-platform.

Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review.

🔘 Get product approval

If you haven't already, check this list to see if your contribution needs to go through the product review process.

  • If it does, you'll need to submit a product proposal for your contribution, and have it reviewed by the Product Working Group.
    • This process (including the steps you'll need to take) is documented here.
  • If it doesn't, simply proceed with the next step.
🔘 Provide context

To help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:

  • Dependencies

    This PR must be merged before / after / at the same time as ...

  • Blockers

    This PR is waiting for OEP-1234 to be accepted.

  • Timeline information

    This PR must be merged by XX date because ...

  • Partner information

    This is for a course on edx.org.

  • Supporting documentation
  • Relevant Open edX discussion forum threads
🔘 Get a green build

If one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green.

Details
Where can I find more information?

If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources:

When can I expect my changes to be merged?

Our goal is to get community contributions seen and reviewed as efficiently as possible.

However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:

  • The size and impact of the changes that it introduces
  • The need for product review
  • Maintenance status of the parent repository

💡 As a result it may take up to several weeks or months to complete a review and merge your PR.

@github-project-automation github-project-automation bot moved this to Needs Triage in Contributions Jan 14, 2026
@mphilbrick211 mphilbrick211 added the mao-onboarding Reviewing this will help onboard devs from an Axim mission-aligned organization (MAO). label Jan 16, 2026
@mphilbrick211 mphilbrick211 moved this from Needs Triage to Waiting on Author in Contributions Jan 16, 2026
@brianjbuck-wgu brianjbuck-wgu force-pushed the feature/37889-instructor-dashboard-grading-get-endpoints branch from a143cc2 to 7cfdc7a Compare January 28, 2026 18:31
@brianjbuck-wgu brianjbuck-wgu marked this pull request as ready for review January 28, 2026 18:31
@brianjbuck-wgu brianjbuck-wgu force-pushed the feature/37889-instructor-dashboard-grading-get-endpoints branch 2 times, most recently from 8bdff7a to dcc4052 Compare January 30, 2026 17:43
@brianjbuck-wgu brianjbuck-wgu force-pushed the feature/37889-instructor-dashboard-grading-get-endpoints branch from dcc4052 to a26adc7 Compare February 9, 2026 22:27
@mphilbrick211 mphilbrick211 moved this from Waiting on Author to In Eng Review in Contributions Feb 10, 2026
@brianjbuck-wgu brianjbuck-wgu force-pushed the feature/37889-instructor-dashboard-grading-get-endpoints branch 2 times, most recently from 1b5b753 to f3418b2 Compare February 25, 2026 15:45
@brianjbuck-wgu brianjbuck-wgu force-pushed the feature/37889-instructor-dashboard-grading-get-endpoints branch from f3418b2 to addc687 Compare February 25, 2026 16:03
Copy link
Contributor

@dwong2708 dwong2708 left a comment

Choose a reason for hiding this comment

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

Looks nice. Just a couple of suggestions and I was wondering if there is way to avoid repetitions at the moment of get the course id and its validation.

)

try:
student = get_student_from_identifier(email_or_username)
Copy link
Contributor

Choose a reason for hiding this comment

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

I noticed get_student_from_identifier is deprecated. However, it is pointing to get_user_by_username_or_email that is not deprecated. I recommend use directly the no deprecated one in case of get_student_from_identifier is removed.

'last_name': student.last_name,
'progress_url': progress_url,
'gradebook_url': gradebook_url,
'current_score': None,
Copy link
Contributor

Choose a reason for hiding this comment

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

is there a special reason these are None values?

'breadcrumbs': [b for b in breadcrumbs if b.get('usage_key') is not None or breadcrumbs.index(b) == 0]
}

from .serializers_v2 import ProblemSerializer
Copy link
Contributor

Choose a reason for hiding this comment

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

Please move this import at the top of the file


# Add progress if available
if hasattr(task, 'task_output') and task.task_output:
import json
Copy link
Contributor

Choose a reason for hiding this comment

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

Please move this import at the top of the file


try:
student = get_student_from_identifier(email_or_username)
except Exception: # pylint: disable=broad-except
Copy link
Contributor

Choose a reason for hiding this comment

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

The function get_user_by_username_or_email raises the following exceptions:

  • User.DoesNotExist if no user object can be found, the user was retired, or the user is in the process of being retired.
  • MultipleObjectsReturned if one user has same email as username of second user
  • MultipleObjectsReturned if more than one user has same email or username

Would it be worth to return the correct response messages accordingly?

'message': str(task.task_output) if task.task_output else 'Task failed'
}

from .serializers_v2 import TaskStatusSerializer
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here please

@diana-villalvazo-wgu
Copy link

Screenshot 2026-02-25 at 4 06 09 p m I tested first endpoint and im not getting my first name and last name 😞 and can we get fullname instead? 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mao-onboarding Reviewing this will help onboard devs from an Axim mission-aligned organization (MAO). open-source-contribution PR author is not from Axim or 2U

Projects

Status: In Eng Review

Development

Successfully merging this pull request may close these issues.

5 participants