-
Notifications
You must be signed in to change notification settings - Fork 14
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
PR: Create Todo List in Phoenix v1.5.3 #35
Conversation
I have proof read the |
52 pages ... 💭 |
Test coverage increased in next PR: #39 (comment) |
Co-authored-by: Simon <[email protected]>
Co-authored-by: Simon <[email protected]>
Co-authored-by: Simon <[email protected]>
|
||
# returns integer value of items where item.status == 0 (not "done") | ||
def remaining_items(items) do | ||
Enum.filter(items, fn i -> i.status < 1 end) |> Enum.count() |
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 don't think we need the Enum.filter
here as we can use the anonymous function directly in count:
Enum.filter(items, fn i -> i.status < 1 end) |> Enum.count() | |
Enum.count(items, fn i -> i.status < 1 end) |
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.
@SimonLab this is a good improvement/simplification provided we explain that Enum.count/2
can take a "filter" function as it's second param. Otherwise I would leave it as is and let a member of the community suggest the refactor. 👍
Co-authored-by: Simon <[email protected]>
Co-authored-by: Simon <[email protected]>
Co-authored-by: Simon <[email protected]>
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.
LGTM 👍
Thanks @SimonLab 🙌 |
[I think] somebody should have written a beginner friendly Phoenix Todo List Tutorial a long time ago ... a todo list is a gentle introduction to basic "CRUD" apps with a familiar UX. 💭
This PR is a Phoenix implementation of https://github.com/dwyl/javascript-todo-list-tutorial ✅
Many people have found our Phoenix Chat Tutorial useful I expect the same here. 🚀
My reasoning for investing so much time into building a Phoenix (Server Side Rendered) version of the TodoMVC from first principals is that it's an intro to how our App works! 📱