Merge pull request #19355 from rallytime/bp-19247

Backport #19247 to 2014.7
This commit is contained in:
Thomas S Hatch 2015-01-06 10:17:27 -07:00
commit 2775737859

View File

@ -437,23 +437,21 @@ class Compiler(object):
continue
chunk_order = chunk['order']
if 'name_order' in chunk:
chunk_order = chunk_order + chunk['name_order']
if chunk_order > cap - 1 and chunk_order > 0:
cap = chunk_order + 100
for chunk in chunks:
if 'order' not in chunk:
chunk['order'] = cap
else:
if isinstance(chunk['order'], int) and 'name_order' in chunk:
chunk['order'] = chunk['order'] + chunk.pop('name_order')
if not isinstance(chunk['order'], int):
continue
if not isinstance(chunk['order'], (int, float)):
if chunk['order'] == 'last':
chunk['order'] = cap + 1000000
else:
chunk['order'] = cap
elif isinstance(chunk['order'], int) and chunk['order'] < 0:
if 'name_order' in chunk:
chunk['order'] = chunk['order'] + chunk.pop('name_order') / 10000.0
if chunk['order'] < 0:
chunk['order'] = cap + 1000000 + chunk['order']
chunks.sort(key=lambda chunk: (chunk['order'], '{0[state]}{0[name]}{0[fun]}'.format(chunk)))
return chunks
@ -1034,25 +1032,23 @@ class State(object):
continue
chunk_order = chunk['order']
if 'name_order' in chunk:
chunk_order = chunk_order + chunk['name_order']
if chunk_order > cap - 1 and chunk_order > 0:
cap = chunk_order + 100
for chunk in chunks:
if 'order' not in chunk:
chunk['order'] = cap
else:
if isinstance(chunk['order'], int) and 'name_order' in chunk:
chunk['order'] = chunk['order'] + chunk.pop('name_order')
if not isinstance(chunk['order'], int):
continue
if not isinstance(chunk['order'], (int, float)):
if chunk['order'] == 'last':
chunk['order'] = cap + 1000000
else:
chunk['order'] = cap
elif isinstance(chunk['order'], int) and chunk['order'] < 0:
if 'name_order' in chunk:
chunk['order'] = chunk['order'] + chunk.pop('name_order') / 10000.0
if chunk['order'] < 0:
chunk['order'] = cap + 1000000 + chunk['order']
chunks.sort(key=lambda k: (k['order'], '{0[state]}{0[name]}{0[fun]}'.format(k)))
chunks.sort(key=lambda chunk: (chunk['order'], '{0[state]}{0[name]}{0[fun]}'.format(chunk)))
return chunks
def compile_high_data(self, high):