Fixing bug in calculation, providing example test

Test can be run with: rake minitest:models