gbmodel/model_sqlalchemy.py
def check_review_state(self, session_id, date):
        """
        Given a capstone session id to check and a date,
        this method determines the currently available review if any
        Inputs: a capstone session id and a date which should be a python date time object
        Outputs: 'final' if date is after the final start date for the session
        'midterm' if the date is between the midterm and final start dates.
        'error' otherwise
        """
        try:
            # get the session
            session = capstone_session.query.filter(capstone_session.id == session_id).first()
            # check if final exists:
            if session.final_start is not None:
                # if after final period, return final
                if date >= session.final_start:
                    return 'final'
                elif session.midterm_start is not None:
                    # otherwise if midterm exists, check if after midterm and return if so
                    if date >= session.midterm_start:
                        return 'midterm'
                else:
                    return 'Error'

            elif session.midterm_start is not None:
                # if only midterm exists, check midterm
                if date >= session.midterm_start:
                    return 'midterm'

            else:
                # no dates set, so error
                return 'Error'
        except exc.SQLAlchemyError:
            handle_exception()
            return 'Error'

        Given a capstone session id to check and a date,
        this method determines the currently available review if any
        Inputs: a capstone session id and a date which should be a python date time object
        Outputs: 'final' if date is after the final start date for the session
        'midterm' if the date is between the midterm and final start dates.
        'error' otherwise
        
Given a capstone session id to check and a date,
this method determines the currently available review if any
Inputs: a capstone session id and a date which should be a python date time object
Outputs: 'final' if date is after the final start date for the session
'midterm' if the date is between the midterm and final start dates.
'error' otherwise
Given a capstone session id to check and a date this method determines the currently available review if any Inputs : a capstone session id and a date which should be a python date time object Outputs : ' final ' if date is after the final start date for the session ' midterm ' if the date is between the midterm and final start dates . ' error ' otherwise
def check_review_state(self, session_id, date):
        try:
            session = capstone_session.query.filter(capstone_session.id == session_id).first()
            if session.final_start is not None:
                if date >= session.final_start:
                    return 'final'
                elif session.midterm_start is not None:
                    if date >= session.midterm_start:
                        return 'midterm'
                else:
                    return 'Error'
            elif session.midterm_start is not None:
                if date >= session.midterm_start:
                    return 'midterm'
            else:
                return 'Error'
        except exc.SQLAlchemyError:
            handle_exception()
            return 'Error'
def check_review_state ( self , session_id , date ) : try : session = capstone_session . query . filter ( capstone_session . id == session_id ) . first ( ) if session . final_start is not None : if date >= session . final_start : return 'final' elif session . midterm_start is not None : if date >= session . midterm_start : return 'midterm' else : return 'Error' elif session . midterm_start is not None : if date >= session . midterm_start : return 'midterm' else : return 'Error' except exc . SQLAlchemyError : handle_exception ( ) return 'Error'
Given a capstone session id to check and a date,
this method determines the currently available review if any
Inputs: a capstone session id and a date which should be a python date time object
Outputs: 'final' if date is after the final start date for the session
'midterm' if the date is between the midterm and final start dates.
Given a capstone session id to check and a date this method determines the currently available review if any Inputs : a capstone session id and a date which should be a python date time object Outputs : ' final ' if date is after the final start date for the session ' midterm ' if the date is between the midterm and final start dates .
"""
        Given a capstone session id to check and a date,
        this method determines the currently available review if any
        Inputs: a capstone session id and a date which should be a python date time object
        Outputs: 'final' if date is after the final start date for the session
        'midterm' if the date is between the midterm and final start dates.
        'error' otherwise
        """ # get the session # check if final exists: # if after final period, return final # otherwise if midterm exists, check if after midterm and return if so # if only midterm exists, check midterm # no dates set, so error
self
session_id
date