Bugfix: appending an entry didn't update total work done

Fixes #28

This is a squashed cherry-pick of the following commits from master:

    f265763a4e15049e2b900eb002dfeef08ca8d402
    d4be5665110d2417324d8b784eb6c5d37f215778
    76f3ec7b08f6fe2adc9ffb3337ea2cd6c5e3a5cc

with some additional adjustments to make it work on the 0.9.x branch (a
missing 'import datetime').