Modified #calculated_priority method to ensure all lines of code can be covered by tests.