Skip to content

Commit

Permalink
address warnings for large integers #223
Browse files Browse the repository at this point in the history
  • Loading branch information
nelsonic committed Jan 20, 2025
1 parent 19ed306 commit 572ae2d
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 4 deletions.
24 changes: 23 additions & 1 deletion lib/app/repository.ex
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ defmodule App.Repository do
def create(attrs) do
%Repository{}
|> changeset(attrs)
|> Repo.insert()
|> Repo.insert(on_conflict: :replace_all, conflict_target: [:id])
end

@doc """
Expand All @@ -76,3 +76,25 @@ defmodule App.Repository do
end)
end
end

"""
%App.Repository{
__meta__: #Ecto.Schema.Metadata<:loaded, "repositories">,
id: 35713694,
created_at: "2015-05-16T07:06:03Z",
description: "Effortless Meteor.js Image Uploads",
fork: true,
forks_count: 1,
full_name: "ideaq/image-uploads",
language: "JavaScript",
name: "image-uploads",
open_issues_count: 0,
owner_id: nil,
pushed_at: "2016-07-02T12:37:46Z",
stargazers_count: 5,
topics: nil,
watchers_count: 5,
inserted_at: ~N[2025-01-20 12:27:57],
updated_at: ~N[2025-01-20 12:27:57]
}
"""
7 changes: 7 additions & 0 deletions lib/app_web/live/app_live.ex
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@ defmodule AppWeb.AppLive do
# Get Repos:
Task.start(fn ->
App.Repository.get_org_repos(org)
# get all stargazers for a given repo
|> Enum.map(fn repo ->
dbg(repo)
# App.Star.get_stargazers_for_repo(owner, repo)
repo
end)

end)

list = App.GitHub.org_user_list(org)
Expand Down
6 changes: 3 additions & 3 deletions test/app/star_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ defmodule App.StarTest do
App.Repository.get_org_repos(owner)
repo = "image-uploads"
list = App.Star.get_stargazers_for_repo(owner, repo)
star = Enum.filter(list, fn(s) -> s.user_id == 194400 end) |> List.first
star = Enum.filter(list, fn(s) -> s.user_id == 194_400 end) |> List.first

assert star.user_id == 194400
assert star.repo_id == 35713694
assert star.user_id == 194_400
assert star.repo_id == 35_713_694
end
end

0 comments on commit 572ae2d

Please sign in to comment.