refactor: multiple calls to getVSumField() replaced by a single one

#313
This commit is contained in:
Martin Ambrus
2017-11-25 20:29:12 +01:00
parent 446e9b5f1d
commit 8d8c96014b
6 changed files with 138 additions and 54 deletions
+11 -1
View File
@@ -5250,9 +5250,19 @@ class Automation {
$ally = $database->getAlliance($aid);
$memberlist = $database->getAllMember($ally['id']);
$oldrank = 0;
$memberIDs = [];
foreach($memberlist as $member) {
$oldrank += $database->getVSumField($member['id'],"pop");
$memberIDs[] = $member['id'];
}
$data = $database->getVSumField($memberIDs,"pop");
if (count($data)) {
foreach ($data as $row) {
$oldrank += $row['Total'];
}
}
if($ally['oldrank'] != $oldrank){
if($ally['oldrank'] < $oldrank) {
$totalpoints = $oldrank - $ally['oldrank'];