def track!(date)
      @subject.with_lock do
        last_session_at = status.try(:last_session_at) || date
        current_streak = status.try(:current_streak) || 1

        streak = if last_session_at == date
                   current_streak
                 elsif last_session_at == date - 1.day
                   current_streak + 1
                 else
                   1
                 end

        update_status(date, streak)
        update_badge(streak)
      end
    end
def track!(date)
      @subject.with_lock do
        last_session_at = status.try(:last_session_at) || date
        current_streak = status.try(:current_streak) || 1

        streak = if last_session_at == date
                   current_streak
                 elsif last_session_at == date - 1.day
                   current_streak + 1
                 else
                   1
                 end

        update_status(date, streak)
        update_badge(streak)
      end
    end
Initializes the class with a polymorphic subject

 subject - A in instance of a subclass of ActiveRecord::Base to be tracked

 Public: Tracks the past activity of a user to update the continuity badge's
 score. It will set it to the amount of consecutive days a user has logged into
 the system.

 date - The date of the last user's activity. Usually `Time.zone.today`.

 Returns nothing.