Add per-repo counts to EGG
This commit is contained in:
40
www/extern/egg/EGGDatabase.php
vendored
40
www/extern/egg/EGGDatabase.php
vendored
@@ -484,7 +484,7 @@ class EGGDatabase
|
||||
$i++;
|
||||
}
|
||||
|
||||
$sql = str_replace("/*{INDETITY_COND}*/", $cond, $sql);
|
||||
$sql = str_replace("/*{IDENTITY_COND}*/", $cond, $sql);
|
||||
|
||||
$rows = $this->sql_query_assoc_prep($sql, $prep);
|
||||
|
||||
@@ -494,6 +494,44 @@ class EGGDatabase
|
||||
return $r;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $year
|
||||
* @param string[] $identities
|
||||
* @return array
|
||||
*/
|
||||
public function getPerRepoCommitCountOfYearByDate(int $year, array $identities): array
|
||||
{
|
||||
$sql = file_get_contents(__DIR__ . "/db_queryday.sql");
|
||||
|
||||
$cond = "(1=0)";
|
||||
$prep =
|
||||
[
|
||||
[":year", "".$year, PDO::PARAM_STR]
|
||||
];
|
||||
$i=0;
|
||||
foreach ($identities as $ident)
|
||||
{
|
||||
$cond .= " OR (mail1 = :_".$i."_)";
|
||||
$prep []= [":_".$i."_", $ident, PDO::PARAM_STR];
|
||||
$i++;
|
||||
$cond .= " OR (mail2 = :_".$i."_)";
|
||||
$prep []= [":_".$i."_", $ident, PDO::PARAM_STR];
|
||||
$i++;
|
||||
}
|
||||
|
||||
$sql = str_replace("/*{IDENTITY_COND}*/", $cond, $sql);
|
||||
|
||||
$rows = $this->sql_query_assoc_prep($sql, $prep);
|
||||
|
||||
$r = [];
|
||||
foreach ($rows as $row) {
|
||||
if (!isset($r[$row['commitdate']])) $r[$row['commitdate']] = [];
|
||||
$r[$row['commitdate']] []= $row;
|
||||
}
|
||||
|
||||
return $r;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int[]
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user