Skip to content
This repository has been archived by the owner on Jan 21, 2022. It is now read-only.

Commit

Permalink
Merge pull request #23 from alanvardy/add_credo
Browse files Browse the repository at this point in the history
bring back the secrets
  • Loading branch information
alanvardy committed May 24, 2019
2 parents 39bfc02 + 0330b6c commit eb54f17
Show file tree
Hide file tree
Showing 11 changed files with 36 additions and 13 deletions.
4 changes: 3 additions & 1 deletion .travis.yml
Expand Up @@ -11,10 +11,12 @@ services:

before_install:
- cp config/travis.exs config/test.exs
- cp config/travis.secret.exs config/dev.secret.exs

before_script:
- mix local.hex --force
- mix do ecto.create, ecto.migrate

script:
- mix test
- mix test
- mix credo
6 changes: 6 additions & 0 deletions config/travis.secret.exs
@@ -0,0 +1,6 @@
use Mix.Config

config :dash,
harvest_api_key:
"fake",
harvest_account_id: "fake"
3 changes: 2 additions & 1 deletion lib/dash/accounts.ex
Expand Up @@ -9,7 +9,8 @@ defmodule Dash.Accounts do
alias Dash.Accounts.User

def get_user_by_email(email) do
from(u in User, where: u.email == ^email)
User
|> where([u], u.email == ^email)
|> Repo.one()
end

Expand Down
3 changes: 3 additions & 0 deletions lib/dash/accounts/user.ex
@@ -1,4 +1,7 @@
defmodule Dash.Accounts.User do
@moduledoc """
Site user
"""
use Ecto.Schema
import Ecto.Changeset

Expand Down
3 changes: 3 additions & 0 deletions lib/dash/api.ex
@@ -1,4 +1,7 @@
defmodule DashWeb.Api do
@moduledoc """
Logic around APIs
"""
alias DashWeb.Api.Harvest
alias DashWeb.Api.Time

