BartOtten

BartOtten

If you want the internet to respont, make an error - Elvis Presley :sweat_smile:

ps. quoting the brilliant and definitive answer, rewriting it using Enum.map/2 so you can say it’s wrong… it is Lousy. Jea Lousy. How would you feel if you liked a post and the author edited it and blamed you for something you did not?

Tag: satire

4
Post #31
Sebb

Sebb

*respond

3
Post #32
dtew

dtew

Haha!
Perhaps Elvis only left the building 'cos it had rubbish internet?

1
Post #33
BartOtten

BartOtten

The proof was in the statement indeed. Suprised it took 2 hours :joy:

2
Post #34
docjazither

docjazither OP

@sodapopcan
They are duplicated entries from database so they’re pretty much the same except some properties are different so I can delete them based on logic
If some “that” properties are the same then…
I wanted to extract the first out, then delete the rest. I should have meant that in the beginning, sorry for the confusion guys. I wished I could have edited the post

1
Post #35
benwilson512

benwilson512

Author of Craft GraphQL APIs in Elixir with Absinthe

Aha! This makes so much sense. Perhaps in your SQL query you could limit: 1 ?

1
Post #36
BartOtten

BartOtten

-duplicate suggestion-

Limiting in the database is much better as there is no need to send all records over the wire just to flush all but 1 of them.

Ecto returns lists of maps or structs so the take first element does not seem to be an issue. hd/1 would do.

Now I think I get the whole picture. The ’take the first’ is less of an issue; the ‘how to create the correct query’ is.

1
Post #37
docjazither

docjazither OP

As the application was progressing, it allowed users sign up with different methods as well as they can also be added manually through Phoenix UI database management app created by template
Now that’s changed to signing up just by one method which is by domestic register only and people want to put a unique constraint on it

1
Post #38
BartOtten

BartOtten

With every answer we get spoon fed another bite. Sooo curious about what the final question and answer will be. Stay tuned! :slight_smile:

0
Post #39
docjazither

docjazither OP

In the beginning I was feeding my query through Enum.group_by so it’s a map, but my logic changed(what a mess I created) now actually I don’t use it anymore and I agreed that enum query returning a list

0
Post #40