Skip to content

Conversation

@sebastianchristopher
Copy link

@sebastianchristopher sebastianchristopher commented Nov 20, 2025

Implementing this to allow us to post submissions from signup-assignments

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds functionality to submit an assignment on behalf of a student through the Canvas API. The implementation follows Canvas's "Submit an Assignment" API endpoint and integrates it into the existing submission handling infrastructure.

Key changes:

  • Adds a new SubmissionOptions request options class for configuring submission parameters
  • Extends the SubmissionWriter interface with a submitAssignment method
  • Implements the submission logic in SubmissionImpl using the Canvas API

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
SubmissionOptions.java New options class for submission parameters with builder-style methods and URL helper
SubmissionWriter.java Adds interface method for submitting assignments, returning raw Response
SubmissionImpl.java Implements the submission logic by constructing URL and calling Canvas API
BaseImpl.java Adds convenience overload of buildCanvasUrl without parameters

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
public Optional<Progress> gradeMultipleSubmissionsByCourse(MultipleSubmissionsOptions options) throws IOException;

/**
* Submit an assignment on behalf of a student.
Copy link
Member

Choose a reason for hiding this comment

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

While it can submit on behalf of a student, it only does that if you set the optional user_id

import org.apache.commons.lang3.StringUtils;

/**
* Submission options to submit an assignment on behalf of a user.
Copy link
Member

Choose a reason for hiding this comment

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

While it can submit on behalf of a student, it only does that if you set the optional user_id

Comment on lines 49 to 55
public SubmissionOptions useAssignmentLaunchUrl(String canvasBaseUrl) {
if (canvasBaseUrl == null || StringUtils.isBlank(canvasBaseUrl)) {
throw new IllegalArgumentException("canvasBaseUrl must not be blank");
}
String launchUrl = canvasBaseUrl + "/courses/" + courseId + "/assignments/" + assignmentId;
return this.url(launchUrl);
}
Copy link
Member

Choose a reason for hiding this comment

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

This seems strange as normally I'd expect the URL to point to the external tool.

@sebastianchristopher sebastianchristopher merged commit 26167ab into master Nov 24, 2025
1 check passed
@sebastianchristopher sebastianchristopher deleted the AB#107743 branch November 24, 2025 12:24
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.

3 participants