Closed adamengst closed 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:
{ "CMSM": [98734, 3248, 98456, 34565], "CMPT": [82374, 293847, 293847, 987234] }
) -- I think these are available from WebScorer's front-end, but if not I can show you how to get them from their API...are you familiar enough with JSON like the above that you'd be able to maintain this list?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.
Quick JSON (JavaScript Object Notation) primer:
{ }
encloses an object, which can contain zero or more comma-separated "field name": value
pairs[ ]
encloses an array, which can contain zero or more comma-separated values"string"
, including the quotes"string"
, 1234.56
(number), { "other": "object" }
, or [ "array" ]
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.
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...
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.
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.
Yep, no rush -- worst case scenario I can do some cleanup on the import side before parsing it
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
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!
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
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.
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.
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)
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.
Thoughts?
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?
@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.
Woo, I like it! Some answers/issues:
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.
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.
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.
And now it has caught up
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.
@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
Cool, looks like it prefers %20 in the URL.
https://challenge.fingerlakesrunners.org/Group/Index/High%20Noon
Two questions from above:
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.
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.
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: