|
|
|
@ -37,7 +37,6 @@ class Tracker { |
|
|
|
|
|
|
|
|
|
$this->accounts = $accounts; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private function readEntries(): void { |
|
|
|
|
$sql = $this->conn->query(" |
|
|
|
|
SELECT accounts.puuid AS puuid, date, tier, `rank`, points |
|
|
|
@ -68,6 +67,28 @@ class Tracker { |
|
|
|
|
$this->entries = $result; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @return int[] |
|
|
|
|
*/ |
|
|
|
|
public function getProgressions(): array { |
|
|
|
|
$progressions = []; |
|
|
|
|
|
|
|
|
|
foreach ($this->entries as $puuid => $eloEntries) { |
|
|
|
|
if (sizeof($eloEntries) > 0){ |
|
|
|
|
$start = reset($eloEntries); |
|
|
|
|
$end = end($eloEntries); |
|
|
|
|
$progress = $end->value() - $start->value(); |
|
|
|
|
} else { |
|
|
|
|
$progress = 0; |
|
|
|
|
} |
|
|
|
|
$progressions[$puuid] = $progress; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
arsort($progressions); |
|
|
|
|
|
|
|
|
|
return $progressions; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function update(): void { |
|
|
|
|
|
|
|
|
|
foreach ($this->accounts as $puuid => $account) { |
|
|
|
|