I hereby claim:
- I am noelworden on github.
- I am noelworden (https://keybase.io/noelworden) on keybase.
- I have a public key ASDfPA7xVsNbGyYBF0WfDVqhpxVqKtPdJku9SmEFni_gTQo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
require IEx; IEx.pry()
Exit pry
session inside an IEx
session
respawn
pry
in test suite
iex -S mix test --trace
Official docs
Debugging in views, tests, etc
Mapping.create_destination() |
docker-compose web mix run priv/repo/seeds.exs |
Atlas.Mapping.CSVUtil.csv_row_to_table_record("priv/repo/data/destinations.csv") |
defmodule Atlas.Mapping.CSVUtil do | |
@moduledoc """ | |
Utility module to ingest `destination.csv` | |
""" | |
alias NimbleCSV.RFC4180, as: CSV | |
alias Atlas.{Mapping, Mapping.Destination, Repo} | |
def csv_row_to_table_record(file) do | |
column_names = get_column_names(file) |
row["longitude"] |
defp create_or_skip(row) do | |
case Repo.get_by(Destination, | |
latitude: row["latitude"], | |
longitude: row["longitude"] | |
) do | |
nil -> | |
Mapping.create_destination(%{ | |
longitude: Decimal.new(row["longitude"]), | |
latitude: Decimal.new(row["latitude"]), | |
name: row["name"], |
|> create_or_skip() |
%{ | |
"allows_dogs" => "true", | |
"backpack_camp" => "true", | |
"car_camp" => "false", | |
"car_friendly" => "true", | |
"description" => "Rumors of big fish, probably early in season. ~ 2.5 hr hike. Latest notes: 20190909", | |
"dogs_off_leash" => "true", | |
"fee" => "false", | |
"greater_than_three_hours" => "false", | |
"hike_in" => "true", |