-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into add-caching
Resolved conflicts: src/canvaslms/cli/assignments.nw src/canvaslms/cli/submissions.nw src/canvaslms/hacks/canvasapi.nw
- Loading branch information
Showing
36 changed files
with
4,301 additions
and
409 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# To get started with Dependabot version updates, you'll need to specify which | ||
# package ecosystems to update and where the package manifests are located. | ||
# Please see the documentation for all configuration options: | ||
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates | ||
|
||
version: 2 | ||
updates: | ||
- package-ecosystem: "pip" # See documentation for possible values | ||
directory: "/" # Location of package manifests | ||
schedule: | ||
interval: "weekly" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
FROM python:3 | ||
|
||
RUN pip3 install --no-cache-dir --upgrade canvaslms && \ | ||
activate-global-python-argcomplete && \ | ||
register-python-argcomplete canvaslms > /etc/bash_completion.d/canvaslms.bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
VERSION+= latest | ||
|
||
.PHONY: all | ||
all: docker-image | ||
|
||
.PHONY: publish | ||
publish: docker-image | ||
for v in ${VERSION}; do docker push dbosk/canvaslms:$$v; done | ||
|
||
.PHONY: docker-image | ||
docker-image: | ||
docker pull python:3 | ||
docker build --no-cache -t canvaslms . | ||
for v in ${VERSION}; do docker tag canvaslms dbosk/canvaslms:$$v; done | ||
|
||
.PHONY: clean | ||
clean: | ||
true | ||
|
||
.PHONY: distclean | ||
distclean: | ||
-docker image rm -f canvaslms dbosk/canvaslms |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import canvasapi | ||
import json | ||
import os | ||
|
||
canvas = canvasapi.Canvas(os.environ["CANVAS_SERVER"], | ||
os.environ["CANVAS_TOKEN"]) | ||
|
||
test_course = None | ||
|
||
for course in canvas.get_courses(): | ||
if course.name == "prgm23": | ||
test_course = course | ||
break | ||
|
||
test_quiz = None | ||
|
||
for quiz in course.get_assignments(): | ||
if quiz.name == "Exempelprov": | ||
test_quiz = quiz | ||
break | ||
else: | ||
raise ValueError("No quiz found") | ||
|
||
test_submission = None | ||
|
||
# There is only one in my setup | ||
for quiz_submission in test_quiz.get_submissions(): | ||
if quiz_submission.submitted_at is not None: | ||
test_submission = quiz_submission | ||
break | ||
|
||
print("\n# Quiz submission questions\n") | ||
|
||
for subm_question in test_submission.get_submission_questions(): | ||
#print(subm_question.__dict__.keys()) | ||
#print(subm_question) | ||
print(f"{subm_question.id} " | ||
f"{subm_question.question_name}:\n" | ||
f"{subm_question.question_text}") | ||
try: | ||
print(f"Alternatives: {subm_question.answers}") | ||
print(f"Correct: {subm_question.correct}") | ||
except AttributeError: | ||
pass | ||
|
||
print() | ||
|
||
print("\n# Quiz submission answers\n") | ||
|
||
quiz = None | ||
|
||
for assignment in test_course.get_assignments(): | ||
if assignment.name == "Exempelprov": | ||
quiz = assignment | ||
break | ||
|
||
for submission in quiz.get_submissions(include=["submission_history"]): | ||
for subm in submission.submission_history: | ||
#print(subm) | ||
try: | ||
for data in subm["submission_data"]: | ||
print(json.dumps(data, indent=2)) | ||
except KeyError: | ||
pass | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import canvasapi | ||
import json | ||
import os | ||
|
||
canvas = canvasapi.Canvas(os.environ["CANVAS_SERVER"], | ||
os.environ["CANVAS_TOKEN"]) | ||
|
||
test_course = None | ||
|
||
for course in canvas.get_courses(): | ||
if course.name == "Sandbox dbosk": | ||
test_course = course | ||
break | ||
|
||
test_quiz = None | ||
|
||
for quiz in course.get_quizzes(): | ||
if quiz.title == "Classic datorprov": | ||
test_quiz = quiz | ||
break | ||
|
||
test_submission = None | ||
|
||
# There is only one in my setup | ||
for quiz_submission in test_quiz.get_submissions(): | ||
test_submission = quiz_submission | ||
|
||
print("\n# Quiz submission questions\n") | ||
|
||
for subm_question in test_submission.get_submission_questions(): | ||
#print(subm_question.__dict__.keys()) | ||
#print(subm_question) | ||
print(f"{subm_question.id} " | ||
f"{subm_question.question_name}:\n" | ||
f"{subm_question.question_text}") | ||
try: | ||
print(f"Alternatives: {subm_question.answers}") | ||
print(f"Correct: {subm_question.correct}") | ||
except AttributeError: | ||
pass | ||
|
||
print() | ||
|
||
print("\n# Quiz submission answers\n") | ||
|
||
quiz = None | ||
|
||
for assignment in test_course.get_assignments(): | ||
if assignment.name == "Classic datorprov": | ||
quiz = assignment | ||
break | ||
|
||
for submission in quiz.get_submissions(include=["submission_history"]): | ||
for subm in submission.submission_history: | ||
#print(subm) | ||
try: | ||
for data in subm["submission_data"]: | ||
print(json.dumps(data, indent=2)) | ||
except KeyError: | ||
pass | ||
|
Oops, something went wrong.