TSUNE-73 Implement spacing algorithm

Implement interval function based on the SM-2 spacing algorithm. See
here for details: http://www.supermemo.com/english/ol/sm2.htm

TSUNE-73 #time 4d #comment Total work logged
TSUNE-73 Cleanup and bugfixes in spacing algorithm

- Include repetition in query of due cards (learning will be finished too
  soon otherwise)
- Use Q for query of due cards
- Move detached interval logic from `process_rating` to `interval`
- Fix wrong rating levels in `calculateInterval`
- Move set_next_practice from `Practice` to `DelayablePractice`

TSUNE-73 #time 2d #comment Cleanup and bugfixes