1
0
mirror of https://github.com/ohwgiles/laminar.git synced 2026-10-17 08:40:54 +00:00

resolves #62: add average line to build time graphs

This commit is contained in:
Oliver Giles
2018-09-08 21:02:58 +03:00
parent 010af57ed4
commit a2d30ad2ea
2 changed files with 28 additions and 2 deletions

View File

@@ -229,9 +229,10 @@ void Laminar::sendStatus(LaminarClient* client) {
.EndObject();
});
j.EndArray();
db->stmt("SELECT COUNT(*) FROM builds WHERE name = ?")
db->stmt("SELECT COUNT(*),AVG(completedAt-startedAt) FROM builds WHERE name = ?")
.bind(client->scope.job)
.fetch<uint>([&](uint nRuns){
.fetch<uint,uint>([&](uint nRuns, uint averageRuntime){
j.set("averageRuntime", averageRuntime);
j.set("pages", (nRuns-1) / runsPerPage + 1);
j.startObject("sort");
j.set("page", client->scope.page)