diff options
Diffstat (limited to 'contents/ui/main.qml')
-rw-r--r-- | contents/ui/main.qml | 33 |
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) }) }) }) |