Skip to content

Commit

Permalink
Merge pull request #987 from code-corps/fix-warnings
Browse files Browse the repository at this point in the history
Fix a number of warnings and change log levels
  • Loading branch information
joshsmith committed Sep 27, 2017
2 parents 523f93d + 2d5357d commit 327cddd
Show file tree
Hide file tree
Showing 10 changed files with 44 additions and 46 deletions.
4 changes: 2 additions & 2 deletions lib/code_corps/comment/service.ex
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ defmodule CodeCorps.Comment.Service do
defp marshall_result({:ok, %{github: %Comment{} = comment}}), do: {:ok, comment}
defp marshall_result({:error, :comment, %Changeset{} = changeset, _steps}), do: {:error, changeset}
defp marshall_result({:error, :github, result, _steps}) do
Logger.warn "An error occurred when creating/updating the comment with the GitHub API"
Logger.warn "#{inspect result}"
Logger.info "An error occurred when creating/updating the comment with the GitHub API"
Logger.info "#{inspect result}"
{:error, :github}
end

Expand Down
34 changes: 18 additions & 16 deletions lib/code_corps/github/comment/comment.ex
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@ defmodule CodeCorps.GitHub.Comment do
alias CodeCorps.{Comment, GitHub, GithubAppInstallation, GithubRepo, Task, User}

@spec create(Comment.t) :: GitHub.response
def create(%Comment{
task: %Task{
github_repo: %GithubRepo{
github_app_installation: %GithubAppInstallation{} = installation
}
} = task,
user:
%User{} = user} = comment) do
def create(
%Comment{
task: %Task{
github_repo: %GithubRepo{
github_app_installation: %GithubAppInstallation{} = installation
}
},
user: %User{} = user
} = comment) do

endpoint = comment |> create_endpoint_for()
attrs = comment |> GitHub.Adapters.Comment.to_github_comment
Expand All @@ -26,14 +27,15 @@ defmodule CodeCorps.GitHub.Comment do
end

@spec update(Comment.t) :: GitHub.response
def update(%Comment{
task: %Task{
github_repo: %GithubRepo{
github_app_installation: %GithubAppInstallation{} = installation
}
} = task,
user: %User{} = user,
github_id: id} = comment) do
def update(
%Comment{
task: %Task{
github_repo: %GithubRepo{
github_app_installation: %GithubAppInstallation{} = installation
}
},
user: %User{} = user
} = comment) do

endpoint = comment |> update_endpoint_for()
attrs = comment |> GitHub.Adapters.Comment.to_github_comment
Expand Down
4 changes: 2 additions & 2 deletions lib/code_corps/task/service.ex
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ defmodule CodeCorps.Task.Service do
defp marshall_result({:ok, %{github: %Task{} = task}}), do: {:ok, task}
defp marshall_result({:error, :task, %Changeset{} = changeset, _steps}), do: {:error, changeset}
defp marshall_result({:error, :github, result, _steps}) do
Logger.warn "An error occurred when creating/updating the task with the GitHub API"
Logger.warn "#{inspect result}"
Logger.info "An error occurred when creating/updating the task with the GitHub API"
Logger.info "#{inspect result}"
{:error, :github}
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ defmodule CodeCorps.Repo.Migrations.AddStripeCustomersCardsTables do

def change do
create table(:stripe_customers) do
add :created, :datetime
add :created, :utc_datetime
add :currency, :string
add :delinquent, :boolean
add :email, :string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ defmodule CodeCorps.Repo.Migrations.CreateStripePlansStripeSubscriptions do
def change do
create table(:stripe_plans) do
add :amount, :integer
add :created, :datetime
add :created, :utc_datetime
add :id_from_stripe, :string, null: false
add :name, :string

Expand All @@ -17,16 +17,16 @@ defmodule CodeCorps.Repo.Migrations.CreateStripePlansStripeSubscriptions do

create table(:stripe_subscriptions) do
add :application_fee_percent, :decimal
add :cancelled_at, :datetime
add :cancelled_at, :utc_datetime
add :customer_id_from_stripe, :string
add :created, :datetime
add :current_period_end, :datetime
add :current_period_start, :datetime
add :ended_at, :datetime
add :created, :utc_datetime
add :current_period_end, :utc_datetime
add :current_period_start, :utc_datetime
add :ended_at, :utc_datetime
add :id_from_stripe, :string, null: false
add :plan_id_from_stripe, :string, null: false
add :quantity, :integer
add :start, :datetime
add :start, :utc_datetime
add :status, :string

add :stripe_plan_id, references(:stripe_plans), null: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ defmodule CodeCorps.Repo.Migrations.CreateStripeFileUpload do

def change do
create table(:stripe_file_upload) do
add :created, :datetime
add :created, :utc_datetime
add :id_from_stripe, :string, null: false
add :purpose, :string
add :size, :integer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ defmodule CodeCorps.Repo.Migrations.AddVerificationFieldsToStripeConnectAccount
def change do
alter table(:stripe_connect_accounts) do
add :verification_disabled_reason, :string
add :verification_due_by, :datetime
add :verification_due_by, :utc_datetime
add :verification_fields_needed, {:array, :string}
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ defmodule CodeCorps.Repo.Migrations.AddTosAcceptanceFieldsToStripeConnectAccount

def change do
alter table(:stripe_connect_accounts) do
add :tos_acceptance_date, :datetime
add :tos_acceptance_date, :utc_datetime
add :tos_acceptance_ip, :string
add :tos_acceptance_user_agent, :string
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,18 @@ defmodule CodeCorps.Repo.Migrations.ConvertStripeTimeStampsToIntegers do
remove :tos_acceptance_date
remove :verification_due_by

add :tos_acceptance_date, :datetime
add :verification_due_by, :datetime
add :tos_acceptance_date, :utc_datetime
add :verification_due_by, :utc_datetime
end

alter table(:stripe_platform_customers) do
remove :created
add :created, :datetime
add :created, :utc_datetime
end

alter table(:stripe_connect_plans) do
remove :created
add :created, :datetime
add :created, :utc_datetime
end

alter table(:stripe_connect_subscriptions) do
Expand All @@ -70,18 +70,18 @@ defmodule CodeCorps.Repo.Migrations.ConvertStripeTimeStampsToIntegers do
remove :ended_at
remove :start

add :cancelled_at, :datetime
add :created, :datetime
add :current_period_end, :datetime
add :current_period_start, :datetime
add :ended_at, :datetime
add :start, :datetime
add :cancelled_at, :utc_datetime
add :created, :utc_datetime
add :current_period_end, :utc_datetime
add :current_period_start, :utc_datetime
add :ended_at, :utc_datetime
add :start, :utc_datetime
end

alter table(:stripe_file_upload) do
remove :created

add :created, :datetime
add :created, :utc_datetime
end
end
end
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
defmodule CodeCorps.Repo.Migrations.AddEditableToTaskLists do
alias CodeCorps.{Repo, TaskList}

import Ecto.Query

use Ecto.Migration

def up do
Expand Down

0 comments on commit 327cddd

Please sign in to comment.