Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View pkoch's full-sized avatar

Paulo Koch pkoch

View GitHub Profile
@pkoch
pkoch / a.rb
Created December 4, 2017 15:28
https://gist.github.com/df9861cc1d105701265df4256c7fd3bb
Theorem andb_eq_orb :
forall (b c : bool),
b && c = b || c ->
b = c.
Proof.
intros b c.
destruct b.
- simpl.
destruct c.
+ reflexivity.
defmodule Api.CompetitionActions do
use Api.Web, :action
alias Api.{Competition, TeamActions, Vote, PaperVote, Team}
alias Ecto.{Changeset}
defp _get do
Repo.one(from(c in Competition)) || %Competition{}
end
defmodule Api.CompetitionActions do
use Api.Web, :action
alias Api.{Competition, TeamActions, Vote, PaperVote, Team}
alias Ecto.{Changeset}
defp _get do
Repo.one(from(c in Competition)) || %Competition{}
end
@pkoch
pkoch / -
Created September 8, 2017 21:05
diff --git a/test/controllers/admin/admin_paper_vote_controller_test.exs b/test/controllers/admin/admin_paper_vote_controller_test.exs
new file mode 100644
index 0000000..f63d82a
--- /dev/null
+++ b/test/controllers/admin/admin_paper_vote_controller_test.exs
@@ -0,0 +1,61 @@
+defmodule Api.Admin.PaperVoteControllerTest do
+ use Api.ConnCase
+
+ alias Api.{CompetitionActions}
@pkoch
pkoch / 63
Created September 4, 2017 14:35
.......................................................................................................................................
1) test voting_ended_at set twice (Api.CompetitionActionsTest)
test/actions/competition_actions_test.exs:10
** (ArgumentError) Postgrex expected an integer in -2147483648..2147483647, got <<43, 56, 71, 70, 233, 249, 65, 186, 183, 181, 147, 111, 154, 61, 218, 95>>. Please make sure the value you are passing matches the definition in your table or in your query or convert the value accordingly.
code: {:ok, _} = CompetitionActions.open_voting()
stacktrace:
(ecto) /home/pkoch/Desktop/lom/psc-api/deps/postgrex/lib/postgrex/type_module.ex:717: Ecto.Adapters.Postgres.TypeModule.encode_params/3
(postgrex) lib/postgrex/query.ex:45: DBConnection.Query.Postgrex.Query.encode/3
(db_connection) lib/db_connection.ex:1071: DBConnection.describe_run/5
defmodule Api.Competition do
@moduledoc """
TODO: Write.
"""
use Api.Web, :model
alias Ecto.{Changeset}
@valid_attrs ~w(
@pkoch
pkoch / derp
Created September 2, 2017 17:53
The database for Api.Repo has been dropped
The database for Api.Repo has been created
......................................
1) test changeset redeem (Api.PaperVoteTest)
test/models/paper_vote_test.exs:28
** (RuntimeError) changing assocs with change/2 or put_change/3 is not supported, please use put_assoc/4 instead
code: assert PaperVote.changeset(%PaperVote{}, Map.merge(base_attrs, %{
stacktrace:
(ecto) lib/ecto/changeset.ex:1011: Ecto.Changeset.put_change/7
defmodule Api.PaperVote do
@moduledoc """
TODO: Write.
"""
use Api.Web, :model
alias Api.{Crypto, Team, Category, User}
@required_attrs [
@pkoch
pkoch / -
Created September 1, 2017 18:16
diff --git a/test/controllers/admin/admin_stats_controller_test.exs b/test/controllers/admin/admin_stats_controller_test.exs
index f3cbd21..7f7f79a 100644
--- a/test/controllers/admin/admin_stats_controller_test.exs
+++ b/test/controllers/admin/admin_stats_controller_test.exs
@@ -58,4 +58,4 @@ defmodule Api.AdminStatsControllerTest do
}
}
end
-end
\ No newline at end of file