Git Product home page Git Product logo

running-challenges's Introduction

Running Challenges

A browser extension to allow you to complete challenges with your parkrun results

The generated extension (initially created for Chrome) adds extra information to your parkrun results page to describe progress towards various challenges, including 'Alphabeteer' (running a parkrun starting with every letter of the alphabet), 'Tourist' (running 20 or more different parkruns), and many more.

Building the repository

Website

The /website folder containers a Jekyll-based website. You can build and serve the website locally for testing by running a bash script (Linux and Mac only).

  1. Download the git submodule which contains additional Running Challenges data (the build fails without this). From the root of the project:

    cd running-challenges-data

    git submodule update --init --recursive

    cd ..

  2. From the root of the project, run the bash script:

    ./build/website/build-local-and-run.sh

    If you have other Jekyll sites running in Docker containers, you can specify a port mapping when you run the script (eg to expose port 4002 instead of the default 4000):

    JEKYLL_PORT=4002 ./build/website/build-local-and-run.sh

  3. In a web browser, open the locally-hosted website:

    http://localhost:4002/

    Any changes you make to pages of the website should automatically get picked up when you refresh (F5) the page.

  4. To stop the local website running, press CTRL+C in the terminal.

Browser Extensions: Docker build

You can test local changes by building both the Chrome and Firefox extensions at once with Docker:

From the root of the repository, build the image:

docker build -t rc:latest .

Then run the Docker container:

docker run --rm -v `pwd`:/rc rc:latest

Browser Extensions: non-Docker build

The bulk of the code that is common to the Chrome and Firefox extensions lives in the browser-extensions/common directory, and is supplemented by additional browser-specific files and libraries from either browser-extensions/chrome or browser-extensions/firefox when the extension is built.

Most of the images live in the top-level directory images so that they are shared between the extensions and the website, they are also copied into the extension when a build occurs.

Build Dependencies

Mozilla provide a small tool - web-ext tool, to package and lint check Firefox browser extensions, which is used for packaging both the Chrome and Firefox extensions. The lint checking is of limited use for Chrome, but is still run for reference. It can be installed with npm install --global web-ext.

Chrome Extension

The Chrome extension is the original version, and can be built by running the build script from the root of the repository:

bash ./build/extension-chrome/build.sh

This will create an unpacked version of the extension in browser-extensions/chrome/build, together with a packaged version in the web-ext-artifacts directory.

Firefox Addon

The Firefox addon is built from largely the same code as the Chrome extension with a few small tweaks (such as a different manifest file, and some sed replacements). It uses a separate build script from the Chrome version, but is built in an identical way:

bash ./build/extension-firefox/build.sh

This will create an unpacked version of the extension in browser-extensions/firefox/build, together with a packaged version in the web-ext-artifacts directory.

Your build of the extension is not signed, so Firefox does not allow you to install it directly from your built file. Instead, for testing purposes, you have to install it as a temporary installation in Firefox (it automatically deletes itself when you quit Firefox).

Automated builds

This repository is integrated with TravisCI so that code pushed to the master branch in GitHub is built. This will update the website, and if a suitable tag is present, then a GitHub Release is created and a copy of the extension at that level is uploaded for further submission to the Chrome and Firefox extension/addon webstores.

Each PR created, and when additional commits are pushed to existing PR branches, an additional build it run to build a copy of the website on staging.running-challenges.co.uk .

Adding a new volunteer role

Occasionally parkrun create a new volunteer role, for example the "Car Park Marshall", which needs to be added in. By default the extension won't pick up these unknown roles, and they will need adding in in a few places:

  • Add the name of the role, and any known translations to browser-extensions/common/js/lib/i18n.js, putting an entry in at least the default section.
  • Add the name and a suitable shortname to the generate_volunteer_challenge_data() function in browser-extensions/common/js/lib/challenges.js
  • Create the new badge as a layer in images/badges/256x256/badges.xcf, and export it as a .png file.
  • Follow the instructions in images/badges/README.md to generate the star badges.
  • Update website/_data/badges.yml with a section for the additional role

Adding a new country

It is impossible to add a new country until the new website is made live, and there are events on the map.

  • Find the website URLs for the 3 pages the extension modifies. They seem to follow the english spelling these days:
  • Look in the volunteer rosters and attempt to find the translations to add to the i18n.js (internationalisation) file
  • Add the ISO code for the country to the flag map in challenges.js
  • Add the ISO code to the list of flags for the website under the flags.yml data file.
  • Get the flag from https://emojipedia.org/twitter/twemoji-2.6/ as described in the flags README.
  • Add the country code and country name to background.js

