Creating the relation between build_costs and build_wares is done in get_build_cost(). Retrieving build_wares is done through a query:
for c, w in zip(count, self.build_wares.all()):
yield [w] * c
and the query ( self.build_wares.all() ) returns the build_wares in a different order than stored in build_costs. So for atlantean Armor Smithy the result is: build_costs are '2 1 2 2' and the query returns: granite log planks quartz. The result is:
I currently don't know how to solve this. Since there is a possibility to get a default ordering of queries, we may have to make sure the values of build_costs are stored in the same order, say alphabetical depending on the name of ware? I think this would be just a workaround...
The problem here is that there is no relation between build_costs and build_wares. The values get stored into the database in different fields:
# Build cost ManyToManyField ( name='build_ ware_for_ buildings' , blank=True) CharField( max_length= 100, blank=True)
build_wares = models.
Ware, related_
# ' '.joined() integer strings
build_costs = models.
Creating the relation between build_costs and build_wares is done in get_build_cost(). Retrieving build_wares is done through a query:
for c, w in zip(count, self.build_ wares.all( )):
yield [w] * c
and the query ( self.build_ wares.all( ) ) returns the build_wares in a different order than stored in build_costs. So for atlantean Armor Smithy the result is: build_costs are '2 1 2 2' and the query returns: granite log planks quartz. The result is:
buildcost / query order
2 / Granite
1 / Log
2 / Planks
2 / Quartz
I currently don't know how to solve this. Since there is a possibility to get a default ordering of queries, we may have to make sure the values of build_costs are stored in the same order, say alphabetical depending on the name of ware? I think this would be just a workaround...