summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederick Yin <fkfd@fkfd.me>2023-07-24 18:06:30 +0800
committerFrederick Yin <fkfd@fkfd.me>2023-07-24 18:06:30 +0800
commit18ab43a7a3cbc0abd785c0ba3c9a47215d5d3ba0 (patch)
treeee480a7c226f2748ed7feb9b98d147e09f65cf9f
parentfdbe718c127242d4b524ec15b87c9fd3c6f13593 (diff)
Attempt to display assignments in list order, but it's more complicated
-rw-r--r--contents/ui/main.qml33
1 files changed, 28 insertions, 5 deletions
diff --git a/contents/ui/main.qml b/contents/ui/main.qml
index e685044..6f14c65 100644
--- a/contents/ui/main.qml
+++ b/contents/ui/main.qml
@@ -78,6 +78,13 @@ Item {
normal: 0,
finished: 0,
}
+ let announcementLock = false
+ let assignmentIndices = {
+ important: 0,
+ normal: 0,
+ finished: 0,
+ }
+ let assignmentLock = false
for (let course of courses) {
const courseIdx = courseIndices[course.id]
@@ -139,13 +146,29 @@ Item {
finished: plasmoid.configuration.finishedAssignments.includes(assignment.id.toString()),
}
- if (!info.submitted || showSubmittedAssignments) {
- if (info.important) {
- assignmentsModel.insert(importantCount.assignments++, info)
- } else {
- assignmentsModel.append(info)
+ let idx = 0;
+ let endIdx = 0;
+ if (info.important) {
+ idx = assignmentIndices.important
+ endIdx = assignmentIndices.normal
+ assignmentIndices.normal++
+ assignmentIndices.finished++
+ } else if (!info.finished) {
+ idx = assignmentIndices.normal
+ endIdx = assignmentIndices.finished
+ assignmentIndices.finished++
+ } else {
+ idx = assignmentIndices.normal
+ endIdx = assignmentsModel.count
+ }
+
+ for (; idx < endIdx; idx++) {
+ const annc = assignmentsModel.get(idx)
+ if (courseIndices[course.id] < courseIndices[annc.courseId]) {
+ break
}
}
+ assignmentsModel.insert(idx, info)
})
})
})