These two lines could be changed by `scores.where(category: category).first.try(:points) || 0`.