Skip to content

Comments to submissions are always added to first attempt #631

Open
@hokies9402

Description

@hokies9402

When using upload_comment in the submission.py the files that are uploaded are always attached to attempt 1 regardless of which attempt the comment was meant for

To Reproduce

  1. Submit an assignment to canvas.
  2. Use upload_comment to attach a file as a comment to the submission attempt.
  3. Resubmit to the same assignment as the same student.
  4. Use upload_comment again to upload another file comment.
  5. See that both files are attached to attempt 1, not attempt 1 and then attempt 2.

Expected behavior

When you upload a file as a comment it is attached to the most recent attempt, not attempt 1 always

Environment information

  • Python version (python --version)

  • [@spruce ~]$ python --version
    Python 3.9.16

  • CanvasAPI version (pip show canvasapi)

  • [@spruce ~]$ pip show canvasapi
    Name: canvasapi
    Version: 3.1.0
    Summary: API wrapper for the Canvas LMS
    Home-page: https://github.com/ucfopen/canvasapi
    Author: University of Central Florida - Center for Distributed Learning
    Author-email: techrangers@ucf.edu
    License: MIT License
    Location: /home/staff/dmcphers/.local/lib/python3.9/site-packages
    Requires: arrow, pytz, requests
    Required-by:

Additional context

I already know how to fix this.
Line 180 change it from this:

self.edit(comment={"file_ids": [response[1]["id"]]})

Line 180 change it to this:

self.edit(comment={"file_ids": [response[1]["id"]], "attempt": self.attempt})

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions