Bladeren bron

Show only upcoming Classroom to-dos.

Filter fetched to-dos to exclude past-due and undated items so the schedule surfaces only upcoming work.

Made-with: Cursor
huzaifahayat12 4 uur geleden
bovenliggende
commit
d9880a8621
1 gewijzigde bestanden met toevoegingen van 7 en 1 verwijderingen
  1. 7 1
      classroom_app/Google/GoogleClassroomClient.swift

+ 7 - 1
classroom_app/Google/GoogleClassroomClient.swift

@@ -56,7 +56,13 @@ final class GoogleClassroomClient {
56 56
             }
57 57
         }
58 58
 
59
-        // Keep only items with a due date near-term first; undated items at end.
59
+        let now = Date()
60
+        todos = todos.filter {
61
+            guard let due = $0.dueDate else { return false }
62
+            return due >= now
63
+        }
64
+
65
+        // Keep upcoming items sorted by nearest due date first.
60 66
         todos.sort {
61 67
             switch ($0.dueDate, $1.dueDate) {
62 68
             case let (a?, b?):