=== Auto Fixture Generator for SportsPress ===
Contributors: savvasha
Tags: sportspress, fixtures, schedule, roundrobin, events
Requires at least: 5.3
Tested up to: 6.9
Requires PHP: 7.4
Stable tag: 1.9
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Stop spending hours manually scheduling fixtures. Let your SportsPress league build itself automatically.

== Description ==

Stop spending hours manually scheduling fixtures. Auto Fixture Generator for SportsPress builds a complete, balanced match schedule for your league in seconds — so you can focus on the game, not the spreadsheet.

Whether you are managing a simple round-robin tournament or a professional season with complex scheduling rules, this plugin integrates seamlessly with SportsPress and takes care of fixture creation for you.

Used by football clubs, futsal leagues, basketball associations and amateur tournament organisers worldwide.

[youtube https://youtu.be/YF2CS6T0Cu0]

**Free features — no strings attached:**
* Single Round Robin algorithm — every team plays each other once.
* Select your League, Season and Start Date.
* Define a naming template for gameweeks/matchdays (e.g. "Gameweek 1", "Gameweek 2", etc.).
* Automatically create calendar and league table entries in SportsPress.
* All teams in the selected season are included by default.
* Debug / Dry Run mode — preview the full schedule before committing anything to the database.

**Running a more complex league? [Go Premium.](https://savvasha.com/auto-fixture-generator-for-sportspress-premium/?utm_source=wp-org&utm_medium=readme&utm_campaign=afgsp&utm_content=mid-cta)**

**Premium — full control over your season:**
* Double Round Robin algorithm — every team plays home and away against every other team.
* Custom Gameweeks Algorithm — define exactly how many gameweeks your season has. Matches are distributed as evenly as possible, with full support for non-standard structures.
* League Phase algorithm — split teams into customisable "pots" and define how many opponents from each pot each team must face. Ideal for UEFA-style group phases, seeded draws and complex tournament formats.
* Schedule morning, afternoon and evening kick-offs on the same date with multiple time slots per match day.
* Block holidays, cup weekends or any unavailable dates — the generator never schedules over them.
* Hand-pick exactly which teams enter the draw — ideal for cup rounds, invitationals or partial season restarts.
* Randomise team order at generation time for fair, unpredictable draws every time.
* Built-in home/away balancing prevents teams from facing unfair consecutive away runs.

With the Premium upgrade you get full flexibility and professional scheduling capability — perfect for clubs, leagues and tournament organisers who demand complete control over their season structure.

[Upgrade to Premium →](https://savvasha.com/auto-fixture-generator-for-sportspress-premium/?utm_source=wp-org&utm_medium=readme&utm_campaign=afgsp&utm_content=bottom-cta)

== Installation ==

1. Upload the `auto-fixture-generator-for-sportspress` folder to the `/wp-content/plugins/` directory.
2. Activate the plugin through the "Plugins" menu in WordPress.
3. Ensure the SportsPress plugin is installed and active.
4. Go to SportsPress → Events → Auto Fixture Generator to create new fixtures.
5. Use Debug / Dry Run mode to preview your schedule before saving.

== Frequently Asked Questions ==

= Do I need SportsPress installed? =
Yes — this plugin is an add-on for SportsPress and uses its Leagues, Seasons, Teams and Events.

= Can I pick which teams take part? =
Team selection is only available in the Premium version. [See Premium features →](https://savvasha.com/auto-fixture-generator-for-sportspress-premium/?utm_source=wp-org&utm_medium=faq&utm_campaign=afgsp&utm_content=faq-teams)

= Is Double Round Robin supported? =
Yes — but only in the Premium version. [See Premium features →](https://savvasha.com/auto-fixture-generator-for-sportspress-premium/?utm_source=wp-org&utm_medium=faq&utm_campaign=afgsp&utm_content=faq-drr)

= How does the League Phase algorithm work? =
The League Phase algorithm (Premium) lets you split teams into customisable "pots" or groups, and specify how many opponents from each pot a team must play. This allows creation of advanced league structures similar to UEFA tournaments or other professional scenarios. You can assign teams to different pots, set the number of pots and opponents-per-pot in the generator, and the plugin will generate fixtures accordingly. Teams not assigned to any pot will be excluded from generation. This algorithm is ideal for complex group phases, seeding processes, or custom round design.

[Learn more about Premium →](https://savvasha.com/auto-fixture-generator-for-sportspress-premium/?utm_source=wp-org&utm_medium=faq&utm_campaign=afgsp&utm_content=faq-league-phase)

= Will the plugin automatically create events and the table? =
Yes. The plugin creates fixtures as SportsPress events and updates the league table accordingly.

= Where are the fixtures stored? =
Fixtures are created as SportsPress events and are stored in your WordPress database like any other SportsPress content.

= What is the Debug / Dry Run mode? =
When WP_DEBUG and WP_DEBUG_LOG are enabled, you can simulate fixture generation without writing anything to the database. The full schedule is shown in the debug log so you can verify it before committing.

= Can I upgrade from free to Premium later without losing any data? =
Yes — upgrading is seamless. Your existing leagues, seasons and generated fixtures are never touched. Simply install the Premium version over the free one and everything carries over intact.

= What license options are available for Premium? =
Visit the [Premium page](https://savvasha.com/auto-fixture-generator-for-sportspress-premium/?utm_source=wp-org&utm_medium=faq&utm_campaign=afgsp&utm_content=faq-license) for current pricing and available license tiers.

== Screenshots ==

1. Generator screen with algorithm selection and options (part1)
2. Generator screen with algorithm selection and options (part2)
3. Generator screen with algorithm selection and options (part3)
4. Successful creation of events
5. Debug / Dry Run mode available if needed.

== Changelog ==

= 1.9 =
* NEW: Fixture Summary Card

= 1.8 =
* FIX: Timeslot balancing is now fairer between teams.
* FIX: Premium algorithm files now correctly loaded when available.
* IMPROVEMENT: Improved plugin dependency checks and initialization logic.
* MISC: Codebase cleanup and small documentation updates.

= 1.7 =
* FIX: Teams were not auto-assigned to league tables.

= 1.6 =
* NEW: League Phase Algorithm (Premium only) — supports advanced "pot-based" group phase scheduling, customizable pots and cross-pot opponents.
* FIX: Improved compatibility with newer SportsPress version.
* FIX: Improved JavaScript event/option validation for smoother UI experience.
* FIX: Minor scheduling bug fixes, description line formatting, and usability improvements.

= 1.5 =
* NEW: Events per timeslot mode - AUTO calculates optimal distribution, MANUAL lets you set custom limits per slot (Premium version only)
* NEW: Algorithm-specific options now displayed in dry run debug log (e.g. Season Weeks for Fixed Week Season)
* FIX: Dry run mode now uses the same scheduling logic as normal mode, ensuring consistent fixture results.
* FIX: Fixed Week Season algorithm now generates correct number of gameweeks (rematches no longer incorrectly removed)
* FIX: Gameweeks no longer share dates - each gameweek properly advances to the next week period

= 1.4 =
* NEW: Debug / Dry Run mode - simulate fixture generation without database changes when WP_DEBUG and WP_DEBUG_LOG are enabled
* FIX: Teams no longer scheduled multiple times per gameweek with odd team counts
* FIX: Double Round Robin now correctly reverses home/away in second half (Premium version only)
* FIX: Improved home/away balance in Single Round Robin algorithm

= 1.3 =
* NEW: Custom Gameweeks algorithm allowing user-defined number of gameweeks (Premium version only)
* FIX: Skip duplicate checking for algorithms that allow rematches
* FIX: Properly advance to next week when gameweek changes
* FIX: Handle week-boundary-crossing gameweeks (Sat-Sun, Fri-Sat-Sun, etc.)
* UI: Add number input support, dynamic events description update

= 1.2 =
* Update Freemius SDK to 2.13.

= 1.1 =
* FIX: Gameweek names are not assigned correctly to generated fixtures.
* FIX: Calendar and League Table is not created.

= 1.0 =
* Initial release.

== Upgrade Notice ==

= 1.9 =
Adds a Fixture Summary Card showing a preview of the generated schedule before saving.

= 1.8 =
Fixes timeslot balancing and premium algorithm loading. Recommended update for all users.
