Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Nov 8, 2022. It is now read-only.

Commitc7e2c93

Browse files
committed
debug has_many dataloader issue
1 parentcbbfa41 commitc7e2c93

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

‎lib/mastani_server/cms/cms_loader.ex‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,11 @@ defmodule MastaniServer.CMS.Loader do
3939
|>Map.new()
4040
|>IO.inspect(label:"after")
4141

42-
4342
forid<-community_ids,do:Map.get(results,id,[0])
4443
end
4544

4645
defrun_batch(PostComment,comment_query,:cp_count,post_ids,repo_opts)do
47-
IO.inspectcomment_query,label:"comment query ..."
46+
IO.inspect(comment_query,label:"comment query ...")
4847

4948
results=
5049
comment_query
@@ -56,7 +55,7 @@ defmodule MastaniServer.CMS.Loader do
5655
|>Repo.all(repo_opts)
5756
|>Enum.group_by(fn{x,_}->xend)
5857
|>Enum.map(fn{x,y}->{x,[length(y)]}end)
59-
|>Map.new
58+
|>Map.new()
6059

6160
forid<-post_ids,do:Map.get(results,id,[0])
6261
end
@@ -109,7 +108,8 @@ defmodule MastaniServer.CMS.Loader do
109108

110109
# def query({"posts_comments", PostComment}, %{filter: %{first: first}} = filter) do
111110
defquery({"posts_comments",PostComment},%{filter:%{first:first}}=args)do
112-
IO.inspectargs,label:"very wired .."
111+
IO.inspect(args,label:"very wired ..")
112+
113113
PostComment
114114
|>order_by(desc::inserted_at)
115115
# |> limit(^first)

‎lib/mastani_server_web/schema/cms/cms_types.ex‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,8 @@ defmodule MastaniServerWeb.Schema.CMS.Types do
117117

118118
field:comments_participators_count2,:integerdo
119119
resolve(fnpost,_args,%{context:%{loader:loader}}->
120-
IO.inspectpost.id,label:"luck"
120+
IO.inspect(post.id,label:"luck")
121+
121122
loader
122123
|>Dataloader.load(CMS,{:one,CMS.PostComment},cp_count:post.id)
123124
|>on_load(fnloader->
@@ -227,7 +228,8 @@ defmodule MastaniServerWeb.Schema.CMS.Types do
227228
# see also: https://github.com/absinthe-graphql/dataloader/issues/25
228229
field:posts_count,:integerdo
229230
resolve(fncommunity,_args,%{context:%{loader:loader}}->
230-
IO.inspectcommunity.id,label:"luck"
231+
IO.inspect(community.id,label:"luck")
232+
231233
loader
232234
|>Dataloader.load(CMS,{:one,CMS.Post},posts_count:community.id)
233235
|>on_load(fnloader->

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp