Elixir and Elm learning log. Reading "Elixir and Elm tutorial book" part 2.
Tags: elixir, elm, book
Published: 2019-02-20 19:13:29

---
title: Elixir and Elm learning log. Reading "Elixir and Elm tutorial book" part 2.
published: true
description: 
tags: elixir, elm, book
---

2019, 4th February
22:22

When I returned back to the book I haven't started writing the log right away.

[debug] QUERY OK source="players" db=0.4ms
SELECT p0."id", p0."display_name", p0."password_digest", p0."score", p0."username", p0."inserted_at", p0."updated_at" FROM "players" AS p0 WHERE (p0."id" = $1) [5] 
[debug] Processing with PlatformWeb.PageController.index/2
  Parameters: %{}
  Pipelines: [:browser]
[info] Sent 200 in 1ms
[info] GET /api/players
[debug] Processing with PlatformWeb.PlayerApiController.index/2
  Parameters: %{}
  Pipelines: [:api]
[debug] QUERY OK source="players" db=0.4ms queue=0.1ms
SELECT p0."id", p0."display_name", p0."password_digest", p0."score", p0."username", p0."inserted_at", p0."updated_at" FROM "players" AS p0 []
[info] Sent 200 in 1ms
[info] GET /api/games
[debug] Processing with PlatformWeb.GameController.index/2
  Parameters: %{}
  Pipelines: [:api]
[debug] QUERY OK source="games" db=1.0ms
SELECT g0."id", g0."description", g0."featured", g0."thumbnail", g0."title", g0."inserted_at", g0."updated_at" FROM "games" AS g0 []
[info] Sent 200 in 1ms
 
I kinda finished a couple chapters and I am on the chapter ELM and API data and I want to fetch the players list. I can fetch the games list, it works fine. I can't fetch players list even though I don't have any raised exceptions.

Everything seemed to work fine, when in fact only the half works fine.

Bijan told me in email, when I asked him, a debugging technique. And here is the message that I got in the console:

Error fetching players from APIBadBody "Problem with the value at json.data[0].score:\n\n null\n\nExpecting an INT": ({ gamesList = [], playersList = [] },<internals>)

As you cane see the score has a null value.

************************************

On to the next chapter "Design and Usability".


mix phx.routes
allows you to see the list of all routes in your app.

9th February
12:31 Finished the chapter "Design and Usability"

******************************

10th February
14:54 Finished the chapter "Game setup"

Didn't have any issues at all. Was a smooth ride.

*******************************

11th February
11:35 Just finished the "Our First Game" chapter.

I just had one idea in my mind. In this game we will have only one coin at a time. How can I set the game up for multiple coins at the same time?

********************************

14:25
Just finished the "Adding Interaction" chapter.
That was fun.

page 244
little typo: think think

16:30 Finished the "Handling Game States" chapter.

12 February.
00:30 Finished the handling state chapter.

So far, the feedback that I get from Elm is super staight forward.

**********************

12 February
09:57 Starting to read "Phoenix Channels and Elm Ports"

There will likely be a time in the near future where packages make it simple for developers to
integrate the two languages with a straightforward API, but currently it can be a tedious process to
connect things properly.
The good news is that this knowledge is valuable, because any non-trivial Elm application is likely
going to need to work with JavaScript code and knowing how to use ports is essential.

I like the reassuring tone of the book.

***

Isn't this awesome?

We’re going to use Phoenix channels for a similar purpose. We’re going to take the playerScore
field that we’re tracking in our Elm application, and we’re going to broadcast that value to other
users so all players can see scores for a particular game being tracked in real-time. We’ll also take a
look at how to store the scores as records in our database using the gameplays table we configured
earlier in the book

***

page 282 typo: "we us that to assign"
page 303 typo: "Note taht"

***************

13 February
18:51 Finished "Saving Score Data"

One last chapter to go.