gbmodel/model_sqlalchemy.py
def commit_reports(self, id, state, sess_id, success):
        """
        Method to commit changes to the DB through the model while updating the user's state
        input: None
        output: True if successful, false otherwise
        """
        # if adding reports was not successful, rollback changes to session
        try:
            if success is False:
                try:
                    print('Rolling Back Reports')
                    db.session.rollback()
                except exc.SQLAlchemyError:
                    return False
                return False

            # update appropriate student 'done' attribute
            print('Finding Student')
            student = students.query.filter_by(id=id, session_id=sess_id).first()
            if state == 'midterm':
                student.midterm_done = 1
            elif state == 'final':
                student.final_done = 1
            else:
                return False

            print('Committing Reports')

            db.session.commit()
            return True
        except exc.SQLAlchemyError:
            handle_exception()
            print('Rolling Back Reports')
            return False

        Method to commit changes to the DB through the model while updating the user's state
        input: None
        output: True if successful, false otherwise
        
Method to commit changes to the DB through the model while updating the user's state
input: None
output: True if successful, false otherwise
Method to commit changes to the DB through the model while updating the user ' s state input : None output : True if successful false otherwise
def commit_reports(self, id, state, sess_id, success):
        try:
            if success is False:
                try:
                    print('Rolling Back Reports')
                    db.session.rollback()
                except exc.SQLAlchemyError:
                    return False
                return False
            print('Finding Student')
            student = students.query.filter_by(id=id, session_id=sess_id).first()
            if state == 'midterm':
                student.midterm_done = 1
            elif state == 'final':
                student.final_done = 1
            else:
                return False
            print('Committing Reports')
            db.session.commit()
            return True
        except exc.SQLAlchemyError:
            handle_exception()
            print('Rolling Back Reports')
            return False
def commit_reports ( self , id , state , sess_id , success ) : try : if success is False : try : print ( 'Rolling Back Reports' ) db . session . rollback ( ) except exc . SQLAlchemyError : return False return False print ( 'Finding Student' ) student = students . query . filter_by ( id = id , session_id = sess_id ) . first ( ) if state == 'midterm' : student . midterm_done = 1 elif state == 'final' : student . final_done = 1 else : return False print ( 'Committing Reports' ) db . session . commit ( ) return True except exc . SQLAlchemyError : handle_exception ( ) print ( 'Rolling Back Reports' ) return False
Method to commit changes to the DB through the model while updating the user's state
input: None
output: True if successful, false otherwise
Method to commit changes to the DB through the model while updating the user ' s state input : None output : True if successful false otherwise
"""
        Method to commit changes to the DB through the model while updating the user's state
        input: None
        output: True if successful, false otherwise
        """ # if adding reports was not successful, rollback changes to session # update appropriate student 'done' attribute
self
id
state
sess_id
success