benkeen / generatedata

A powerful, feature-rich, random test data generator.
https://generatedata.com
2.22k stars 611 forks source link

Only country listed? Australia #381

Closed rpoelking closed 7 years ago

rpoelking commented 8 years ago

When running the plugins on startup, only Australia shows up as a country; where are the rest? I need United States!

benkeen commented 8 years ago

Wait, so you're saying Australia isn't the only country of significance in the world? Surely not. ;)

Hmm... haven't heard of this issue before, but it's conceivable it's a bug. Couple of things:

Also, can you complete the installation? I'm curious to see if the page actually works or not. I suspect not, so it would be interesting to see.

rpoelking commented 8 years ago

Well, as much as I admire Australia.... ;)

So, yes, the plugins countries folder is loaded with several countries. The install did in fact complete but I did not actually generate anything yet.

What page did you want a screenshot of?

mansoorjamal commented 8 years ago

Coincidently, I just ran into a similar issue, though the only country I can see is Germany.

I've attached screenshots to help diagnose the issue, including directory structure. They show the install steps showing only Germany, and the inability to select any other country after a successful deploy.

I have tried both the zip and tar files, as well as both with single user and no auth user (with proper cleanup including fully dropped and recreated mysql db).

I'd be happy to run any test for you, including file modifications and debugging.

Thanks for your help benkeen! install_success germany_drop_only only_germany

no_canada dir_structure

mansoorjamal commented 8 years ago

Ok, I think I have fixed the issue.

The easiest way to fix the problem is to remove, from plugins/countries, the following directories:

Turkey, Austria, Chile and China.

Countries will then show up properly. The one country showing up problem is actually dependent on the order your OS parses the countries the dir open call. The first one, if well parsed, is the one that shows up.

I think this has something to do with instantiateCountryPlugin returning false on errors (or elsewhere some other issue) - I did not have time to debug this part in detail.

Regardless, the underlying parse problem comes from the use of the field regionShort. In the region table, it is defined as char(3). However, for Turkey, Austria and Chile, the class file that defines the country and its regions uses regionShort values that are bigger than three characters.

This causes problems.

You can can either edit the class files manually and change regionShort values to be 3 character or less (wherever they are more than three characters in Turkey.class.php, Chile.class.php and Austria.class.php) or simply overwrite them with the attached ones in the countries_class.zip file to fix the issue.

Note that the China class file is ok, so to speak. It is fully commented out for now by the author, which is why China is not showing up in the list.

Regards,

Mansoor

country_class.zip

mansoorjamal commented 8 years ago

@benkeen If you give me checkin access to the repository, I'd be happy to check in the fix myself.

Thanks.

benkeen commented 8 years ago

Hey @mansoorjamal - thanks for posting the fix! And sorry for not responding earlier - it's been a hectic few days.

Yeah, I'd love to get a fix: for that just put in a PR and I'll merge in it.

Thanks!

endo64 commented 7 years ago

I also have same issue with the latest (v3.2.5) version.

Unfortunately the provided solution didn't work for me. I've downloaded and overwritten the country files with the above zipped files.

I still only see Australia, even if I remove China, Chile, Austria and Turkey from the plugins/countries folder.

benkeen commented 7 years ago

Hi @endo64, sorry it looks like that change didn't get in - we'll need a new release for this. In the meantime, I just patched it in master.

Try making this change so your local copy (it's in the resources/classes/Installation.class.php) and do a fresh install: https://github.com/benkeen/generatedata/commit/702b87b426d3795d6926d62da56fb7c12ff631a5

That should fix it... let me know how it goes and I'll release a new version of the script. There are a few changes should go in now.

Thanks!

Ben

endo64 commented 7 years ago

Hi, I've pulled from master and reinstalled. Now I can see all countries in the select box. But, when I generate City names it doesn't generate a list of cities in Turkey. IF I select City AND Region then it generates from Turkey's data. I don't know if this is an issue of the data in Turkey.class.php file or a generic problem.

Thank you for your support and great product.

glad2badad commented 7 years ago

Hmmm ... only seeing Australia also. I'm thankful this thread is posted ... I can at least try some of the fixes mentioned. Has anyone sorted this out 100% (I seen endo64 was still having an issue with it).

glad2badad commented 7 years ago

Ok. If anyone is still following this thread ... I changed the line of code in Installation.class.php file to: region_short char(35) CHARACTER SET utf8 DEFAULT NULL,

Then I had to figure out how to trick (reset) the install to allow it to run again. That required renaming the settings.php file and then dropping all tables in the database I was using for generatedata. After that, the install page came up ... when I finished with everything I had all of the Countries, instead of just Australia. :-)

endo64 commented 7 years ago

@glad2badad Making region_short char(35) solves the country list problem for Turkey. But I have another issue on generating City names, the generated city names are not from Turkey (Turkey.class.php) but from other countries (I guess). City names generated from Turkey only if I choose City AND Region. But I think I should raise another issue for that.

benkeen commented 7 years ago

Thanks everyone for the info - and sorry for the bug! I'll take a look at this this weekend,

benkeen commented 7 years ago

Gah, I see this issue was already patched - I just never rolled a fresh release. K, I'll do so tonight. Apologies, all!

@endo64 regarding your issue, are you including a region field in your dataset? It's not terribly clear (my bad) but I think that region is required in order to show the subset of cities for a particular country. I'd actually consider this a bug, really... if you have selected Turkey and added a "City" Data Type, I think reasonably it should only show cities in Turkey. Feel free to create a bug & I'll assign it to the next release. Thanks!

endo64 commented 7 years ago

Thank you @benkeen I raised another issue for it #414