Skip to content

Instantly share code, notes, and snippets.

@le0nidas
Created June 19, 2021 09:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save le0nidas/6050eaef54b7f9ba0018a1e487c77aa5 to your computer and use it in GitHub Desktop.
Save le0nidas/6050eaef54b7f9ba0018a1e487c77aa5 to your computer and use it in GitHub Desktop.
class TaskChecker {
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
val connection = Connection()
val assigner = TaskAssigner(connection)
assigner.add(task)
return true
}
//...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment