perrycate / tournamap

Website to visualize Smash Ultimate tournaments near you
https://tournamap.gg
GNU General Public License v3.0
9 stars 6 forks source link

Add "last updated" indicator for data #36

Open perrycate opened 2 years ago

perrycate commented 2 years ago

At least initially we can just add it to the json we're generating and use it for debug purposes. Eventually it'd be nice to add it to the UI somewhere.

ajistrying commented 1 year ago

I'll grab this one. For the backend it seems straight forward enough to just add in the updatedAt field to the getTourneyPage functionality and make sure that comes through to the json that gets generated.

Any idea where you'd want the new update_at field within the tournament list if at all right now?

perrycate commented 1 year ago

Ah, should have clarified: I'm imagining a timestamp generated by the data fetching script itself indicating when the fetching itself happened, not the data that each tournament was updated. (Though that is still useful and I will totally still take the PR lol.)

This will also entail changing the format of the tournaments.json data to have an envelope around it, from what we currently have:

[
  {
    "start_time": 1675258140,
    "url": <blah blah blah>
    ...
  },
  ...other per-tournament data
]

To something like:

{
  "data": <what we currently return from tournaments.json, the array of tournament data>,
  "updated_at": 1676015960
}

Doing so will completely break current behavior on the frontend, so we'll need to also change it to look in the data (or whatever we call it) field of the response instead of using the response as an array directly. On the bright side, once we make this change we'll be able to later add any other metadata we want without breaking behavior as badly. It was definitely a mistake on my part not including some sort of envelope in the first place.

As for where to expose it: That can be a separate PR probably, and I'm open to suggestions. Maybe at the bottom of the page, or of the side panel? On the about page? Dunno, we can experiment and see how it looks.

ajistrying commented 1 year ago

Ahhhh I see, yeah that approach makes sense. Gonna crack open another PR here soon! 🤝

perrycate commented 1 year ago

With the merging of #55 , now all that remains is to expose this in the UI! I know you mentioned you were more interested in the Elixir side of things, so if you'd rather switch to something else (such as the recently-added issue #54 :eyes:), let me know and I'll unassign you from this one.

If you (or anyone else) is interested in messing with the frontend a bit: Since the main sidebar panel is dynamically updated by the pins and such, I think it might be weird to have other unrelated text at the bottom. I'm thinking the best two places would be either the bottom left side of the map (in a similar style to the existing leaflet disclaimer), or somewhere on the about page, either in the Data Source(s) section or at the bottom there. Still open to suggestions!

ajistrying commented 1 year ago

I can finish this one out no worries! As for where to put the metadata, I can take a shot putting it on top of the map in the bottom left corner.

Once this one is closed out I can move on to #54 and then #32, unless #32 takes a higher priority?

perrycate commented 1 year ago

Sounds like a plan to me! When you add it, give the div (or whatever element) some sort of easily-identifiable ID even if it doesn't need it for styling. We can use it for #21

ajistrying commented 1 year ago

Forgot to post the PR here even though I mentioned this issue in it lol

56