Preselect default task (#22)

This commit is contained in:
Manuel Bouza
2019-09-18 12:54:54 +02:00
committed by Tobias Miesel
parent 5e62e16751
commit 8a72f242f9
4 changed files with 95 additions and 47 deletions

View File

@@ -14,6 +14,7 @@ import {
findProjectByValue,
findProjectByIdentifier,
findTask,
defaultTask,
formatDate,
} from "utils"
import { parseISO } from "date-fns"
@@ -73,7 +74,7 @@ class App extends Component {
const { service, lastTaskId } = this.props
return (
findTask(this.changeset.task_id || service?.taskId || lastTaskId)(this.project) ||
head(this.project?.tasks)
defaultTask(this.project?.tasks)
)
}
@@ -121,7 +122,7 @@ class App extends Component {
if (name === "assignment_id") {
const project = findProjectByValue(value)(projects)
this.changeset.task_id = head(project?.tasks)?.value
this.changeset.task_id = defaultTask(project?.tasks)?.value
}
}