1
0

Add per-repo counts to EGG
All checks were successful
Build Docker and Deploy / Build Docker (push) Successful in 21s
Build Docker and Deploy / Deploy to Server (push) Successful in 16s

This commit is contained in:
2025-07-12 18:32:22 +02:00
parent 6d54e5b9ba
commit e5c9b1c2a0
10 changed files with 133 additions and 21 deletions

View File

@@ -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[]
*/