Skip to content

Commit 9674643

Browse files
remove unittest hook, score_all_submissions script
1 parent 4be9642 commit 9674643

File tree

3 files changed

+30
-8
lines changed

3 files changed

+30
-8
lines changed

.pre-commit-config.yaml

+8-8
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ repos:
88
hooks:
99
- id: black
1010
language_version: python3.7
11-
- repo: local
12-
hooks:
13-
- id: unittest
14-
name: unittest
15-
language: system
16-
entry: python -m unittest discover ./tests
17-
types: [python]
18-
pass_filenames: true
11+
# - repo: local
12+
# hooks:
13+
# - id: unittest
14+
# name: unittest
15+
# language: system
16+
# entry: python -m unittest discover ./tests
17+
# types: [python]
18+
# pass_filenames: true

README.md

+6
Original file line numberDiff line numberDiff line change
@@ -84,3 +84,9 @@ Useful if you need throwaway accounts for demonstrations or testing.
8484
Because dummy students don't have emails, they can't accept course invitations.
8585
This script will enroll students (users) into any course without sending a
8686
confirmation or requiring them to accept an invitation.
87+
88+
#### score_all_submissions
89+
90+
This will fill in a score for an assignment if a submission is present. This is
91+
helpful if you want to give credit for completion without having to load the
92+
gradebook or go through the SpeedGrader.

score_all_submissions.py

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
from config import PROD_URL, PROD_KEY
2+
from canvasapi import Canvas
3+
import json
4+
5+
canvas = Canvas(PROD_URL, PROD_KEY)
6+
course_id = 12345 # target course ID
7+
assignment_id = 98765 # target assignment
8+
9+
course = canvas.get_course(course_id)
10+
assignment = course.get_assignment(assignment_id)
11+
submissions = assignment.get_submissions()
12+
13+
for sub in submissions:
14+
data = json.loads(sub.to_json())
15+
if data["submitted_at"] is not None:
16+
sub.edit(submission={"posted_grade": 1.0})

0 commit comments

Comments
 (0)