File tree 3 files changed +30
-8
lines changed
3 files changed +30
-8
lines changed Original file line number Diff line number Diff line change 8
8
hooks :
9
9
- id : black
10
10
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
Original file line number Diff line number Diff line change @@ -84,3 +84,9 @@ Useful if you need throwaway accounts for demonstrations or testing.
84
84
Because dummy students don't have emails, they can't accept course invitations.
85
85
This script will enroll students (users) into any course without sending a
86
86
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.
Original file line number Diff line number Diff line change
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 })
You can’t perform that action at this time.
0 commit comments