mirror of
https://github.com/urosran/cally.git
synced 2025-07-15 01:35:22 +00:00
- Added Daily repeat type for the todos and implemented creating and updating this kinds of todos
This commit is contained in:
@ -40,7 +40,19 @@ export const useCreateTodo = () => {
|
||||
|
||||
const batch = firestore().batch();
|
||||
|
||||
if (todoData.repeatType === REPEAT_TYPE.EVERY_WEEK) {
|
||||
if (todoData.repeatType === REPEAT_TYPE.DAILY) {
|
||||
// for the next 52 weeks
|
||||
for (let i = 1; i < 52; i++) {
|
||||
let date = originalTodo.date;
|
||||
const nextWeek = addWeeks(date, i);
|
||||
|
||||
let docRef = firestore().collection("Todos").doc();
|
||||
let newTodo = { ...originalTodo, id: docRef.id, date: nextWeek, connectedTodoId: newDoc.id };
|
||||
newTodo = resolveTodoAlternatingAssignees(todoData, newTodo, i);
|
||||
|
||||
batch.set(docRef, newTodo);
|
||||
}
|
||||
} else if (todoData.repeatType === REPEAT_TYPE.EVERY_WEEK) {
|
||||
|
||||
let date = originalTodo.date;
|
||||
let repeatDays = originalTodo.repeatDays;
|
||||
|
Reference in New Issue
Block a user