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

Translate internal codes #98

Open
waldoj opened this issue Sep 21, 2019 · 3 comments
Open

Translate internal codes #98

waldoj opened this issue Sep 21, 2019 · 3 comments

Comments

@waldoj
Copy link
Member

waldoj commented Sep 21, 2019

Naked internal codes are displayed (e.g., 20 or 00). This isn't helpful. Add an internal method to convert an internal code to its textual equivalent, and call that before returning data. Preserve the internal code in responses.

@waldoj waldoj changed the title Translate status codes Translate internal codes Sep 21, 2019
waldoj added a commit that referenced this issue Sep 21, 2019
This SQL isn't working, and I have no idea why. I don't think I've ever used correlated subqueries in SELECT clauses in SQLite. Toward #98.
@waldoj
Copy link
Member Author

waldoj commented Sep 26, 2019

This isn't working, and I can't fathom why.

Subqueries just...don't work. They return nothing. I've researched it. There's no reason at all why they shouldn't be working, but they're not.

Instead of continuing to beat my head against this wall, I think it's worth trying a completely different solution. Seems to me that I should just get * from tables (only 419 rows), break that into an array, and use that as a lookup table. That can be re-generated during each weekly data update, stored as JSON, and loaded off the filesystem with each page view. If that were ever an issue, it could be dropped into Memcached or something.

@waldoj
Copy link
Member Author

waldoj commented Sep 26, 2019

sqlite3 -csv -header vabusinesses.sqlite "SELECT * FROM tables" |csvtojson > tables.json

waldoj added a commit that referenced this issue Sep 27, 2019
waldoj added a commit that referenced this issue Sep 27, 2019
Toward #98, since this changes very rarely, go ahead and create it manually for now.
waldoj added a commit that referenced this issue Sep 28, 2019
@waldoj
Copy link
Member Author

waldoj commented Sep 28, 2019

There are a few improvements to make:

  • create a new class for this lookup table
  • when the class is instantiated, pull the data from the file
  • move the lookup logic into the new class (and out of Business::fetch)
  • write tests

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

No branches or pull requests

1 participant