I want to set up a competition scoring site for horse competitions.
Each competition has many classes
Each class has 3 disciplines (show jumping, dressage and cross-country) that are scored independently of each other and totaled to create a final score with intermediary scores and placings after each discipline.
Each class has many horses
Each horse has a single rider
Each rider can ride multiple horses in all classes.
I would like to have custom fields for classes, riders, horses and competitions to store data relating to each item which suggests 4 custom-post-types for classes, riders, horses and competitions.
The only simple relationship is that each horse can only be ridden in one class.
Can I create many to many to many relationships? Or is that the wrong way to look at this.
I want to be able to show:
- which horses a rider is riding
- Which classes a horse is in
- The competitors in each class with running scores showing the placings in that class
Finally I will have multiple Competitions.
I'm slightly at a loss how to build this either with plugins or otherwise.
I want to set up a competition scoring site for horse competitions.
Each competition has many classes
Each class has 3 disciplines (show jumping, dressage and cross-country) that are scored independently of each other and totaled to create a final score with intermediary scores and placings after each discipline.
Each class has many horses
Each horse has a single rider
Each rider can ride multiple horses in all classes.
I would like to have custom fields for classes, riders, horses and competitions to store data relating to each item which suggests 4 custom-post-types for classes, riders, horses and competitions.
The only simple relationship is that each horse can only be ridden in one class.
Can I create many to many to many relationships? Or is that the wrong way to look at this.
I want to be able to show:
- which horses a rider is riding
- Which classes a horse is in
- The competitors in each class with running scores showing the placings in that class
Finally I will have multiple Competitions.
I'm slightly at a loss how to build this either with plugins or otherwise.
Share Improve this question asked Apr 17, 2020 at 4:39 M1 Creative DeveloperM1 Creative Developer 1231 gold badge1 silver badge8 bronze badges1 Answer
Reset to default 1I’m building something similar... I’ll explain my logic but keep in mind that this Question and my subsequent Answer may get downvoted because it’s all vague and theoretical and technically there’s probably more than one way to do it, so accepting the correct answer will be difficult. Anyway...
I’m building a soccer league management tool and the many-to-many relationship works along the same lines.
So what I did was try to flesh out the different relationships on paper and then determine which of them are custom taxonomies and which of them are custom post-types.
Off the top I would think that your classes (dressage, cross-country, etc.) would be taxonomies
The riders and horse can share the taxonomy, and could be custom post-types.
Not sure how much data you’re placing into the “Competitions” but that could be a taxonomy as well, unless you have to do a lot of work with them, then they’d need to be a CPT.
So, on a simple stream... I’d say you could set Rider A and Horse 12. Then assign them a their Class taxonomies. So both Rider A and Horse 12 are participating in Dressage.
Now, if the Competition is a taxonomy as well, let’s say the “Summer Sunrise Competition”, you can then assign that to both Rider and Horse.
Once you save the post, you could then generate a custom meta on either Rider or Horse (your choice depending on operational logic and internal processing)... that custom meta would take every combination of taxonomies and ask you to associate an entry from the other CPT.
So, let’s say you assign horses to riders most commonly...
You’d have the Rider A CPT.
Dressage Class Cross Country Class
Summer Sunrise Comp.
That would generate, after saving, 2 custom fields, where you would then assign a horse.
Rider A -> Dressage -> Summer Sunrise Comp. -> Riding Horse 12
Rider A -> Cross Country -> Summer Sunrise Comp. -> Riding Horse 8
Then on the CPT Post for Horse 12 & Horse 8, you’d provide a similar logic, except instead of letting the user input the Rider, you’d query the Riders based on matching taxonomies, and see who has Horse 12 assigned and then put a link to their CPT Rider Post.
(The above is all admin stuff.)
Anyway, without knowing all about the sport, that’s a basic outline of how I’d approach it.)