Skip to content

Commit 27fecc8

Browse files
committed
applied requested changes (constants and query merge) for pull request #1069
1 parent 92fcc6e commit 27fecc8

File tree

2 files changed

+16
-15
lines changed

2 files changed

+16
-15
lines changed

src/dba/Aggregation.class.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ class Aggregation {
1111
* @var AbstractModelFactory
1212
*/
1313
private $factory;
14+
15+
const SUM = "SUM";
16+
const MAX = "MAX";
17+
const MIN = "MIN";
18+
const COUNT = "COUNT";
1419

1520
function __construct($column, $function, $factory = null) {
1621
$this->column = $column;

src/inc/Util.class.php

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -380,23 +380,19 @@ public static function insertFile($path, $name, $type, $accessGroupId) {
380380
public static function getTaskInfo($task) {
381381
$qF1 = new QueryFilter(Chunk::TASK_ID, $task->getId(), "=");
382382

383-
$qF2 = new QueryFilter(Chunk::DISPATCH_TIME, 0, ">");
384-
$qF3 = new QueryFilter(Chunk::SOLVE_TIME, 0, ">");
385-
$agg1 = new Aggregation(Chunk::SOLVE_TIME, "SUM");
386-
$agg2 = new Aggregation(Chunk::DISPATCH_TIME, "SUM");
387-
$results = Factory::getChunkFactory()->multicolAggregationFilter([Factory::FILTER => [$qF1, $qF2, $qF3]], [$agg1, $agg2]);
383+
$agg1 = new Aggregation(Chunk::CHECKPOINT, Aggregation::SUM);
384+
$agg2 = new Aggregation(Chunk::SKIP, Aggregation::SUM);
385+
$agg3 = new Aggregation(Chunk::CRACKED, Aggregation::SUM);
386+
$agg4 = new Aggregation(Chunk::SPEED, Aggregation::SUM);
387+
$agg5 = new Aggregation(Chunk::DISPATCH_TIME, Aggregation::MAX);
388+
$agg6 = new Aggregation(Chunk::SOLVE_TIME, Aggregation::MAX);
389+
$agg7 = new Aggregation(Chunk::CHUNK_ID, Aggregation::COUNT);
390+
$agg8 = new Aggregation(Chunk::SOLVE_TIME, Aggregation::SUM);
391+
$agg9 = new Aggregation(Chunk::DISPATCH_TIME, Aggregation::SUM);
388392

389-
$totalTimeSpent = $results[$agg1->getName()] - $results[$agg2->getName()];
393+
$results = Factory::getChunkFactory()->multicolAggregationFilter([Factory::FILTER => $qF1], [$agg1, $agg2, $agg3, $agg4, $agg5, $agg6, $agg7, $agg8, $agg9]);
390394

391-
$agg1 = new Aggregation(Chunk::CHECKPOINT, "SUM");
392-
$agg2 = new Aggregation(Chunk::SKIP, "SUM");
393-
$agg3 = new Aggregation(Chunk::CRACKED, "SUM");
394-
$agg4 = new Aggregation(Chunk::SPEED, "SUM");
395-
$agg5 = new Aggregation(Chunk::DISPATCH_TIME, "MAX");
396-
$agg6 = new Aggregation(Chunk::SOLVE_TIME, "MAX");
397-
$agg7 = new Aggregation(Chunk::CHUNK_ID, "COUNT");
398-
399-
$results = Factory::getChunkFactory()->multicolAggregationFilter([Factory::FILTER => $qF1], [$agg1, $agg2, $agg3, $agg4, $agg5, $agg6, $agg7]);
395+
$totalTimeSpent = $results[$agg8->getName()] - $results[$agg9->getName()];
400396

401397
$progress = $results[$agg1->getName()] - $results[$agg2->getName()];
402398
$cracked = $results[$agg3->getName()];

0 commit comments

Comments
 (0)