sbailey / surveyqa

DESI Survey QA Dashboard
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

update prev/next links for adjacent nights when updating a single night #48

Open sbailey opened 5 years ago

sbailey commented 5 years ago

This is closely related to issue #47, but it is potentially tricker and messier and I'm not sure exactly how we want to do this, so implement #47 first and then we'll deal with this in a separate branch + PR:

When updating a single night without regenerating all nights, check if the previous and next nights also need to be updated so that their prev/next links are correct. The logic might be something like this:

if output file for this night already exists:
    assume links are correct from earlier run and update only that night
else:
    generate the page for this night
    if previous night output file exists:
        update it so that its "next" link points to this new night
    else:
        do nothing (i.e. don't generate a *new* file for a prev night, but update any pre-existing ones)

    if next night output file exists:
        update it so that its "prev" link points to this new night
    else:
        do nothing

The primary use case here is when we are N+1 nights into the survey and just got new data, we can update the plots for night N without having to re-generate all previous N nights, while still having the Nth night updated so that its "next" link will work.

williyamshoe commented 5 years ago

It is very doable to just update prev/next nights, as I would just rewrite the previous and next night. However, after heavy contemplation, I'm unsure as to handle the first night and last night links.

If the updating night happens to be the first or last night (which it most likely will), then I would have to go back to change all of the nights' first night and last night links. One option I've been contemplating is making a separate text document to store the last and last nights, and all the html files should reference this .txt document when linking first night and last night. However, since I'm working in html, there is no native file reader that can read local files, so I would either have to make a seperate .js file, or import a javascript library just to do so. Clearly, things get muddled really quickly; do you have any idea on how to go about this, or rather, should I just ignore updating the first and last tags entirely?

williyamshoe commented 5 years ago

I have implemented a version where it completely disregards the first and last links, but (I hope) correctly updates next and prev links. It is found under the update_prev_next branch (I did not pull request the branch because I am still unsure if we want to try to implement the first and last links, or not).