Version numbers

There hasn't been any real consistency in how the versions have been numbered, with the versions mostly going up a point release when something was changed. The only thing that has been consistent is that the last number has referred back to the Travis build that generated the release.

To make this more consistent, from January 2020 the numbering, which follows the format <major>.<minor>.<patch>.<build-number> will refer to:

Major version

Something big has changed in the way the extension works. We may never go to version 2, but it's here if that happens.

Minor version

A new challenge, stat, or badge has been added - or there has been a significant addition to the way the data is displayed on the webpage.

Patch version

Bug fixes or minor rendering changes

Build Number

This will remain as it always has, including the Travis build number.

Releasing a new version

  1. When everything has been tested and merged into master, tag master with the version in build/version.sh. This will trigger a Travis build to push the built zips to a Github release.
    git tag v0.7.5
    git push origin v0.7.5
    
  2. Watch the Travis build run.
  3. Head over to the releases tab in Github and find the release for the version you tagged.
  4. Edit the release with any information that you may want to include in release notes, or perhaps form the basis of the blog post.
  5. Download the zips and test them in Chrome and Firefox to check they load and don't give any errors - load a couple of profiles and if you have added some new countries or badges, check those.
    • In Firefox, go to about:debugging and load a temporary add-on
    • In Chrome, go to chrome://extensions and load an unpacked extension
  6. Go to the Chrome webstore and upload the new version.
  7. Go to the Mozilla Add-ons site and upload the new version. Make sure to check that it is compatible with Android, this is unchecked by default. Add the release notes when asked.
  8. Complete the release by creating a PR to include:
    • Prepare for the next release by updating the version string in build/version.sh to the next appropriate number (this can always be changed later)
    • Add a blog post in website/_posts - just copy the last release and change the pertinent bits.

running-challenges's People

Contributors

ajhepple avatar andy-taylor avatar dependabot[bot] avatar fraz3alpha avatar jazzyj87 avatar johnsyweb avatar lauracowen avatar rboyatt avatar rutson avatar solarisfire avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

running-challenges's Issues

Reduce frequency of getting geo.xml

Browser cache doesn't need to be updated every 24 hours. Could be once a week without any problems I think (parkrun locations don't change that frequently).

Mile High Club Challenge

A curated list of parkrun altitudes would be needed, so this would be a fixed set like 'The Full Ponty'

Recognise international tourism

For each parkrun country that has been visited, place a flag under the badges.

In the future these could be augmented with additional overlays to indicate geographic challenges within those countries which are valid across all the regions, e.g. visited the N,S,E,W parts of that country. This helps avoid the proliferation of country specific challenges, whilst crediting tourism within a country

Investigate supporting as Firefox extension too

Privacy reasons etc, some people prefer not to use Chrome.

