1
0
Fork 0
tsgames/src/games/hordeseer/utils/calculations.ts

15 lines
488 B
TypeScript

import { WorkerData } from "../utils/api";
/**
* Calculate total kudos/hour across a set of workers.
* Computes kudos/hour for each worker individually, then sums them.
*/
export const calculateTotalKudosPerHour = (workers: WorkerData[]): number => {
return workers.reduce((sum, w) => {
const uptime = w.uptime;
const generated = w.kudos_details?.generated ?? 0;
if (uptime <= 0) return sum;
return sum + (generated / uptime) * 3600;
}, 0);
};