|
@@ -14,7 +14,7 @@ def main() -> None:
|
|
|
mat = sys.argv[1]
|
|
mat = sys.argv[1]
|
|
|
|
|
|
|
|
recipes: list[roi.Recipe] = cache.get('https://api.prunplanner.org/data/recipes/')
|
|
recipes: list[roi.Recipe] = cache.get('https://api.prunplanner.org/data/recipes/')
|
|
|
- companies = pmmg_monthly_report()
|
|
|
|
|
|
|
+ companies = pmmg_monthly_report()['individual']
|
|
|
|
|
|
|
|
print(mat, '→')
|
|
print(mat, '→')
|
|
|
wrought = (recipe for recipe in recipes
|
|
wrought = (recipe for recipe in recipes
|
|
@@ -63,7 +63,12 @@ def main() -> None:
|
|
|
alt = f' ({recipe_count} recipes)'
|
|
alt = f' ({recipe_count} recipes)'
|
|
|
print(f'{output_mat:3}: {total:8,.0f}{alt}')
|
|
print(f'{output_mat:3}: {total:8,.0f}{alt}')
|
|
|
|
|
|
|
|
-def pmmg_monthly_report() -> dict[str, dict[str, CompanyOutput]]:
|
|
|
|
|
|
|
+def pmmg_monthly_report() -> CompanyData:
|
|
|
|
|
+ last_month = pmmg_month()
|
|
|
|
|
+ print('getting report for', last_month)
|
|
|
|
|
+ return cache.get(f'https://prun.raylu.net/stats/data/company-data-{last_month}.json', expiry=cache.ONE_DAY)
|
|
|
|
|
+
|
|
|
|
|
+def pmmg_month() -> str:
|
|
|
report_constants = cache.get('https://git.raylu.net/raylu/prunstats/raw/main/src/staticData/constants.ts',
|
|
report_constants = cache.get('https://git.raylu.net/raylu/prunstats/raw/main/src/staticData/constants.ts',
|
|
|
json=False, expiry=cache.ONE_DAY)
|
|
json=False, expiry=cache.ONE_DAY)
|
|
|
# export const months = ["mar25", "apr25", ..., "dec25", "jan26"];
|
|
# export const months = ["mar25", "apr25", ..., "dec25", "jan26"];
|
|
@@ -71,9 +76,14 @@ def pmmg_monthly_report() -> dict[str, dict[str, CompanyOutput]]:
|
|
|
assert match
|
|
assert match
|
|
|
months_str = match.group(1)
|
|
months_str = match.group(1)
|
|
|
months = [m.strip().strip('"') for m in months_str.split(',')]
|
|
months = [m.strip().strip('"') for m in months_str.split(',')]
|
|
|
- last_month = months[-1]
|
|
|
|
|
- print('getting report for', last_month)
|
|
|
|
|
- return cache.get(f'https://prun.raylu.net/stats/data/company-data-{last_month}.json', expiry=cache.ONE_DAY)['individual']
|
|
|
|
|
|
|
+ return months[-1]
|
|
|
|
|
+
|
|
|
|
|
+class CompanyData(typing.TypedDict):
|
|
|
|
|
+ totals: dict[str, CompanyTotal]
|
|
|
|
|
+ individual: dict[str, dict[str, CompanyOutput]]
|
|
|
|
|
+
|
|
|
|
|
+class CompanyTotal(typing.TypedDict):
|
|
|
|
|
+ volume: float
|
|
|
|
|
|
|
|
class CompanyOutput(typing.TypedDict):
|
|
class CompanyOutput(typing.TypedDict):
|
|
|
amount: int
|
|
amount: int
|