-
Notifications
You must be signed in to change notification settings - Fork 86
Added field closed_at for Tasks and setup changeset accordingly #984
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added field closed_at for Tasks and setup changeset accordingly #984
Conversation
| @type t :: %__MODULE__{} | ||
|
|
||
| schema "tasks" do | ||
| field :closed_at, :utc_datetime |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I've seen utc_datetime before. Is this new in ecto?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The old :datetime field now shows deprecation warning on migration. We need to use either naive_datetime or utc_datetime.
| |> changeset(params) | ||
| |> cast(params, [:status]) | ||
| |> validate_inclusion(:status, statuses()) | ||
| |> set_closed_at() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand why you placed this in update but I do think since it's possible we'll need to write another issue to address this with GitHub sync. Can you open such an issue? We'd need to handle the closed event on GitHub and propagate that close to here. This could happen on create so I want to be sure we're not using the create changeset here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure raised an issue. But I am unaware of GithubSync feel free to edit the issue -#992
0889153 to
081f07e
Compare
081f07e to
14734c2
Compare
| test "only allows specific values for status" do | ||
| changes = Map.put(@valid_attrs, :status, "nonexistent") | ||
| changeset = Task.update_changeset(%Task{}, changes) | ||
| changeset = Task.update_changeset(%Task{task_list_id: 1}, changes) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not setting a task_list_id would refute the changeset anyway, making the test invalid
What's in this PR?
Also found a bug in a test case that I fixed
References
Fixes #979.