Fix ruby cities
Fix transfer order
This commit is contained in:
parent
956aae281f
commit
1841da0097
File diff suppressed because one or more lines are too long
|
|
@ -242,7 +242,7 @@ def migrate_city_photos():
|
||||||
# Update location models with ruby library
|
# Update location models with ruby library
|
||||||
# Utils functions defined before transfer functions
|
# Utils functions defined before transfer functions
|
||||||
def get_ruby_socket(params):
|
def get_ruby_socket(params):
|
||||||
url = 'http://172.26.0.1:5678' # docker host
|
url = 'http://172.29.0.1:5678' # docker host
|
||||||
response = get(url, params=params)
|
response = get(url, params=params)
|
||||||
try:
|
try:
|
||||||
data = json.loads(response.text)
|
data = json.loads(response.text)
|
||||||
|
|
@ -285,11 +285,11 @@ def get_ruby_data():
|
||||||
if ruby_response is None:
|
if ruby_response is None:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if "error" in ruby_response or "country" not in ruby_response:
|
if "country" not in ruby_response.keys():
|
||||||
error_file.write(f"{json.dumps(ruby_params)}: {json.dumps(ruby_response)}\n")
|
error_file.write(f"{json.dumps(ruby_params)}: {json.dumps(ruby_response)}\n")
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if mysql_city.country_code_2 is None:
|
if mysql_city.country_code_2 is None and mysql_city.country_code is None:
|
||||||
error_file.write(f"{json.dumps(ruby_params)}: {json.dumps(ruby_response)}\n")
|
error_file.write(f"{json.dumps(ruby_params)}: {json.dumps(ruby_response)}\n")
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
|
@ -307,7 +307,7 @@ def get_ruby_data():
|
||||||
"is_island": True if mysql_city.is_island is not None and mysql_city.is_island > 0 else False,
|
"is_island": True if mysql_city.is_island is not None and mysql_city.is_island > 0 else False,
|
||||||
|
|
||||||
"postal_code": mysql_city.zip_code.strip() if mysql_city.zip_code is not None else '',
|
"postal_code": mysql_city.zip_code.strip() if mysql_city.zip_code is not None else '',
|
||||||
"code": mysql_city.country_code_2.lower().strip()
|
"code": ruby_response['country']['code'].lower().strip()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -739,7 +739,7 @@ data_types = {
|
||||||
# transfer_countries,
|
# transfer_countries,
|
||||||
# transfer_regions,
|
# transfer_regions,
|
||||||
# transfer_cities,
|
# transfer_cities,
|
||||||
# transfer_addresses,
|
transfer_addresses,
|
||||||
transfer_wine_region,
|
transfer_wine_region,
|
||||||
transfer_wine_sub_region,
|
transfer_wine_sub_region,
|
||||||
transfer_wine_village,
|
transfer_wine_village,
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
./manage.py transfer -a
|
./manage.py transfer -a
|
||||||
|
./manage.py transfer --setup_clean_db
|
||||||
./manage.py transfer -d
|
./manage.py transfer -d
|
||||||
./manage.py transfer -e
|
./manage.py transfer -e
|
||||||
./manage.py transfer -n
|
./manage.py transfer -n
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user