add first energy meta

This commit is contained in:
2025-12-11 00:52:57 +00:00
parent 8a3fb0545c
commit 0b921ae933
5 changed files with 20 additions and 20 deletions

View File

@@ -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