From: Adam Chlipala Date: Mon, 26 Feb 2007 00:23:09 +0000 (+0000) Subject: Quick statistics on support response times X-Git-Url: https://git.hcoop.net/hcoop/portal.git/commitdiff_plain/f7cc3697745f2cc57e314f21357ed62ecdbed416 Quick statistics on support response times --- diff --git a/qos.mlt b/qos.mlt index cc0cfaa..47231b7 100644 --- a/qos.mlt +++ b/qos.mlt @@ -2,9 +2,12 @@ val days = case $"days" of "" => 7 - | days => Web.stoi days %> + | days => Web.stoi days; + +if $"cmd" = "list" then %>
+ Show me the entries from the last days.
@@ -24,6 +27,31 @@ foreach qos in Qos.recent days do %> +<% else %> + +

List all recent support requests

+ +
+Refresh statistics to include the last days. + +
+ +


+ +<% val stats = Qos.reportCard days %> + + + + + + + +
Kind Total resolved issues Minutes to resolve
APT packages <% #count (#apt stats) %> <% #minutes (#apt stats) %>
Domains <% #count (#domain stats) %> <% #minutes (#domain stats) %>
Mailing lists <% #count (#mailingList stats) %> <% #minutes (#mailingList stats) %>
Security <% #count (#sec stats) %> <% #minutes (#sec stats) %>
Miscellaneous <% #count (#closed (#misc stats)) %> <% #minutes (#closed (#misc stats)) %>
+ +

Additionally, <% #count (#pending (#misc stats)) %> miscellaneous support requests placed in this period have at some time been marked as pending or closed, and it took on average <% #minutes (#pending (#misc stats)) %> minutes to do so.

+ +<% end %> + <% @footer [] %> diff --git a/qos.sig b/qos.sig index d617aec..144c564 100644 --- a/qos.sig +++ b/qos.sig @@ -5,4 +5,14 @@ signature QOS = sig val recent : int -> entry list + type grade = { count : int, minutes : int } + type grades = { pending : grade, closed : grade } + type reportCard = { misc : grades, + apt : grade, + domain : grade, + mailingList : grade, + sec : grade } + + val reportCard : int -> reportCard + end diff --git a/qos.sml b/qos.sml index 4d06332..cd71246 100644 --- a/qos.sml +++ b/qos.sml @@ -42,4 +42,45 @@ fun recent days = ORDER BY stamp DESC`) end +type grade = { count : int, minutes : int } +type grades = { pending : grade, closed : grade } +type reportCard = { misc : grades, + apt : grade, + domain : grade, + mailingList : grade, + sec : grade } + +fun mkGradeRow [count, minutes] = + {count = C.intFromSql count, + minutes = if C.isNull minutes then 0 else C.intFromSql minutes} + | mkGradeRow row = rowError ("grade", row) + +fun reportCard days = + let + val db = getDb () + + fun gradeRow s = mkGradeRow (C.oneRow db s) + + fun default tab = + gradeRow ($`SELECT COUNT(*), AVG(cstamp - stamp) + FROM ^tab + WHERE stamp >= CURRENT_TIMESTAMP - interval '^(C.intToSql days) DAYS' + AND cstamp IS NOT NULL`) + in + {misc = {pending = gradeRow + ($`SELECT COUNT(*), AVG(COALESCE(pstamp, cstamp) - stamp) + FROM SupIssue + WHERE stamp >= CURRENT_TIMESTAMP - interval '^(C.intToSql days) DAYS' + AND COALESCE(pstamp, cstamp) IS NOT NULL`), + closed = gradeRow + ($`SELECT COUNT(*), AVG(cstamp - stamp) + FROM SupIssue + WHERE stamp >= CURRENT_TIMESTAMP - interval '^(C.intToSql days) DAYS' + AND cstamp IS NOT NULL`)}, + apt = default "Apt", + domain = default "Domain", + mailingList = default "MailingList", + sec = default "Sec"} + end + end