Skip to content
This repository has been archived by the owner on Mar 3, 2020. It is now read-only.

Level Import: Random ISO Code #588

Open
JamesClick opened this issue Oct 23, 2017 · 4 comments
Open

Level Import: Random ISO Code #588

JamesClick opened this issue Oct 23, 2017 · 4 comments

Comments

@JamesClick
Copy link

I'm trying to batch import levels into my instance, while I don't have an ISO code for each one, is there a way to randomly assign an ISO code to each level like the Admin Interface allows (Selecting Auto in the drop down)?

(Commit 1f236bb Production on 16.04)

@TheSeraph
Copy link

I've been wondering this myself. It would really save a LOT of time.

@justinwray
Copy link
Contributor

@ItsDaGeek / @TheSeraph

Can you please explain the process you are using to batch import the levels?

Assuming you are creating a JSON file for importation with the Import Levels feature inside of the Admin Control pane, you are correct in that there is no method (currently) to random select a country.

However, this would be an easy update. Within the liveimport script we utilize the following:

        $countries = await Country::genAllAvailableCountries();
        $new_country = $countries[array_rand($countries)];

This provides a random, unused, country. This functionality could be moved into the Country class, and the importAll method within the Level class could be updated to provide a random country when one is not provided or the value is set to 'Auto'.

Feel free to provide a PR with this enhancement, or we can certainly add it to the roadmap.

@mptap
Copy link

mptap commented Nov 19, 2017

@justinwray: Please could you review? #598

@justinwray
Copy link
Contributor

@mptap

Your PR looked great with one minor nit. Take a look at the comment on the PR itself. You will also need to resubmit the PR against the dev branch.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants