percent method

double percent([
  1. DateTime? at
])

Weighted by each job's estimate, so a 10 minute iOS build counts for more than a 5 minute APK.

Implementation

double percent([DateTime? at]) {
  final t = at ?? now;
  final total =
      jobs.fold<int>(0, (n, j) => n + math.max(j.estimate.inSeconds, 1));
  final done = jobs.fold<double>(
      0, (n, j) => n + math.max(j.estimate.inSeconds, 1) * j.fraction(t));
  return total == 0 ? 100 : 100 * done / total;
}