Additional benefit that Firefox extensions also work (with care: https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Differences_between_desktop_and_Android) on Android, thus bringing it to mobile for Android users (though not for iOS because Apple doesn't permit it, I believe).

Note for anyone reading this and curious: We can't (personally) support Safari because we don't have iOS devices to test on or developer accounts/skills for iOS apps.

False claims of 'All parkruns completed'

A fresh load of the page may give the following unexpected output in the stats, namely that you have run every parkrun! -

screen shot 2018-06-29 at 21 56 15

This messages is set as the default value, here https://github.com/fraz3alpha/running-challenges/blob/master/browser-extensions/chrome/js/lib/challenges.js#L605, and remains in place unless there are some events not done, which are then asked for their distance away, and ordered by that value.

It seems that unless an event is marked 'Live', it is not added to the list, and a distance away is not computed. However, failing to fetch the Technical Event Information from the parkrun wiki would result in that 'live' status not being added, so instead maybe it should check a different way

Set up simple blog with GitHub Pages

To provide:

  • Link to extension on Chrome web store (inc where to give feedback)
  • Post of what's new in each release (for anyone interested)
  • 'About' - Brief background and ethos (inc criteria we use when deciding whether to include challenges)
  • A 'how to install and use the Chrome extension' for beginners.
  • Request for translations of certain strings (list of strings and screenshots of where they appear).
  • Link to GItHub issues
  • Link to give feedback (ie point to entry on Chrome Web Store).
  • Link to parkrun for people who've stumbled on this and are not already parkrunners!
  • Acknowledgements (UK parkrun tourist group, statsgeek group, parkrun!)
  • Reasons for 'Other' volunteer role (see Charlie's post)

Stats: Add 'Wilson Index'

As per https://www.facebook.com/groups/UKparkrunTourists/permalink/1525411560898692 the Wilson Index is defined as:

Alerted by uber tourist Dave Wilson, the Wilson Index involves the continuous number of event numbers. So if you ran an event from inaugural to the 10th event but missed the 11th event you’d have a WI of 10. However if you then ran the 11th event at another location you’d then have WI 11.

For example I have WI 22. http://www.parkrun.org.uk/resu…/athleteeventresultshistory/…

I’ve never ran the 23rd instance of any event.

This requires the merging of the feature to add Stats - #8 , which is currently reasonably far along in a branch

Add textual description to explain each of the challenges

Add as either hover help (on a ? icon maybe) or a link to click and expand.

Text description for each:

Tourist - Run at 20+ different parkrun locations anywhere in the world.
Cowell Club - Run at 100+ different parkrun locations anywhere in the world. Named after the first parkrunners to complete it.
Alphabeteer - Run at a parkrun locations starting with each letter of the English alphabet (except X).
Single-Ton - Run 100+ parkruns at the same location.
Double-Ton - Run 200+ parkruns at the same location.
Stopwatch Bingo - Collect all the seconds from 00 to 59 in your finishing times.
Pirates! - Run seven Cs and an R (say it out loud).
Stayin' Alive - Run three Bees and three Gees.
Compass Club - Run at a parkrun named after each of the four compass points.
The Full Ponty - Run at all the parkruns named ponty... or ponte...
Bushy Pilgrimage - Run at Bushy parkrun, where it all began.
NYD Double - Run two parkruns on one New Year's Day.
Groundhog Day - Finish with the same time at the same parkrun location on two consecutive parkrun weeks.
Regionnaire - Run all the parkrun locations in a geographical region.
Bronze Level Obsessive - Run 30+ parkruns in one calendar year.
Silver Level Obsessive - Run 40+ parkruns in one calendar year.
Gold Level Obsessive - Run 50+ parkruns in one calendar year.

Volunteer main heading (to be added) - Get a purple badge when you've done a role once, get a star for doing the role 5+ times, two stars for 10+ times, three stars for 25+ times.

Implement 'Stats'

There are lots of statistics that don't warrant an achievement that it would be useful to show, for example 'Number of parkruns done that no-longer run', or 'total distance ran' perhaps.

These would make for an interesting little section of stats below the challenges

General Suggestions

  • Total number of PBs
  • Consecutive PBs
  • Total Runs
  • Runs so far this year
  • Total Volunteer Roles
  • Distance Ran
  • Maximum number of runs in a year
  • Ratio of runs to events
  • Countries visited
  • Cumulative distance between parkruns week to week? an 'on tour' distance. It doesn't make sense to count two consecutive weeks in NZ as 20k+ each, but maybe 10k+200+10k back home
  • "p-value", x different parkruns at least x times
  • Years parkrunning
  • Different events run
  • Tourist index - the total number of events, divided by the number of parkruns - never repeating gets 100%

These would only make sense for the person who installed the extension

  • Furthest from home
  • Nearest Event Not Yet Done/Not Done Yet? NENYD/NENDY

Finish Token Bingo Challenge

From UK parkrun Tourists:

Colin Naman Great work :) I also track my finish token bingo i.e.0 to 99 but being a bit of a plodder I use the last 2 digits as my finish tokens are often in 3 figures :) I am on 81/100

This should be relatively straightforward to work out and most people would be able to make good progress through regular attendance.

Roadmap

v0.1 - 2018-03-10

First version, including running challenges only, and only on .org.uk

v0.2 - 2018-03-13

First update, which proved we could change the extension and people would get the update. Included Volunteer badges and extended to all English language parkrun websites

v0.3

Internationalisation: We have parkrunners using the extension from around the world, and we currently support the English language sites. We should at least support linking to their profile on the right site, and probably the setting of different alphabets for the alphabeteer challenge

  • Support non-English parkrun profile pages #38
  • Add drop down to choose home parkrun, and therefore country to link to #29
  • Add flags to indicate which parkrun countries you have run in #30
  • Remove parkruns that haven't yet started from the Regionnaire stats #28
  • Add Junior Warm-Up badge #26
  • Add Other badge #36
  • Half-Cowell challenge #31
  • Profiles with zero runs are missing our links #41

v0.4 - 2018-04-24

  • Add Malaysia Flags and support #59

v0.5 - 2018-06-24

Stats and maps!

  • Add stats #8

v0.5.1 -

Fix bugs in v0.5

  • #67 Fix missing obsessive and fraction cowell badges
  • #69 Fix stats for parkruns with no location
  • #70 Fix spelling

Extras

  • #73 Add additional translations (should have been added previously, but were missed)

Tests:

  • Check the fractional Cowell and obsessive badges appear on my profile
  • Check Black Combe doesn't make this profile go bad:

Running at events with no location inflates stats

Athlete A2522444 reported that if you have run at Black Combe (the prison parkrun, with no location on the map), it thinks it is at location 0,0 which inflates the distance calculations, and additionally counts as an extra country as it is 'unknown'

The Zoo Challenge

parkruns with Animals in their name.

Boksburg, Fishhoek, Grey Goose, Hartbeespoort, Heron Banks, Hogsback, Piggly Wiggly, Springbok, Walvis Bay, Beeston, Frog Hollow, Kangaroo Island, Oxford.

International list.

"years parkrunning" stat is wrong if you are in the birthday month

We have had a report of someone (A78647) who did their first parkrun in July, and with this month being July, and they had passed their birthday, it was showing one less year parkrun for them.

Looks like I have used .getDay() (which gives the day of the week) in the comparison, rather than .getDate() (which gives the day of the month), so maybe it works if you check on a Sunday :)

Add 'Southwalk Slam'

From a user via the feedback link:

Hello, this is great. Could you add the 'Southwark Slam' to it? The London Borough of Southwark is currently the only Borough to have 4 parkruns in it. The challenge is to run all 4 parkruns in the month of September. The order is Southwark Park (their anniversary), Peckham Rye, Dulwich and Burgess (their anniversary). The order is less important. Thanks

Noting this down for reference. It doesn't guarantee we'll add it - we are currently trying to work out how to manage hundreds of different challenges for parkrunners all over the world, and what criteria we can apply to make things achievable for everyone, and still usable, as the list increases.

Exclude prison events from Regionnaire challenge

Prison parkrun events are not publicly accessible and so can't be achieved by most parkrunners in trying to complete the region that includes the prison parkrun.

Probably have to do this based on a manual list because geo.xml doesn't identify prison parkruns. The only difference is that website homepage for the parkrun says it's not accessible to the public but that doesn't really help.

Grace period for Regionnaire status

add a grace period to regionaire status - ie, you can still count as a regionaire even if you haven't completed the parkruns that have started in the last week/fortnight/month/year. You might need to make that grace period adjustable in the options, though, as it'll only start an argument, er, discussion, if you pick the "wrong" figure.

yes, definitely need the grace period to avoid the inaugurals problem! 10 weeks is what was agreed on this page some years ago.

You should offer people several weeks grace when a new parkrun starts. This is necessary to prevent inaugural chasing in the UK.

AT: It sounds reasonable, but I'm not sure (off the top of my head) if we have the dates that the parkruns start to give that grace period - I'll have a look for you

https://www.facebook.com/groups/571983126241545/permalink/1443576439082205/?comment_id=1458387574267758&reply_comment_id=1458934414213074&comment_tracking=%7B%22tn%22%3A%22R9%22%7D

Filter out non-current parkruns

The geo.xml gets all parkruns currently known about, even those that haven't started yet.

http://wiki.parkrun.info/index.php/Technical_Event_Information lists what state a parkrun is in - either 'Live', 'Pending', or 'Accepting Registrations'. This messes up regionnaire calculations as many regions will be un-complete-able .

Given that we only fetch the geo.xml data every 3 days we can do an extra call to get and parse the wiki page and use that to filter out events that aren't 'Live' and keep that data on hand

Modify official 'summary stats' table to add 'median' column

Currently has a 'mean' column.

Fast runners who do tailwalking sometimes object to being scanned. As tailwalkers, I think they should be scanned so that parkrunners with slower times are never last in the results table and because, by parkrun ethos, there should not be a stigma attached to lower times.

However, perhaps the 'mean' stats undermines this slightly because it is affected by both fast and slow times. A 'median' stats column would avoid occasional unusual times and show a more representative average finish time, age-grade, etc.

image

Avoid linking to https which is malformed

The Byte-Order-Mark is displayed in the https pages of parkrun.org.uk, and the PB column has extra junk letters, so lets just link to http sites to avoid this mess until it is fixed at the source by parkrun HQ

Home Run

Quite a few parkrunners do not know what their Home Run is. Could the Home Run be put in with the Stats? The NENDY and Distance Travelled are based on the Home Run, so just above it? Voortrekker was closed for 18 months, but despite repeated appeals to people to change their Home Run, few actually did. I think that drawing attention to the Home Run on the Stats would serve as a reminder, that the stats are only accurate if the correct Home Run is registered.

Roadmap to v0.1

Version 0.1 will be the first to be widely published in the Chrome Web Store. To get to that version we need to make sure we have a few things that makes it easy to use so that first users don't get frustrated.

  • A nice help page
  • Sensible options page with instructions, also linking to the help page
  • Links from normal athlete pages to link to the one where the stats are displayed
  • Explicit alphabeteer alphabet selection, explaining why that is the one we are using, and what options there might be in the future
  • Google analytics to see if anyone is actually using the plugin
    • Added Google Analytics ID to the Web Store so we can track how many people are browsing it there

Celebrate Birthdays

  • There are several things we can inject for some fun to do with birthdays including:
    • Adding a badge to say you have been a parkrunner for 5,10, etc.. years (they are the only multiples of 5 currently available
    • Add stats to say how many years since they ran their first parkrun
    • Add balloons the week of their parkrun-aversary

Regionnaire challenge: Replace region-level tables with treemap

(All design and implementation is up for discussion and better suggestions. The aim is to reduce/simplify the display of Regionnaire tables and progress.)

Partially-implemented as hardcoded HTML file (based on data generated in challenges_ui.js) in branch regionnaire_treemap. Uses Google Charts treemap.

Outstanding issues

  • Need to aggregate value in fourth column of data table to be number of parkruns completed in that region even for the top-level regions (eg UK should show 24/518, not 0). The four columns in the data table are currently:

    • Region
    • Region parent
    • Number of available parkruns in the region
    • Number of parkruns completed in the region (I think this should be "Number of parkruns completed in the region and its sub-regions)
  • Link from (ie be replaced) by lowest level region (eg South West England in UK region, or just Canada which has no sub-regions) to a table of parkruns in that region instead of changing to a lower level of the treemap which doesn't tell you anything.

  • Scale the colour shading from zero to total available parkruns in that region, not from zero to current highest number (which I think is what it's doing at the moment so that 11/80 is showing a very strong green (max) when it's only about 8% of the total available in that region). This might be partly fixed by aggregating the number of parkruns under a region but not completely (I think!).

Design

When the results page loads, display treemap of world and top-level regions (UK, Australia, Canada, etc):

2018-03-11 22 05 11

When you click a region that has sub-regions (eg UK), get another level of treemap for the regions:
2018-03-11 22 05 37

When you click a region that does not contain sub-regions, replace the treemap with a table of the parkruns in that region:
2018-03-11 22 05 50

'Other' volunteer badge

This is an official volunteer role and seems to be credited to people who do one-off tasks that aren't recognised otherwise. Also, say, to a someone who assists a marshall but isn't credited as marshall in their own right for some reason.

Challenge ideas

To the nines ......... A count of all the run numbers that contain the number 9 (i.e, 9, 19, 29, 91, 92, etc) ........... this will take the pressure off inaugural attendance (stop people collecting number 1's) ............. first badge is achieved with a count of 9 !

Or alternatively, a count of all the run number 00's (100, 200, 300 etc, easier to programme than the anniversary runs ?) ..................... again will take the pressure off people chasing inaugurals............... will make you popular with HQ 󰀀

Stones........ all the event names containing 'stone' i.e Braunstone..... Stonehaven, Gladstone etc.

Boroughs......... all the event names containing 'borough' i.e Peterborough, Hillsborough, Market Harborough, Gainsborough etc

A badge for 375 runs.......... which fills in that long gap between the official 250 and 500 milestones ?

'Same Position' badge............ repeating the finishing number position on consecutive weeks, any venue !

Determine country flags from URL domain suffix

eg I have no French flag on my profile. I can only assume because Mandavit no longer exists?

Given a link still exists to the results which shows it was a .fr I would have thought it's possible for the extension to know you've been to France. https://www.facebook.com/groups/571983126241545/permalink/1458866500886532/?comment_id=1459454640827718&reply_comment_id=1460251737414675&comment_tracking=%7B%22tn%22%3A%22R9%22%7D

This would work as long as the parkrun sites don't get moved on to a single common domain. Would work for now anyway (which is the status of the extension itself...).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.