From db91f73085821504a60e64c15a68ae52b704a77e Mon Sep 17 00:00:00 2001 From: Adickes Date: Thu, 29 Oct 2015 15:09:28 -0400 Subject: [PATCH] fix build steps --- data/v2/build.py | 182 +++++++++++++++++++++++------------------------ 1 file changed, 91 insertions(+), 91 deletions(-) diff --git a/data/v2/build.py b/data/v2/build.py index 2063076d..a11f9060 100644 --- a/data/v2/build.py +++ b/data/v2/build.py @@ -1550,6 +1550,97 @@ for index, info in enumerate(data): +############## +# LOCATION # +############## + +clearTable(Location) +data = loadData('locations.csv') + +for index, info in enumerate(data): + if index > 0: + + model = Location ( + id = int(info[0]), + region = Region.objects.get(pk = int(info[1])) if info[1] != '' else None, + name = info[2] + ) + model.save() + + +clearTable(LocationName) +data = loadData('location_names.csv') + +for index, info in enumerate(data): + if index > 0: + + model = LocationName ( + location = Location.objects.get(pk = int(info[0])), + language = Language.objects.get(pk = int(info[1])), + name = info[2] + ) + model.save() + + +clearTable(LocationGameIndex) +data = loadData('location_game_indices.csv') + +for index, info in enumerate(data): + if index > 0: + + model = LocationGameIndex ( + location = Location.objects.get(pk = int(info[0])), + generation = Generation.objects.get(pk = int(info[1])), + game_index = int(info[2]) + ) + model.save() + + +clearTable(LocationArea) +data = loadData('location_areas.csv') + +for index, info in enumerate(data): + if index > 0: + + model = LocationArea ( + id = int(info[0]), + location = Location.objects.get(pk = int(info[1])), + game_index = int(info[2]), + name = info[3] + ) + model.save() + + +clearTable(LocationAreaName) +data = loadData('location_area_prose.csv') + +for index, info in enumerate(data): + if index > 0: + + model = LocationAreaName ( + location_area = LocationArea.objects.get(pk = int(info[0])), + language = Language.objects.get(pk = int(info[1])), + name = info[2] + ) + model.save() + + +clearTable(LocationAreaEncounterRate) +data = loadData('location_area_encounter_rates.csv') + +for index, info in enumerate(data): + if index > 0: + + model = LocationAreaEncounterRate ( + location_area = LocationArea.objects.get(pk = int(info[0])), + encounter_method = None, + version = Version.objects.get(pk = int(info[2])), + rate = int(info[3]) + ) + model.save() + + + ############# # POKEMON # ############# @@ -1952,97 +2043,6 @@ for index, info in enumerate(data): -############## -# ENCOUNTER # -############## - -clearTable(Location) -data = loadData('locations.csv') - -for index, info in enumerate(data): - if index > 0: - - model = Location ( - id = int(info[0]), - region = Region.objects.get(pk = int(info[1])) if info[1] != '' else None, - name = info[2] - ) - model.save() - - -clearTable(LocationName) -data = loadData('location_names.csv') - -for index, info in enumerate(data): - if index > 0: - - model = LocationName ( - location = Location.objects.get(pk = int(info[0])), - language = Language.objects.get(pk = int(info[1])), - name = info[2] - ) - model.save() - - -clearTable(LocationGameIndex) -data = loadData('location_game_indices.csv') - -for index, info in enumerate(data): - if index > 0: - - model = LocationGameIndex ( - location = Location.objects.get(pk = int(info[0])), - generation = Generation.objects.get(pk = int(info[1])), - game_index = int(info[2]) - ) - model.save() - - -clearTable(LocationArea) -data = loadData('location_areas.csv') - -for index, info in enumerate(data): - if index > 0: - - model = LocationArea ( - id = int(info[0]), - location = Location.objects.get(pk = int(info[1])), - game_index = int(info[2]), - name = info[3] - ) - model.save() - - -clearTable(LocationAreaName) -data = loadData('location_area_prose.csv') - -for index, info in enumerate(data): - if index > 0: - - model = LocationAreaName ( - location_area = LocationArea.objects.get(pk = int(info[0])), - language = Language.objects.get(pk = int(info[1])), - name = info[2] - ) - model.save() - - -clearTable(LocationAreaEncounterRate) -data = loadData('location_area_encounter_rates.csv') - -for index, info in enumerate(data): - if index > 0: - - model = LocationAreaEncounterRate ( - location_area = LocationArea.objects.get(pk = int(info[0])), - encounter_method = None, - version = Version.objects.get(pk = int(info[2])), - rate = int(info[3]) - ) - model.save() - - - ############### # ENCOUNTER # ###############