Add day log report to work log

parent c22c6e40
......@@ -48,7 +48,17 @@ combined-worklogs.sqlite: repository-worklog.sqlite $(foreach SUBMODULE,$(SUBMOD
grep '^INSERT' |
sqlite3 $@
reports/translations-worklog.md: combined-worklogs.sqlite
combined-daylog.csv:
cat /dev/null > $@
combined-daylog.sqlite: combined-daylog.csv
sqlite3 $@ "DROP TABLE IF EXISTS days; CREATE TABLE days (author TEXT, date DATE, start DATE, end DATE, breaks INT, sig TEXT, apr TEXT, hours INT)"
sqlite3 $@ <<< ".mode csv" <<< ".import $< days"
combined-daylog.json: combined-daylog.csv
jq -M -e -s --raw-input 'split("\r\n") | .[1:] | map(split(",")) | select(.[6] != "") | map({author: .[0], date: .[1], hours: .[7]})' < $< > $@
reports/translations-worklog.md: combined-worklogs.sqlite combined-daylog.sqlite
now=$$(LANG=en_US date +%c)
ver=$(call versioninfo,$(PROJECT))
export IFS='|'
......@@ -62,10 +72,17 @@ reports/translations-worklog.md: combined-worklogs.sqlite
echo "\n## $$(LANG=en_US date +'%B %Y' -d $${month}-01)"
echo '``` table'
echo '---\nheader: True\n---'
sqlite3 --header -csv $< "SELECT file as Filename, SUM(added) AS Added, SUM(-removed) AS Removed FROM commits WHERE author='$${author}' and strftime('%Y-%m', date)='$${month}' GROUP BY Filename"
sqlite3 --header -csv $< "SELECT file as Filename, SUM(added) AS Added, SUM(-removed) AS Removed FROM commits WHERE author='$${author}' AND strftime('%Y-%m', date)='$${month}' GROUP BY Filename"
echo '```'
echo -n "Net Characters Added\n: "
sqlite3 $< "SELECT SUM(added+ -removed) FROM commits WHERE author='$${author}' and strftime('%Y-%m', date)='$${month}'"
echo '\n``` table'
echo '---\nheader: True\n---'
sqlite3 --header -csv combined-daylog.sqlite "SELECT date AS Date, SUM(hours) AS Hours FROM days WHERE author='$${author}' AND strftime('%Y-%m', date)='$${month}' AND apr != '' AND Hours >= 1 GROUP BY date"
echo '```'
echo -n "Days spent at office\n: "
sqlite3 combined-daylog.sqlite "SELECT COUNT(DISTINCT(date)) AS Days FROM days WHERE author='$${author}' AND strftime('%Y-%m', date)='$${month}' AND apr != '' AND hours >= 1"
echo
done
done |
$(PANDOC) $(PANDOCARGS) -F pantable -o $@
......
Markdown is supported
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