gbmodel/model_sqlalchemy.py
def remove_team(self, name, session_id):
        """
        Remove a team and all the students from that team
        Input: name of the team and session id
        Output: delete a team
                move all student in the team to unassigned student
        """
        try:
            # Get the team slated for removal
            teams_obj = teams()
            team = teams_obj.query.filter(teams.name == name,
                                          teams.session_id == session_id).first()

            # Get the students on the team
            student_list = students.query.filter(students.tid == team.id,
                                                 students.session_id == session_id).all()

            # If we are trying to remove a team with students on it...
            if student_list:
                # Jump ship if the team is the empty team. We don't delete the empty team if there are
                # students in it
                if name == "":
                    return False

                # Otherwise, move all the students on the team to the empty team
                empty_team_id = teams_obj.get_tid_from_name("", session_id)
                if empty_team_id is None:
                    empty_team_id = teams_obj.insert_team(session_id, "")
                for student in student_list:
                    student.midterm_done = False
                    student.final_done = False
                    student.tid = empty_team_id

            # Remove all of the review submitted with team id
            reviews = reports.query.filter(reports.tid == team.id).all()
            for review in reviews:
                db.session.delete(review)

            # Now, remove the team
            db.session.delete(team)

            # Commit db changes
            db.session.commit()

            # Indicate operation successful
            return True
        except exc.SQLAlchemyError:
            # Log exception, and rollback db changes
            handle_exception()
            return False

        Remove a team and all the students from that team
        Input: name of the team and session id
        Output: delete a team
                move all student in the team to unassigned student
        
Remove a team and all the students from that team
Input: name of the team and session id
Output: delete a team
move all student in the team to unassigned student
Remove a team and all the students from that team Input : name of the team and session id Output : delete a team move all student in the team to unassigned student
def remove_team(self, name, session_id):
        try:
            teams_obj = teams()
            team = teams_obj.query.filter(teams.name == name,
                                          teams.session_id == session_id).first()
            student_list = students.query.filter(students.tid == team.id,
                                                 students.session_id == session_id).all()
            if student_list:
                if name == "":
                    return False
                empty_team_id = teams_obj.get_tid_from_name("", session_id)
                if empty_team_id is None:
                    empty_team_id = teams_obj.insert_team(session_id, "")
                for student in student_list:
                    student.midterm_done = False
                    student.final_done = False
                    student.tid = empty_team_id
            reviews = reports.query.filter(reports.tid == team.id).all()
            for review in reviews:
                db.session.delete(review)
            db.session.delete(team)
            db.session.commit()
            return True
        except exc.SQLAlchemyError:
            handle_exception()
            return False
def remove_team ( self , name , session_id ) : try : teams_obj = teams ( ) team = teams_obj . query . filter ( teams . name == name , teams . session_id == session_id ) . first ( ) student_list = students . query . filter ( students . tid == team . id , students . session_id == session_id ) . all ( ) if student_list : if name == "" : return False empty_team_id = teams_obj . get_tid_from_name ( "" , session_id ) if empty_team_id is None : empty_team_id = teams_obj . insert_team ( session_id , "" ) for student in student_list : student . midterm_done = False student . final_done = False student . tid = empty_team_id reviews = reports . query . filter ( reports . tid == team . id ) . all ( ) for review in reviews : db . session . delete ( review ) db . session . delete ( team ) db . session . commit ( ) return True except exc . SQLAlchemyError : handle_exception ( ) return False
Remove a team and all the students from that team
Input: name of the team and session id
Output: delete a team
move all student in the team to unassigned student
Remove a team and all the students from that team Input : name of the team and session id Output : delete a team move all student in the team to unassigned student
"""
        Remove a team and all the students from that team
        Input: name of the team and session id
        Output: delete a team
                move all student in the team to unassigned student
        """ # Get the team slated for removal # Get the students on the team # If we are trying to remove a team with students on it... # Jump ship if the team is the empty team. We don't delete the empty team if there are # students in it # Otherwise, move all the students on the team to the empty team # Remove all of the review submitted with team id # Now, remove the team # Commit db changes # Indicate operation successful # Log exception, and rollback db changes
self
name
session_id