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

Improve stat pages #2675

Open
ozh opened this issue May 3, 2020 · 2 comments
Open

Improve stat pages #2675

ozh opened this issue May 3, 2020 · 2 comments
Labels
enhancement

Comments

@ozh
Copy link
Member

@ozh ozh commented May 3, 2020

Stat pages are a complete shitshow exposing how bad I was at mysqling things 10 years ago (not saying I've really improved in that area :)

Problems:

  1. Code has been ugly for years

  2. Code doesn't easily allow smarter plugins to take over (I think that's probably a reason why there are no stats plugin)

  3. This page is pulling every info from the DB in a few queries then doing PHP stuff to rearrange and display. While this is fine for a couple thousand hits, it quickly becomes completely unpractical, if not just failing, when days and/or hits add up.

  4. This page displays just everything. Again, why not for a couple hits, but this has probably no value to anyone:
    image

Maybe we should have a more simple page and have the "details" loaded on demand by ajax.

Any suggestion or PR welcome.

@ozh ozh added the enhancement label May 3, 2020
@ozh
Copy link
Member Author

@ozh ozh commented May 27, 2020

The DB schema regarding stats is weak, but it's not imaginable to have a web based upgrade script (dozens of thousands of rows to migrate by chunk - nope).

Plan B : have two log table coexisting, one legacy and one current

  • introduce new schema table(s)
  • migrate by chunk, keyword by keyword, every time a stat page is requested

@RVxLab
Copy link

@RVxLab RVxLab commented Oct 1, 2021

How I'd approach this is in separate stages, updating everything at once is a great way to lose track of what's going on.

First the backend should be cleaned up by moving everything into separate functions or classes. A repository pattern would work well here. Then you could opt to use data classes to organize the data.

Then I'd recommend to start cleaning up the frontend by using a combination of a templating engine like Twig or Blade and a JS library like Vue or Alpine.

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

No branches or pull requests

2 participants