fix: rename list to project for parsing subtasks via indention
continuous-integration/drone/push Build is passing Details

This commit is contained in:
kolaente 2023-03-16 19:24:54 +01:00
parent 03cef1f831
commit fc8711d6d8
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
2 changed files with 8 additions and 8 deletions

View File

@ -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')
})
})

View File

@ -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)
}
}