From 36c56bdf976a5d95973baa011bd7eca194ca37b3 Mon Sep 17 00:00:00 2001 From: Mike Gerwitz Date: Wed, 28 Aug 2013 13:56:10 -0400 Subject: [PATCH] Added tasktime plotting --- plot/tasktime | 8 ++++++++ task.sty | 16 ++++++++++++++++ tools/gentasktime | 43 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 67 insertions(+) create mode 100644 plot/tasktime create mode 100755 tools/gentasktime diff --git a/plot/tasktime b/plot/tasktime new file mode 100644 index 0000000..89890ff --- /dev/null +++ b/plot/tasktime @@ -0,0 +1,8 @@ +set terminal png +set bars 4.0 +set xlabel "Date" +set ylabel "Man Hours" +set grid y +set tics scale 0.0 +plot "tasktime.dat" using 1:3:4:3:4:xtic(2) title 'Time Interval' with candlesticks, \ + "tasktime.dat" using 1:5 title 'Mean' with lines diff --git a/task.sty b/task.sty index 20e0b88..c960cb6 100644 --- a/task.sty +++ b/task.sty @@ -168,6 +168,7 @@ }} +\newwrite\@taskstats \newcommand\projectsummary{{% \section{Project Summary} \pnumoff @@ -179,6 +180,21 @@ \expandafter\@task@setregs@vari\@@range||% \par {\sc Confidence:} \the\@@hconf\%% \par {\sc Variability:} \the\@@hvari\%% + % calculate median + \newcount\@@med + \advance\@@med \value{taskamin}% + \advance\@@med \value{taskamax}% + \divide\@@med by 2\relax + % write task stats to file (can be used for reporting by building consecutive + % versions, concatenating the data, taking the last row for each date and + % plotting, for example) + \immediate\openout\@taskstats=taskstats.dat + \immediate\write\@taskstats{min max med cp vp}% + \immediate\write\@taskstats{% + \arabic{taskamin} \arabic{taskamax} \the\@@med + \space\the\@@hconf \space\the\@@hvari + }% + \immediate\closeout\@taskstats % reset counters \setcounter{taskamin}{0}% \setcounter{taskamax}{0}% diff --git a/tools/gentasktime b/tools/gentasktime new file mode 100755 index 0000000..e1e2258 --- /dev/null +++ b/tools/gentasktime @@ -0,0 +1,43 @@ +#!/bin/bash + +src="${1?Missing source document}" + +domake() +{ + pdflatex -draftmode "$src" >&2 +} + +gendate() +{ + echo -n "$( git log -n1 --pretty=format:%ai | cut -d' ' -f1 ) " +} + +domake \ + && echo -n 'id ' \ + && head -n1 taskstats.dat \ + && \ + ( + gendate && tail -n1 taskstats.dat \ + && git log --first-parent --no-merges --pretty=format:'%ar %h' \ + | awk ' + BEGIN { + last="" + } + + /days ago/{ + if ( $1 == last ) next; + if ( $1 < last ) nextfile; + last = $1; + print $1, $NF; + } + ' \ + | while read n h; do + git checkout "$h" >&2 \ + && domake \ + && gendate \ + && tail -n1 taskstats.dat \ + || exit 1 + done + ) \ + | tac \ + | awk 'BEGIN{i=0}{i++; printf "%d ", i; print}'