FingerLakesRunnersClub / Leaderboards

Leaderboards for the FLRC Challenge and Trail Circuit
https://fingerlakesrunners.org
GNU General Public License v3.0
0 stars 0 forks source link

Group page capability that brings together an arbitrary set of runners #75

Closed adamengst closed 3 years ago

adamengst commented 3 years ago

As race director, I'm interested in bringing more people into the Challenge and one way to do that is to let a group of people compete against each other. That might include the Cayuga Medical Sports Medicine department, for instance. Different groups could also compete against one another (Sports Med vs Physical Therapists, for instance). The idea is that the page could be sorted in different ways to see who was in the lead for different metrics.

Acceptance Criteria:

SteveDesmond-ca commented 3 years ago

Ooh, I just figured out how we can do this more dynamically, so we don't need to edit the app's config every time a new group/member gets added/removed:

adamengst commented 3 years ago

Oh, clever. I hadn't thought about using the FLRC site as a go-between for largely static config, largely because I don't quite think of it as "mine" in the way I do other sites. I'm not particularly familiar with JSON, but I'm highly trainable and figure things out quickly, so I strongly suspect I can maintain it. :-)

So in essence, I'd just maintain the group on the FLRC site and the leaderboard would query that whenever necessary.

SteveDesmond-ca commented 3 years ago

Quick JSON (JavaScript Object Notation) primer:

If you create a page with the following as its content:

{
    "Test": [ 6728, 115406 ]
}

This will create an object that contains a test group (with a key/name of "Test") that includes the IDs for me and you in it. Feel free to add additional groups if you already know who's in them.

Once I know the URL I can start programming/testing against it.

adamengst commented 3 years ago

I'm not sure how the WordPress wrapper comes into place, but see if this is usable.

https://fingerlakesrunners.org/challenge-groups/

I can change URL or content, but I don't offhand know how to get a bare page in WordPress. Perhaps making a file via FTP...

SteveDesmond-ca commented 3 years ago

Almost there!

Can you see if there's a "remove formatting" button when you select all the JSON in the admin view? You may just need to change the fancy quotes (“ ”) into normal quotes (" ") manually if not.

adamengst commented 3 years ago

Alas, there's no manually applied formatting—that's the WordPress theme automatically curling quotes.

I'll have to see if I can figure out how to connect via FTP and make a static file. If that doesn't work, we'll ask Eli.

But I'm feeling under the weather again and way behind on other things so it may not be for a day or two.

SteveDesmond-ca commented 3 years ago

Yep, no rush -- worst case scenario I can do some cleanup on the import side before parsing it

adamengst commented 3 years ago

Can you work with this URL, say? I created it as a static page via SFTP so it's outside the WordPress manipulations.

https://fingerlakesrunners.org/wp-content/uploads/challenge-group-json.html

SteveDesmond-ca commented 3 years ago

Even better! (as long as that's not too much trouble to maintain)

Let's rename it challenge-groups.json (.json is the standard extension for JSON) so the MIME type gets picked up correctly, and then we should be good to go!

adamengst commented 3 years ago

Done! (I was thinking that when I named it, but wimped out and went with HTML to avoid potential WordPress config issues with other extensions.)

https://fingerlakesrunners.org/wp-content/uploads/challenge-group.json

SteveDesmond-ca commented 3 years ago

Are these going to be mixed groups, or split M/F? If the former, I don't know that overall points will be possible to show, unless we add the "All/F/M" filter that's available elsewhere/throughout, but I don't know if that would make sense depending on how small these groups will be. Plus it's kind of an apples/oranges comparison, e.g. I'm about as fast as the 3rd-5th place women, but they have 200+ more points because their overall competition is closer.

adamengst commented 3 years ago

I imagine they'd be mixed groups, so yeah, let's drop overall points. What about a total time number? That might be a nice way to reward the slower and more dedicated runners.

SteveDesmond-ca commented 3 years ago

Looks like we've got a little too much data to fit this in at the widest width (where we can't use the horizontal scrolling) image

Is there a least-useful field here that we could drop? The view and a lot of the logic is shared with the "Team Members" list since they're pretty much the same thing, so any changes would also show up there. "Total Time" is obviously wrong right now, since getting all the data needed is going to be a bit of work, so maybe that's the easy choice?

Alternatively, if shortening some of the column headers still makes things clear enough, we can fit everything in that way. image

Thoughts?

SteveDesmond-ca commented 3 years ago

Looks like without a not-insignificant re-architecting, it's an either/or of age grade or total time right now...maybe if we want to include that as a metric, we can create a separate issue to track that?

SteveDesmond-ca commented 3 years ago

@adamengst The initial iteration of this is now live -- give it a try at https://challenge.fingerlakesrunners.org/Group/Index/Test and let me know what you think.

You can then add a new group to the JSON file and change the URL accordingly with that group's name instead of "Test" to see that one.

adamengst commented 3 years ago

Woo, I like it! Some answers/issues:

SteveDesmond-ca commented 3 years ago

If you replace each }{ pair between the groups, it should work:

{
    "Test": [ 6728, 115406 ],
    "Cayuga Med": [ 131613, 116441, 97901 ],
    "High Noon": [ 6728, 41357, 74963, 73461, 73397, 54661, 73179, 35364, 49461, 38756, 19858, 122628, 127288, 36492 ]
}

Adding spaces in the names should be fine, but I forget if it's %20 or + in the URL to have ASP.NET translate it out of the box.

adamengst commented 3 years ago

Ah! Fixed now.

Turns out spaces in the JSON name are just dropped, so the URL and the group name both appear without a space.

adamengst commented 3 years ago

You're probably doing something on the server, but no changes to the JSON are taking right now. I've added Sarah Ridenour to the CayugaMed group, but it's not displaying her. And no additions or removals from other groups are taking either.

adamengst commented 3 years ago

And now it has caught up

SteveDesmond-ca commented 3 years ago

Yeah, if the FLRC site is on wordpress.com, it might take a minute for the JSON updates to propagate over their CDN.

I'll see what I can do about the spaces in the names/URLs.

SteveDesmond-ca commented 3 years ago

@adamengst spaces in the group names should work now if you wanted to try renaming them...feel free to remove our test group as well

adamengst commented 3 years ago

Cool, looks like it prefers %20 in the URL.

https://challenge.fingerlakesrunners.org/Group/Index/High%20Noon

adamengst commented 3 years ago

Two questions from above:

SteveDesmond-ca commented 3 years ago

If that's a valuable metric to have, it's going to be a somewhat significant reworking of some of the data flows, which was my thought behind splitting it off into its own issue, so we could get something 99% of the way there out now, and then we figure out how to squeeze it in once the actual data is available.

adamengst commented 3 years ago

Ah! OK, I just wasn't sure if it was more of a reworking or more of a layout issue. No worries, and Total Time can wait for now.