Closed heikkilevanto closed 4 days ago
See also #309 and #317
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.
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
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.