-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: speed up Detour queries by returning subsets of JSON snapshot #2946
base: main
Are you sure you want to change the base?
Conversation
6f8662e
to
abbbfd0
Compare
|> with_detour() | ||
|> Skate.Detours.Db.Detour.Queries.select_route_name(:route) | ||
|> Skate.Detours.Db.Detour.Queries.select_route_pattern_name(:origin) | ||
|> Skate.Detours.Db.Detour.Queries.select_route_pattern_headsign(:headsign) | ||
|> Skate.Detours.Db.Detour.Queries.select_direction(:direction) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not quite happy with this, but I wasn't sure about changing the virtual field names. would be happy to discuss though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#2948 is why I'm not quite happy with this, as I'm not sure how to hide these functions from the public API while also allowing renaming for situations like this.
def with_author(query \\ base(), key \\ :author) do | ||
from([detour: d] in query, | ||
join: a in assoc(d, :author), | ||
as: :author, | ||
select_merge: %{^key => a} | ||
) | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note: still not certain about this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I figured out what I'd prefer in #2948
…ns.Db.Detour.Queries` into `Skate.Detours.Db.Detour.Queries`
wip! working, pr ready wip! add virtual fields to struct wip! add route id
abbbfd0
to
d0eb72d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Had to learn a little bit about several new things to me (virtual fields and ecto query composition mainly), but I feel like I'm following everything here. It's clean and clear.
The note on with_author
, I don't see what could be wrong with it. The note on select_detour_notification_info
, I see what you're saying but think what you did is still a solid approach
Asana Ticket: https://app.asana.com/0/1203014709808707/1209252334767151/f