瀏覽代碼

mat_competitors: show total

raylu 1 周之前
父節點
當前提交
312e90e0a8
共有 1 個文件被更改,包括 3 次插入0 次删除
  1. 3 0
      mat_competitors.py

+ 3 - 0
mat_competitors.py

@@ -49,8 +49,11 @@ def main() -> None:
 			competitors.append(Competitor(code, co_name, username, mat_production['amount'], bases))
 	competitors.sort(reverse=True)
 
+	total = 0.0
 	for c in competitors:
 		print(f'{c.code:4} {c.company_name:30} {c.username:20} {c.production:9,.1f}', ', '.join(c.bases))
+		total += c.production
+	print(f'total: {total:,.1f}')
 
 def iter_expertise(ticker: str) -> typing.Iterator[str]:
 	buildings: typing.Sequence[company.Building] = cache.get('https://rest.fnar.net/building/allbuildings', expiry=cache.ONE_DAY)