summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederick Yin <fkfd@fkfd.me>2023-07-24 18:12:09 +0800
committerFrederick Yin <fkfd@fkfd.me>2023-07-24 18:12:09 +0800
commit3a3ab63895eb889a36d36e50d0f3f7f98e43ee23 (patch)
tree31e2f241c016aa75c6c19966b7f77b1f43753546
parent18ab43a7a3cbc0abd785c0ba3c9a47215d5d3ba0 (diff)
Show submitted assignments only if configured to
-rw-r--r--contents/ui/main.qml6
1 files changed, 5 insertions, 1 deletions
diff --git a/contents/ui/main.qml b/contents/ui/main.qml
index 6f14c65..ad62fd1 100644
--- a/contents/ui/main.qml
+++ b/contents/ui/main.qml
@@ -133,6 +133,10 @@ Item {
callApi(`/courses/${course.id}/assignments`, 50, assignments => {
assignments.forEach(assignment => {
callApi(`/courses/${course.id}/assignments/${assignment.id}/submissions/${userId}`, 0, submission => {
+ const submitted = submission.workflow_state == "submitted" ||
+ submission.workflow_state == "graded"
+ if (submitted && !showSubmittedAssignments) return // discard this
+
const info = {
type: "assignment",
activityId: assignment.id,
@@ -140,7 +144,7 @@ Item {
course: course.code,
title: assignment.name,
dueAt: assignment.due_at || "", // if null, use empty string to suppress errors
- submitted: submission.workflow_state != "unsubmitted", // "graded" counts as submitted
+ submitted: submitted,
url: assignment.html_url,
important: plasmoid.configuration.importantAssignments.includes(assignment.id.toString()),
finished: plasmoid.configuration.finishedAssignments.includes(assignment.id.toString()),