mirror of
https://github.com/urosran/cally.git
synced 2025-11-26 16:34:54 +00:00
- Added Daily repeat type for the todos and implemented creating and updating this kinds of todos
This commit is contained in:
@ -51,6 +51,18 @@ export const useUpdateTodo = () => {
|
||||
const newDoc = firestore().collection('Todos').doc();
|
||||
let originalTodo = {...todoData, id: newDoc.id, familyId: profileData?.familyId, creatorId: currentUser?.uid}
|
||||
batch.set(newDoc, originalTodo);
|
||||
} else if (todoData.repeatType === REPEAT_TYPE.DAILY) {
|
||||
console.log("DAILY");
|
||||
// for the next 52 weeks
|
||||
for (let i = 0; i < 52; i++) {
|
||||
let date = todoData?.date;
|
||||
const nextWeek = addWeeks(date, i);
|
||||
|
||||
let docRef = firestore().collection("Todos").doc();
|
||||
let newTodo = { ...todoData, id: docRef.id, date: nextWeek, connectedTodoId: firstTodo?.connectedTodoId };
|
||||
newTodo = resolveTodoAlternatingAssignees(todoData, newTodo, i);
|
||||
batch.set(docRef, newTodo);
|
||||
}
|
||||
} else if (todoData.repeatType === REPEAT_TYPE.EVERY_WEEK) {
|
||||
|
||||
console.log("EVERY WEEK");
|
||||
|
||||
Reference in New Issue
Block a user