feat: remove auto updating of likely/pessimistic values

This commit is contained in:
wpetit 2023-08-31 20:33:59 -06:00
parent 53cc3a25d8
commit 18f43482e0
2 changed files with 175 additions and 175 deletions

View File

@ -124,14 +124,6 @@ export function handleUpdateTaskEstimation(project: Project, action: UpdateTaskE
[action.confidence]: action.value [action.confidence]: action.value
}; };
if (estimations.likely < estimations.optimistic) {
estimations.likely = estimations.optimistic;
}
if (estimations.pessimistic < estimations.likely) {
estimations.pessimistic = estimations.likely;
}
return { return {
...project, ...project,
tasks: { tasks: {

View File

@ -20,8 +20,8 @@ export type EstimationTotals = { [confidence in EstimationConfidence]: number }
const TaskTable: FunctionComponent<TaskTableProps> = ({ project, onTaskAdd, onEstimationChange, onTaskRemove, onTaskLabelUpdate }) => { const TaskTable: FunctionComponent<TaskTableProps> = ({ project, onTaskAdd, onEstimationChange, onTaskRemove, onTaskLabelUpdate }) => {
const defaultTaskCategory = Object.keys(project.params.taskCategories)[0]; const defaultTaskCategory = Object.keys(project.params.taskCategories)[0];
const [ task, setTask ] = useState(newTask("", defaultTaskCategory)); const [task, setTask] = useState(newTask("", defaultTaskCategory));
const [ totals, setTotals ] = useState({ const [totals, setTotals] = useState({
[EstimationConfidence.Optimistic]: 0, [EstimationConfidence.Optimistic]: 0,
[EstimationConfidence.Likely]: 0, [EstimationConfidence.Likely]: 0,
[EstimationConfidence.Pessimistic]: 0, [EstimationConfidence.Pessimistic]: 0,
@ -45,12 +45,12 @@ const TaskTable: FunctionComponent<TaskTableProps> = ({ project, onTaskAdd, onEs
const onNewTaskLabelChange = (evt: ChangeEvent) => { const onNewTaskLabelChange = (evt: ChangeEvent) => {
const value = (evt.currentTarget as HTMLInputElement).value; const value = (evt.currentTarget as HTMLInputElement).value;
setTask({...task, label: value}); setTask({ ...task, label: value });
}; };
const onNewTaskCategoryChange = (evt: ChangeEvent) => { const onNewTaskCategoryChange = (evt: ChangeEvent) => {
const value = (evt.currentTarget as HTMLInputElement).value; const value = (evt.currentTarget as HTMLInputElement).value;
setTask({...task, category: value}); setTask({ ...task, category: value });
}; };
const onTaskLabelChange = (taskId: TaskID, value: string) => { const onTaskLabelChange = (taskId: TaskID, value: string) => {
@ -112,12 +112,14 @@ const TaskTable: FunctionComponent<TaskTableProps> = ({ project, onTaskAdd, onEs
onChange={onTaskLabelChange.bind(null, t.id)} onChange={onTaskLabelChange.bind(null, t.id)}
value={t.label} /> value={t.label} />
</td> </td>
<td>{ categoryLabel }</td> <td>{categoryLabel}</td>
<td> <td>
{ {
isPrint ? isPrint ?
<span>{t.estimations.optimistic}</span> : <span>{t.estimations.optimistic}</span> :
<input className="input" type="number" value={t.estimations.optimistic} <input
className="input" type="number"
value={t.estimations.optimistic}
min={0} min={0}
onChange={onOptimisticChange.bind(null, t.id)} /> onChange={onOptimisticChange.bind(null, t.id)} />
} }
@ -126,7 +128,10 @@ const TaskTable: FunctionComponent<TaskTableProps> = ({ project, onTaskAdd, onEs
{ {
isPrint ? isPrint ?
<span>{t.estimations.likely}</span> : <span>{t.estimations.likely}</span> :
<input className="input" type="number" value={t.estimations.likely} <input
className={`input ${t.estimations.likely < t.estimations.optimistic ? 'is-danger' : ''}`}
type="number"
value={t.estimations.likely}
min={0} min={0}
onChange={onLikelyChange.bind(null, t.id)} /> onChange={onLikelyChange.bind(null, t.id)} />
} }
@ -135,7 +140,10 @@ const TaskTable: FunctionComponent<TaskTableProps> = ({ project, onTaskAdd, onEs
{ {
isPrint ? isPrint ?
<span>{t.estimations.pessimistic}</span> : <span>{t.estimations.pessimistic}</span> :
<input className="input" type="number" value={t.estimations.pessimistic} <input
className={`input ${t.estimations.pessimistic < t.estimations.likely ? 'is-danger' : ''}`}
type="number"
value={t.estimations.pessimistic}
min={0} min={0}
onChange={onPessimisticChange.bind(null, t.id)} /> onChange={onPessimisticChange.bind(null, t.id)} />
} }