Skip to content
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

Clean up Config table Scala code #3322

Closed
misaugstad opened this issue Jul 27, 2023 · 0 comments · Fixed by #3332
Closed

Clean up Config table Scala code #3322

misaugstad opened this issue Jul 27, 2023 · 0 comments · Fixed by #3332
Assignees

Comments

@misaugstad
Copy link
Member

Brief description of problem/feature

@dylanbun created a new config table to make it easier to update configs on the fly (PR #3320). The code definitely needs some work though!

First, instead of the giant ConfigApi class, we should have a smaller case class (maybe called MapParams) that just holds a map center lat/lng, 2 corners of a bounding box in lat/lngs, and a zoom level. This case class can be reused 4 times in the definition of the table in Scala. This will make the following changes easier and cleaner, but the later ones should be done even if we aren't able to figure out how to do this one.

Replace the million getters in ConfigTable.scala with getters that package things together that we use together. This will make the code cleaner and it will reduce the number of SQL queries we make. Right now getting each value is it's own SQL query, which is highly inefficient.

We can probably make some toJSON functions that will package up the data we access in multiple places nicely into JSON. This one will be a lot easier if we can split in to the smaller case classes, but it might be useful anyway, not sure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants