Fixed issues with assignment progress tracking + added subject progress tracking

This commit is contained in:
Teodor
2026-04-23 04:37:34 +02:00
parent a35353f45b
commit 9f214a9451
9 changed files with 205 additions and 14 deletions

View File

@@ -1,4 +1,5 @@
import { defaultStyles } from '@/constants/defaultStyles';
import { CheckAssignmentCompletion } from '@/lib/progress';
import { supabase } from '@/lib/supabase';
import type { Task } from '@/lib/types';
import { Ionicons } from '@expo/vector-icons';
@@ -63,7 +64,7 @@ export default function Tasks() {
}, [session])
);
const DeleteTask = async (tId: string) => {
const DeleteTask = async (tId: string, aId: string) => {
Alert.alert(
'Delete Task',
'Are you sure you want to delete this task?',
@@ -87,6 +88,13 @@ export default function Tasks() {
}
Alert.alert('Task deleted successfully!');
try {
await CheckAssignmentCompletion(aId);
} catch {
Alert.alert("Failed to update assignment completion state");
}
GetTasks();
},
},
@@ -237,7 +245,7 @@ export default function Tasks() {
<Pressable
className="flex-1 items-center justify-center rounded-2xl border border-app-border bg-app-surface py-3"
onPress={() => DeleteTask(item.tId)}
onPress={() => DeleteTask(item.tId, item.aId)}
>
<Text className="text-sm font-bold text-status-danger">
Delete