(self, podcast, prev_timestamp)
checks some practical requirements and updates a category
checks some practical requirements and updates a category
checks some practical requirements and updates a category
def _update_categories(self, podcast, prev_timestamp):
        """checks some practical requirements and updates a category"""

        max_timestamp = datetime.utcnow() + timedelta(days=1)

        # no episodes at all
        if not podcast.latest_episode_timestamp:
            return

        # no new episode
        if prev_timestamp and (podcast.latest_episode_timestamp <= prev_timestamp):
            return

        # too far in the future
        if podcast.latest_episode_timestamp > max_timestamp:
            return

        # not enough subscribers
        if podcast.subscriber_count() < settings.MIN_SUBSCRIBERS_CATEGORY:
            return

        update_category(podcast)
def _update_categories ( self , podcast , prev_timestamp ) : max_timestamp = datetime . utcnow ( ) + timedelta ( days = 1 ) # no episodes at all if not podcast . latest_episode_timestamp : return # no new episode if prev_timestamp and ( podcast . latest_episode_timestamp <= prev_timestamp ) : return # too far in the future if podcast . latest_episode_timestamp > max_timestamp : return # not enough subscribers if podcast . subscriber_count ( ) < settings . MIN_SUBSCRIBERS_CATEGORY : return update_category ( podcast )