heikkilevanto / beertracker

Simple script to track the beers I drink
GNU General Public License v2.0
2 stars 1 forks source link

Improve file reading #340

Closed heikkilevanto closed 4 days ago

heikkilevanto commented 1 week ago

Make the data file reading function take two arguments, the first and last date to read. Parse only the lines between those dates.

Let each page function make its own call to the data reading, so it can decide how much or little data we should read.

That way, we can avoid parsing the whole file except on pages where we need to, like stats. That should save quite some time.

Be careful when reading data for the full list page, since it also has the graph.

heikkilevanto commented 1 week ago

See also #309 and #317

heikkilevanto commented 4 days ago

Can not do this way, by the time we start the page function, we have already printed the input form, which needs values from $foundrec.

Instead, we have to decide the reading range in the beginning

I guess we could always just read the last 180 days, and re-read if more are needed for statistics, graphs, or very selective searches.

heikkilevanto commented 4 days ago

Even the About page needs to read some data, and display the input form, as that is where new users end up, and they need to be able to fill in their first beer