Expand Down
1 change: 0 additions & 1 deletion lib/dash/api/harvest.ex
Expand Up @@ -45,7 +45,6 @@ defmodule DashWeb.Api.Harvest do
@doc "cherry pick the report attributes we want"
def report_keys(projects) do
projects
|> IO.inspect(label: "48")
|> Enum.filter(fn b -> Map.get(b, "budget") end)
|> Enum.map(fn b ->
%{
Expand Down
2 changes: 1 addition & 1 deletion lib/dash/api/time.ex
Expand Up @@ -30,6 +30,6 @@ defmodule DashWeb.Api.Time do

@spec hours_per_day(Integer.t(), Integer.t(), Integer.t()) :: Float.t()
def hours_per_day(budget, hours, days_left) do
(budget - hours)/days_left
(budget - hours) / days_left
end
end
3 changes: 3 additions & 0 deletions lib/dash_web/controllers/auth.ex
@@ -1,4 +1,7 @@
defmodule DashWeb.Auth do
@moduledoc """
Handles user authorization
"""
import Plug.Conn

alias Dash.Accounts
Expand Down
3 changes: 2 additions & 1 deletion mix.exs
Expand Up @@ -56,7 +56,8 @@ defmodule Dash.MixProject do
{:timex, "~> 3.0"},
{:comeonin, "~> 5.1"},
{:pbkdf2_elixir, "~> 1.0"},
{:excoveralls, "~> 0.10", only: :test}
{:excoveralls, "~> 0.10", only: :test},
{:credo, "~> 1.0.0", only: [:dev, :test], runtime: false}
]
end

Expand Down
2 changes: 2 additions & 0 deletions mix.lock
@@ -1,10 +1,12 @@
%{
"bunt": {:hex, :bunt, "0.2.0", "951c6e801e8b1d2cbe58ebbd3e616a869061ddadcc4863d0a2182541acae9a38", [:mix], [], "hexpm"},
"certifi": {:hex, :certifi, "2.5.1", "867ce347f7c7d78563450a18a6a28a8090331e77fa02380b4a21962a65d36ee5", [:rebar3], [{:parse_trans, "~>3.3", [hex: :parse_trans, repo: "hexpm", optional: false]}], "hexpm"},
"combine": {:hex, :combine, "0.10.0", "eff8224eeb56498a2af13011d142c5e7997a80c8f5b97c499f84c841032e429f", [:mix], [], "hexpm"},
"comeonin": {:hex, :comeonin, "5.1.2", "fbbbbbfcf0f0e9900c0336d16c8d462edf838ba1759577e29cc5fbd7c28a4540", [:mix], [], "hexpm"},
"connection": {:hex, :connection, "1.0.4", "a1cae72211f0eef17705aaededacac3eb30e6625b04a6117c1b2db6ace7d5976", [:mix], [], "hexpm"},
"cowboy": {:hex, :cowboy, "2.6.3", "99aa50e94e685557cad82e704457336a453d4abcb77839ad22dbe71f311fcc06", [:rebar3], [{:cowlib, "~> 2.7.3", [hex: :cowlib, repo: "hexpm", optional: false]}, {:ranch, "~> 1.7.1", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm"},
"cowlib": {:hex, :cowlib, "2.7.3", "a7ffcd0917e6d50b4d5fb28e9e2085a0ceb3c97dea310505f7460ff5ed764ce9", [:rebar3], [], "hexpm"},
"credo": {:hex, :credo, "1.0.5", "fdea745579f8845315fe6a3b43e2f9f8866839cfbc8562bb72778e9fdaa94214", [:mix], [{:bunt, "~> 0.2.0", [hex: :bunt, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm"},
"db_connection": {:hex, :db_connection, "2.0.6", "bde2f85d047969c5b5800cb8f4b3ed6316c8cb11487afedac4aa5f93fd39abfa", [:mix], [{:connection, "~> 1.0.2", [hex: :connection, repo: "hexpm", optional: false]}], "hexpm"},
"decimal": {:hex, :decimal, "1.7.0", "30d6b52c88541f9a66637359ddf85016df9eb266170d53105f02e4a67e00c5aa", [:mix], [], "hexpm"},
"ecto": {:hex, :ecto, "3.1.4", "69d852da7a9f04ede725855a35ede48d158ca11a404fe94f8b2fb3b2162cd3c9", [:mix], [{:decimal, "~> 1.6", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}], "hexpm"},
Expand Down
19 changes: 11 additions & 8 deletions test/support/fake_data.ex
@@ -1,13 +1,16 @@
defmodule Dash.FakeData do
@moduledoc """
Fake API data for development testing and Travis CI
"""
def time_entries() do
[
%{hours: 1.25, project_id: 12345, spent_date: "2019-05-22"},
%{hours: 1.04, project_id: 12345, spent_date: "2019-05-22"},
%{hours: 0.23, project_id: 12345, spent_date: "2019-05-22"},
%{hours: 2.05, project_id: 4567, spent_date: "2019-05-22"},
%{hours: 0.38, project_id: 12345, spent_date: "2019-05-21"},
%{hours: 3.37, project_id: 12345, spent_date: "2019-05-21"},
%{hours: 1.12, project_id: 6789, spent_date: "2019-05-21"}
%{hours: 1.25, project_id: 12_345, spent_date: "2019-05-22"},
%{hours: 1.04, project_id: 12_345, spent_date: "2019-05-22"},
%{hours: 0.23, project_id: 12_345, spent_date: "2019-05-22"},
%{hours: 2.05, project_id: 4_567, spent_date: "2019-05-22"},
%{hours: 0.38, project_id: 12_345, spent_date: "2019-05-21"},
%{hours: 3.37, project_id: 12_345, spent_date: "2019-05-21"},
%{hours: 1.12, project_id: 6_789, spent_date: "2019-05-21"}
]
end

Expand All @@ -18,7 +21,7 @@ defmodule Dash.FakeData do
client: "Company 1",
fee: 2000,
hours: 30,
id: 12345
id: 12_345
},
%{
budget: 120,
Expand Down

0 comments on commit eb54f17

Please sign in to comment.