Skip to content

Instantly share code, notes, and snippets.

Created June 19, 2021 10:03
What would you like to do?
class TaskChecker(
seamToAssigner: ((Task) -> Unit)? = null
) {
private val safeSendTaskToAssigner: (Task) -> Unit = seamToAssigner ?: ::sendTaskToAssigner
fun check(task: Task): CheckResult {
if (isNotCreatedInCurrentWeek(task)) return Invalid
if (isResolved(task)) return Invalid
if (isNotAssigned(task)) return Invalid
return Valid
private fun isNotAssigned(task: Task): Boolean {
if (task.assignedTo != Nobody) return false
return true
private fun sendTaskToAssigner(task: Task) {
val connection = Connection()
val assigner = TaskAssigner(connection)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment