Jump to content

Sports team management


Tyssen
 Share

Recommended Posts

I built a website for a football club in PW a while back and am now contemplating extending it further to enable the club to manage the organisation of their junior teams.

Currently, registrations are taken on another site and then XLS files are exported and then split up into different age groups and sent to each age group coordinator who then moves stuff around in Excel to create the teams and then when they're finalised, XLSs are uploaded to a shared Dropbox folder. So a bit of a clunky system.

What I'd like to do with PW would be to take a single CSV exported from the registration system and be able to import it into PW as a master list of all registered players. Fields in the CSV would be name, date of birth, gender, football federation ID etc.

Based on the date of birth of the player they'd then appear under the age group for each coordinator (who when they login would only be able to see players/teams related to their age group), and then the coordinators would be able to drag players around to move them into teams.

So I think the page tree would look something like:

Age group
- Team 1
-- Player 1
-- Player 2
-- Player 3

Super admins for the system would be able to access all players and update things like whether they've paid or not (payments done offline) or whether proof of age has been sighted. They'd be able to filter on players who hadn't paid/shown proof of age, so that they could easily create a list of people to contact.

As registrations happen over time, it would also be good if we could import a new CSV whenever we liked and just have it update existing entries and add new ones, rather than having to only export new entries from the registration system.

I'm thinking that PW's page tree and it's ability to drag pages would handle the requirement to be able to move players between teams, but don't really know how to go from importing a CSV to splitting the players up amongst the different age groups.

Do you think this is something that PW can handle? And how would I go about it?

Link to comment
Share on other sites

PW can definitely handle it, the API is ideal for this type of data import and updating.

If i understand correctly, you'd need to code up an import script to read the CSV records, and create or update your pages... i do a lot of CSV imports when building sites to get data populated from client's spreadsheets.

there should be code on the forum for importing CSV files, creating or updating pages...

Link to comment
Share on other sites

I've seen https://modules.processwire.com/modules/import-pages-csv/ which would get all the data in there to start with, but do you know if that would that work for updating or ignoring existing entries or would it overwrite everything? And on import, how would I go about assigning players to different age group pages based on their date of birth?

Or would it be better to use the import module to import players into a single parent and then create another script which uses the API to copy all those pages into age group categorised pages, e.g.

Uncategorised page
- Player 1
- Player 2
- Player 3

Run script produces…

Age 1 page
- Player 1
- Player 2
Age 2 page
- Player 1
- Player 2

Link to comment
Share on other sites

23 minutes ago, Tyssen said:

but do you know if that would that work for updating or ignoring existing entries or would it overwrite everything?

There is an option in the ImportPagesCSV module for that:

2018-03-09_162952.png.fbd1857e1626aada1bad9914d7cf5d20.png

24 minutes ago, Tyssen said:

And on import, how would I go about assigning players to different age group pages based on their date of birth?

ImportPagesCSV can't do that for you, but after the data is imported you could loop over the pages and do the group assignment via the API.

Or you could write your own API script for importing the CSV data and do the group assignment as you import. Below is a link to an action for @adrian's AdminActions module that will take a CSV file from a file field and loop over the rows.

 

  • Like 2
Link to comment
Share on other sites

I've tested the import module and it gets the data in there OK. You have to choose a page parent to import the entries to and it only checks that parent for existing entries which means that after you've moved your pages into age groups, you can't really do a bulk update again, but you'd have to split your CSV up into different age groups and import individually into each age group parent. Unless I'm missing something?

Link to comment
Share on other sites

Looking at the AdminActions module you've linked to it has a Page Manipulator action which I can use to move pages to a certain parent based on the contents of a field. So in my case, I can use the date of birth field and choose age group pages to move to.

Link to comment
Share on other sites

1 hour ago, Tyssen said:

Looking at the AdminActions module you've linked to

The key thing about the AdminActions module is that you can easily write your own actions to do exactly what you need. Take one of the existing actions as a starting point, rename and save it to /site/template/AdminActions/ - easy to build and easy to access.

  • Like 1
Link to comment
Share on other sites

I think the included actions pretty much cover everything I need to do already. ?

One other thing we'd like to do is to solve some email deliverability issues we have. At the moment age group coordinators are just using normal email, i.e. Outlook etc and putting people's email addresses in CC or BCC fields. When you're sending to 50+ people though you can run into trouble and find that some people don't get the email.

Email Batcher seems like it'd do the trick but the Pages selector lets you choose fields, subfields etc, but not an actual page selector if I wanted to choose the children of a certain page. For instance, if I have a Under 10s page which has 60 child pages which all have an email field, what would it need to look like if I were to modify EmailBatcher.action.php?

And we're using WireMail Mailgun on this site. Will it hook into that or does it just use PW's default mail functions?

Link to comment
Share on other sites

24 minutes ago, Tyssen said:

but not an actual page selector if I wanted to choose the children of a certain page.

It is a page selector. See this example of selecting all pages with a certain parent. Note that you can click on "show" to see the matches to confirm they are what you expect.

image.png.9993b7f0adfc6bbcad28672ea9c416dc.png

25 minutes ago, Tyssen said:

And we're using WireMail Mailgun on this site. Will it hook into that or does it just use PW's default mail functions?

It uses the WireMail class which the Mailgun module extends so it should send through that.

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...