This is the main parent task for all work related the 'country selection' feature. Subtasks and more detail will be added here after the final plan has been confirmed.
**This option is only applicable for campaigns that have been set as a "Wiki Loves campaign" by the campaign manager** (a tick box option on the Create/Update pages).
When the manager sets this option, they must **only include 'main' Wiki Loves categories** in the campaign settings. The system must assume that it will find ONLY country subcategories directly within the chosen categories. The country name can then be found as the final word in the category name.
**USER INTERFACE**
- Tick box on the Create/Update campaign pages to allow manager to set as a "Wiki Loves" campaign
- A dropdown option is shown on the Campaign page, allowing the user to optionally choose single country to work during their Participate session (triggered when they click the 'get started' button).
**EXTRACTION LOGIC**
**When user arrives on the Campaign page**:
- Use the [[ https://www.mediawiki.org/wiki/API:Categorymembers | category members API call ]] to find the direct subcategories each Campaign category (using //cmtype=subcat// parameter)
- Combine **all countries** found from each Campaign category into a single **unique ** list of countries
- For each category in the combined list, take ONLY the text after "[root category name] in " to get the actual country names. If this text is not found, remove the cateogry from the list as it means it is not a country subcategory (e.g. [https://commons.wikimedia.org/wiki/Category:Images_from_Wiki_Loves_Africa_2019|Images Wiki Loves Africa 2019] has a non country category listed first)
- Sort alphabetically and use to populate the <select> dropdown the top of the page (with "all countries" always added as the first option)
**When user starts a Participate Campaign session**:
- check value selected in country dropdown
- If the user has selected a country, we only search in that country subcategory when live generating the list to work on (instead of the /root/ category chosen in the campaign settings). As the campaign may have **multiple** root Wiki-Loves categories, we need to combine the results from each category.
e.g. If campaign categories are "Images from Wiki Loves Africa" and "Images from Wiki Loves art" and the user selects "Nigeria" from the dropdown, we need to:
# Query contents of "Nigeria" subcategory in "Images from Wiki Loves Africa"
# Query contents of "Nigeria" subcategory in "Images from Wiki Loves art"
# Combine the results into the participate list to work on and load the first image