Convert task priority to enum so it is now sortable
This commit is contained in:
@@ -36,7 +36,7 @@ export class LazyTask implements Task {
|
|||||||
.map(x => x.value);
|
.map(x => x.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
get priority(): TaskPriority {
|
get priorityStr(): string {
|
||||||
const priority = this.#parsed.meta.find(x => x.feature === 'priority')?.priority;
|
const priority = this.#parsed.meta.find(x => x.feature === 'priority')?.priority;
|
||||||
|
|
||||||
if(!priority) {
|
if(!priority) {
|
||||||
@@ -49,6 +49,22 @@ export class LazyTask implements Task {
|
|||||||
'🔼': 'medium',
|
'🔼': 'medium',
|
||||||
'⏫': 'high',
|
'⏫': 'high',
|
||||||
'🔺': 'highest'
|
'🔺': 'highest'
|
||||||
|
}[priority];
|
||||||
|
}
|
||||||
|
|
||||||
|
get priority(): TaskPriority {
|
||||||
|
const priority = this.#parsed.meta.find(x => x.feature === 'priority')?.priority;
|
||||||
|
|
||||||
|
if(!priority) {
|
||||||
|
return TaskPriority.NORMAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
'⏬': TaskPriority.LOWEST,
|
||||||
|
'🔽': TaskPriority.LOW,
|
||||||
|
'🔼': TaskPriority.MEDIUM,
|
||||||
|
'⏫': TaskPriority.HIGH,
|
||||||
|
'🔺': TaskPriority.HIGHEST
|
||||||
}[priority] as TaskPriority;
|
}[priority] as TaskPriority;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -110,7 +126,7 @@ export class LazyTask implements Task {
|
|||||||
const o = (name: string, value?: string) => value && value.length > 0 ? `${name}=${value}` : "";
|
const o = (name: string, value?: string) => value && value.length > 0 ? `${name}=${value}` : "";
|
||||||
|
|
||||||
const items = [
|
const items = [
|
||||||
o("priority", this.priority),
|
o("priority", this.priorityStr),
|
||||||
o("created", this.createdDate?.format("YYYY-MM-DD")),
|
o("created", this.createdDate?.format("YYYY-MM-DD")),
|
||||||
o("start", this.startDate?.format("YYYY-MM-DD")),
|
o("start", this.startDate?.format("YYYY-MM-DD")),
|
||||||
o("scheduled", this.scheduledDate?.format("YYYY-MM-DD")),
|
o("scheduled", this.scheduledDate?.format("YYYY-MM-DD")),
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ export type Task = {
|
|||||||
fullLabel: string;
|
fullLabel: string;
|
||||||
tags: string[];
|
tags: string[];
|
||||||
priority: TaskPriority;
|
priority: TaskPriority;
|
||||||
|
priorityStr: string;
|
||||||
createdDate?: Dayjs;
|
createdDate?: Dayjs;
|
||||||
startDate?: Dayjs;
|
startDate?: Dayjs;
|
||||||
scheduledDate?: Dayjs;
|
scheduledDate?: Dayjs;
|
||||||
@@ -19,10 +20,11 @@ export type Task = {
|
|||||||
reminder?: string;
|
reminder?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type TaskPriority =
|
export enum TaskPriority {
|
||||||
| 'lowest'
|
LOWEST,
|
||||||
| 'low'
|
LOW,
|
||||||
| 'normal'
|
NORMAL,
|
||||||
| 'medium'
|
MEDIUM,
|
||||||
| 'high'
|
HIGH,
|
||||||
| 'highest';
|
HIGHEST,
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user