From fc8711d6d841d11847cd8567999373145ce3398d Mon Sep 17 00:00:00 2001 From: kolaente Date: Thu, 16 Mar 2023 19:24:54 +0100 Subject: [PATCH] fix: rename list to project for parsing subtasks via indention --- src/helpers/parseSubtasksViaIndention.test.ts | 6 +++--- src/helpers/parseSubtasksViaIndention.ts | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/helpers/parseSubtasksViaIndention.test.ts b/src/helpers/parseSubtasksViaIndention.test.ts index f4903661a4..d50c8bb2aa 100644 --- a/src/helpers/parseSubtasksViaIndention.test.ts +++ b/src/helpers/parseSubtasksViaIndention.test.ts @@ -113,8 +113,8 @@ task two`) sub task 2`) expect(tasks).to.have.length(3) - expect(tasks[0].list).to.eq('list') - expect(tasks[1].list).to.eq('list') - expect(tasks[2].list).to.eq('list') + expect(tasks[0].project).to.eq('list') + expect(tasks[1].project).to.eq('list') + expect(tasks[2].project).to.eq('list') }) }) diff --git a/src/helpers/parseSubtasksViaIndention.ts b/src/helpers/parseSubtasksViaIndention.ts index ed3c7dad9e..7e76bda0ce 100644 --- a/src/helpers/parseSubtasksViaIndention.ts +++ b/src/helpers/parseSubtasksViaIndention.ts @@ -3,7 +3,7 @@ import {getProjectFromPrefix} from '@/modules/parseTaskText' export interface TaskWithParent { title: string, parent: string | null, - list: string | null, + project: string | null, } function cleanupTitle(title: string) { @@ -23,10 +23,10 @@ export function parseSubtasksViaIndention(taskTitles: string): TaskWithParent[] const task: TaskWithParent = { title: cleanupTitle(title), parent: null, - list: null, + project: null, } - task.list = getProjectFromPrefix(task.title) + task.project = getProjectFromPrefix(task.title) if (index === 0) { return task @@ -47,9 +47,9 @@ export function parseSubtasksViaIndention(taskTitles: string): TaskWithParent[] } while (parentSpaces >= matchedSpaces) task.title = cleanupTitle(title.replace(spaceRegex, '')) task.parent = task.parent.replace(spaceRegex, '') - if (task.list === null) { + if (task.project === null) { // This allows to specify a list once for the parent task and inherit it to all subtasks - task.list = getProjectFromPrefix(task.parent) + task.project = getProjectFromPrefix(task.parent) } }