guesstimate/src/models/task.ts

37 lines
817 B
TypeScript
Raw Normal View History

2020-04-20 11:14:46 +02:00
import { uuidV4 } from "../util/uuid"
export type TaskID = string
export enum EstimationConfidence {
Optimistic = "optimistic",
Likely = "likely",
Pessimistic = "pessimistic"
}
export interface Task {
id: TaskID
label: string
2020-04-21 20:45:47 +02:00
category: TaskCategoryID
2020-04-20 11:14:46 +02:00
estimations: { [confidence in EstimationConfidence]: number }
}
2020-04-21 20:45:47 +02:00
export type TaskCategoryID = string
2020-04-20 11:14:46 +02:00
export interface TaskCategory {
2020-04-21 20:45:47 +02:00
id: TaskCategoryID
2020-04-20 11:14:46 +02:00
label: string
costPerTimeUnit: number
2020-04-20 11:14:46 +02:00
}
2020-04-21 20:45:47 +02:00
export function newTask(label: string, category: TaskCategoryID): Task {
2020-04-20 11:14:46 +02:00
return {
id: uuidV4(),
label,
category,
estimations: {
[EstimationConfidence.Optimistic]: 0,
[EstimationConfidence.Likely]: 0,
[EstimationConfidence.Pessimistic]: 0,
}
};
}