From b2a0d688bb619aed42a8dafd4e43ec18cd0b6491 Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Sat, 21 Nov 2020 18:08:29 -0700 Subject: [PATCH] trim whitespace (#55) --- lib/planner/tasks/plan.ex | 1 + lib/planner/tasks/task.ex | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/planner/tasks/plan.ex b/lib/planner/tasks/plan.ex index 77cd977..f78a8db 100644 --- a/lib/planner/tasks/plan.ex +++ b/lib/planner/tasks/plan.ex @@ -18,6 +18,7 @@ defmodule Planner.Tasks.Plan do plan |> cast(attrs, [:description, :finished_at, :start, :end, :name]) |> validate_required([:name]) + |> update_change(:name, &String.trim/1) end def finish_plan(plan) do diff --git a/lib/planner/tasks/task.ex b/lib/planner/tasks/task.ex index ffb3f23..89dd6e0 100644 --- a/lib/planner/tasks/task.ex +++ b/lib/planner/tasks/task.ex @@ -18,7 +18,7 @@ defmodule Planner.Tasks.Task do task |> cast(attrs, [:value, :finished_at, :due_at]) |> validate_required([:value]) - |> validate_length(:value, min: 3) + |> update_change(:value, &String.trim/1) end def finish_task(task) do