zeeguu/core/model/user_reading_session.py
def find_by_article(
        cls,
        article,
        from_date: str = VERY_FAR_IN_THE_PAST,
        to_date: str = VERY_FAR_IN_THE_FUTURE,
        is_active: bool = None,
        cohort: bool = None,
    ):
        """
        Get reading sessions by article
        return: object or None if not found
        """
        if cohort is not None:
            query = cls.query.join(User).filter(User.cohort_id == cohort)
        else:
            query = cls.query
        query = query.filter(cls.article_id == article)
        query = query.filter(cls.start_time >= from_date)
        query = query.filter(cls.start_time <= to_date)

        if is_active is not None:
            query = query.filter(cls.is_active == is_active)

        query = query.order_by("start_time")

        sessions = query.all()
        return sessions

        Get reading sessions by article
        return: object or None if not found
        
Get reading sessions by article
return: object or None if not found
Get reading sessions by article return : object or None if not found
def find_by_article(
        cls,
        article,
        from_date: str = VERY_FAR_IN_THE_PAST,
        to_date: str = VERY_FAR_IN_THE_FUTURE,
        is_active: bool = None,
        cohort: bool = None,
    ):
        if cohort is not None:
            query = cls.query.join(User).filter(User.cohort_id == cohort)
        else:
            query = cls.query
        query = query.filter(cls.article_id == article)
        query = query.filter(cls.start_time >= from_date)
        query = query.filter(cls.start_time <= to_date)
        if is_active is not None:
            query = query.filter(cls.is_active == is_active)
        query = query.order_by("start_time")
        sessions = query.all()
        return sessions
def find_by_article ( cls , article , from_date : str = VERY_FAR_IN_THE_PAST , to_date : str = VERY_FAR_IN_THE_FUTURE , is_active : bool = None , cohort : bool = None , ) : if cohort is not None : query = cls . query . join ( User ) . filter ( User . cohort_id == cohort ) else : query = cls . query query = query . filter ( cls . article_id == article ) query = query . filter ( cls . start_time >= from_date ) query = query . filter ( cls . start_time <= to_date ) if is_active is not None : query = query . filter ( cls . is_active == is_active ) query = query . order_by ( "start_time" ) sessions = query . all ( ) return sessions
Get reading sessions by article
return: object or None if not found
Get reading sessions by article return : object or None if not found
"""
        Get reading sessions by article
        return: object or None if not found
        """
cls
article
from_date
str
to_date
str
is_active
bool
cohort
bool