def get_hot_stories(hot_eligible_age = timedelta(hours = 48)): """ Get a story list that is suitable for display as "hot". @param timediff: timedelta object representing hot story eligibility age """ hot_avg = general.get_key_from_stat('hot_avg')['value'] stories = dbsession.query(Submission).options(joinedload('submitter')).filter(Submission.deleted == False).filter(Submission.added_on > (general.now_in_utc() - hot_eligible_age)).filter(Submission.hot_window_score > hot_avg).order_by(Submission.hot_window_score.desc()) return stories
def get_mass_time(): mass_timestamp = None try: mass_timestamp = general.get_key_from_stat('mass_hot_window_timestamp', type = 'datetime') except sqlalchemy.orm.exc.NoResultFound: call_all_hot_window_scores() if type(mass_timestamp) == dict: return mass_timestamp['value'] else: return None
def get_hot_avg_time(): hot_avg_timestamp = None try: hot_avg_timestamp = general.get_key_from_stat('hot_avg_timestamp', type = 'datetime') except sqlalchemy.orm.exc.NoResultFound: call_hot_average() if type(hot_avg_timestamp) == dict: return hot_avg_timestamp['value'] else: return None
def get_hot_stories(hot_eligible_age=timedelta(hours=48)): """ Get a story list that is suitable for display as "hot". @param timediff: timedelta object representing hot story eligibility age """ hot_avg = general.get_key_from_stat('hot_avg')['value'] stories = dbsession.query(Submission).options( joinedload('submitter')).filter(Submission.deleted == False).filter( Submission.added_on > ( general.now_in_utc() - hot_eligible_age)).filter( Submission.hot_window_score > hot_avg).order_by( Submission.hot_window_score.desc()) return stories
def get_mass_time(): mass_timestamp = None try: mass_timestamp = general.get_key_from_stat( 'mass_hot_window_timestamp', type='datetime') except sqlalchemy.orm.exc.NoResultFound: call_all_hot_window_scores() if type(mass_timestamp) == dict: return mass_timestamp['value'] else: return None
def get_hot_avg_time(): hot_avg_timestamp = None try: hot_avg_timestamp = general.get_key_from_stat('hot_avg_timestamp', type='datetime') except sqlalchemy.orm.exc.NoResultFound: call_hot_average() if type(hot_avg_timestamp) == dict: return hot_avg_timestamp['value'] else: return None