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