add first energy meta
This commit is contained in:
Binary file not shown.
@@ -144,20 +144,25 @@ class GwtRpcCountyProvider(GwtRpcBaseProvider, BaseCountyProvider):
|
||||
if stream[i] == region_type_id:
|
||||
try:
|
||||
p = i + 1
|
||||
served = 0
|
||||
out = 0
|
||||
|
||||
# Check for served customers, ensuring we don't read past the end of the stream
|
||||
served = stream[p] if p + 1 < len(stream) and stream[p+1] == integer_type_id else 0
|
||||
p += 2 # Always advance past value and type ID
|
||||
|
||||
# Check for customers out
|
||||
out = stream[p] if p + 1 < len(stream) and stream[p+1] == integer_type_id else 0
|
||||
p += 2 # Always advance past value and type ID
|
||||
|
||||
# Check for served customers. Only advance pointer if found.
|
||||
if p + 1 < len(stream) and stream[p+1] == integer_type_id:
|
||||
served = stream[p]
|
||||
p += 2
|
||||
|
||||
# Check for customers out. Only advance pointer if found.
|
||||
if p + 1 < len(stream) and stream[p+1] == integer_type_id:
|
||||
out = stream[p]
|
||||
p += 2
|
||||
|
||||
name_idx, cat_idx = stream[p], stream[p+1]
|
||||
|
||||
if cat_idx == county_type_id:
|
||||
name = string_table[name_idx - 1] if 0 < name_idx <= len(string_table) else "Unknown"
|
||||
results.append({'county': name, 'state': self.state_filter, 'company': self.name, 'outages': out, 'served': served})
|
||||
i = p + 1 # Advance main loop counter past this processed region
|
||||
except IndexError: pass
|
||||
i += 1
|
||||
return results
|
||||
|
||||
Reference in New Issue
Block a user