gbmodel/model_sqlalchemy.py
def insert_session(self, term, year, professor_id):
        """
        Add a current session (only if it wasn't in the database)
        Input: starting term and year of the session
        Output: return id of the added session
        """
        term = term.strip().lower()
        year = year.strip().lower()
        e_term = None
        e_year = 0
        terms = ["fall", "winter", "spring", "summer"]
        for i in range(len(terms)):
            if terms[i] == term:
                e_term = terms[(i+1) % 4]
                e_term = e_term.capitalize()
        if term == 'fall':
            e_year = int(year)+1
        else:
            e_year = year
        id = self.get_max()
        term = term.capitalize()
        year = year.capitalize()
        prof_id = professor_id.lower()
        new_sess = capstone_session(id=id,
                                    start_term=term,
                                    start_year=year,
                                    end_term=e_term,
                                    end_year=e_year,
                                    professor_id=prof_id)
        db.session.add(new_sess)
        db.session.commit()
        return id

        Add a current session (only if it wasn't in the database)
        Input: starting term and year of the session
        Output: return id of the added session
        
Add a current session (only if it wasn't in the database)
Input: starting term and year of the session
Output: return id of the added session
Add a current session ( only if it wasn ' t in the database ) Input : starting term and year of the session Output : return id of the added session
def insert_session(self, term, year, professor_id):
        term = term.strip().lower()
        year = year.strip().lower()
        e_term = None
        e_year = 0
        terms = ["fall", "winter", "spring", "summer"]
        for i in range(len(terms)):
            if terms[i] == term:
                e_term = terms[(i+1) % 4]
                e_term = e_term.capitalize()
        if term == 'fall':
            e_year = int(year)+1
        else:
            e_year = year
        id = self.get_max()
        term = term.capitalize()
        year = year.capitalize()
        prof_id = professor_id.lower()
        new_sess = capstone_session(id=id,
                                    start_term=term,
                                    start_year=year,
                                    end_term=e_term,
                                    end_year=e_year,
                                    professor_id=prof_id)
        db.session.add(new_sess)
        db.session.commit()
        return id
def insert_session ( self , term , year , professor_id ) : term = term . strip ( ) . lower ( ) year = year . strip ( ) . lower ( ) e_term = None e_year = 0 terms = [ "fall" , "winter" , "spring" , "summer" ] for i in range ( len ( terms ) ) : if terms [ i ] == term : e_term = terms [ ( i + 1 ) % 4 ] e_term = e_term . capitalize ( ) if term == 'fall' : e_year = int ( year ) + 1 else : e_year = year id = self . get_max ( ) term = term . capitalize ( ) year = year . capitalize ( ) prof_id = professor_id . lower ( ) new_sess = capstone_session ( id = id , start_term = term , start_year = year , end_term = e_term , end_year = e_year , professor_id = prof_id ) db . session . add ( new_sess ) db . session . commit ( ) return id
Add a current session (only if it wasn't in the database)
Input: starting term and year of the session
Output: return id of the added session
Add a current session ( only if it wasn ' t in the database ) Input : starting term and year of the session Output : return id of the added session
"""
        Add a current session (only if it wasn't in the database)
        Input: starting term and year of the session
        Output: return id of the added session
        """
self
term
year
professor_id