Shadow-mode client script and cutover doc correction
This commit is contained in:
@@ -1541,16 +1541,18 @@ def supplies_forecast():
|
||||
if not supplies:
|
||||
continue
|
||||
itemids = [s['itemid'] for s in supplies if s.get('itemid')]
|
||||
history = service.gethistory(itemids, days=days)
|
||||
history = service.getlevelhistory(itemids, days=days)
|
||||
|
||||
analysed = []
|
||||
for supply in supplies:
|
||||
points = history.get(str(supply.get('itemid')), [])
|
||||
detail = analyse(points)
|
||||
# The live read is the level the report shows, so it is also the
|
||||
# level the countdown is computed from - history lags a poll, and a
|
||||
# row whose level and days-left came from different moments reads
|
||||
# as broken.
|
||||
detail = analyse(points, currentlevel=supply.get('level'))
|
||||
detail['name'] = supply.get('name')
|
||||
detail['color'] = supply.get('color')
|
||||
# Trust the live read for the level; history can lag a poll behind.
|
||||
detail['currentlevel'] = supply.get('level', detail['currentlevel'])
|
||||
analysed.append(detail)
|
||||
|
||||
entry = {
|
||||
|
||||
Reference in New Issue
Block a user