Commit 41ad8305 authored by Mhurd's avatar Mhurd
Browse files

Add initial task metric charting

parent 27f5a95e
...@@ -293,7 +293,75 @@ plugins: ...@@ -293,7 +293,75 @@ plugins:
x: { field: week, type: ordinal } x: { field: week, type: ordinal }
y: { field: count, type: quantitative } y: { field: count, type: quantitative }
color: { field: name, scale: { scheme: 'category20' }} color: { field: name, scale: { scheme: 'category20' }}
task-metrics:
title: Data³ - task metrics
description: Metrics about a task
layout:
- [notes]
- [task-details]
- [projects]
- [users]
- [task-days-in-project]
- [task-days-in-columns]
filters:
task_id:
name: Task ID
type: quantitative
project_name:
name: Project Name
type: nominal
charts:
notes:
library: markdown
display: |-
# To fix:
> Layout of these text charts will be beautified once templating bits land.
task-details:
title: Details
db: metrics
query: "select 'Title: ' || task.name || '<br>URL: <a href=\\\"http://127.0.0.1/T' || id || '\\\">http://127.0.0.1/T' || id || '</a><br>Status: ' || json_extract(task.status, '$.name') as info from task join phobjects on phobjects.phid = task.phid where id = :task_id;"
library: metric
display:
field: info
prefix:
suffix:
projects:
title: Projects
db: metrics
query: SELECT GROUP_CONCAT(name, '<br>') as project from (SELECT phid, name from task_metrics join phobjects on phobjects.phid = metric where metric like '%PHID-PROJ-%' and task = CAST(:task_id as decimal));
library: metric
display:
field: project
prefix:
suffix:
users:
title: Users
db: metrics
query: "SELECT GROUP_CONCAT(name, '<br>') as names from (select 'Author: ' || phobjects.name as 'name' from Task join phobjects on authorPHID = phobjects.phid where id = :task_id union select 'Owner: ' || phobjects.name as 'name' from Task join phobjects on ownerPHID = phobjects.phid where id = :task_id union select 'Closer: ' || phobjects.name as 'name' from Task join phobjects on closerPHID = phobjects.phid where id = :task_id);"
library: metric
display:
field: names
prefix:
suffix:
task-days-in-project:
title: Days in project
db: metrics
query: select ('T' || :task_id || ' has spent ' || printf('%.1f', (sum(duration) / 86400.0)) || ' days on ' || :project_name) as days_in_project from task_metrics join project on metric = phid where state = 'tagged' and name = :project_name and task = CAST(:task_id as decimal);
library: metric
display:
field: days_in_project
prefix:
suffix:
task-days-in-columns:
title: Days in columns
db: metrics
query: select *, next_ts - ts as duration, printf('%.1f', ((next_ts - ts) / 86400.0)) AS duration_days from (select events.*, columns.column_name, columns.project_name, columns.is_default, ifnull(LEAD(ts) OVER(ORDER BY ts), strftime('%s','now', 'localtime')) next_ts from events join columns on new = column_phid where new like '%PHID-PCOL-%' and task = :task_id and event = 'columns' and project_name = :project_name order by ts);
library: vega
display:
mark: { type: bar, tooltip: true }
encoding:
x: { field: duration_days, type: quantitative, title: 'Days in column' }
y: { field: column_name, type: nominal, title: 'Column' }
databases: databases:
metrics: metrics:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment