def _delete_section_schedule(database, sectionschedules, allsectionschedules=False): for idsectionschedule in sectionschedules: with database: tbl_row_delete(database, "SectionSchedule", [["idSectionSched", "=", idsectionschedule]])
def _delete_class_lecture_teacher_enroll(database, classlectures, allclasslectures=False): for idclasslecture in classlectures: with database: tbl_row_delete(database, "ClassLectureFacultyEnroll", [["idClassLecture", "=", idclasslecture]])
def _delete_class_lecture_student_enroll(database, classlectures, allclasslectures=False): for idclasslecture in classlectures: with database: tbl_row_delete(database, "ClassLectureStudentEnroll", [["idClassLecture", "=", idclasslecture]])
def _delete_student_level(database, students, idacadperiods=[1], allstudents=False): for studentid in students: for idacadperiod in idacadperiods: with database: tbl_row_delete(database, "StudentLevel", [["idStudent", "=", studentid], ["idAcadPeriod", "=", idacadperiod]])
def clean_database(database, likestr="2018070"): tables = [ "SectionSchedule", "SectionScheduleFaculty", "SectionScheduleStudent", "Section", "Course", "Subject", "Student", "StudentLevel", "Faculty" ] with database: for _table in tables: tbl_row_delete(database, _table, [["dtAdd", "like", "\"" + likestr + "%\""]])
def delete_section(database, sections): for idsection in sections: with database: tbl_row_delete(database, "Section", [["idSection", "=", idsection]]) return [], []
def _delete_student(database, students, allstudents=False): for studentid in students: with database: tbl_row_delete(database, "Student", [["idStudent", "=", studentid]])
def _delete_subject(database, subjects, allsubjects=False): for subjectid in subjects: with database: tbl_row_delete(database, "Subject", [["idSubject", "=", subjectid]])
def _delete_course(database, courses, allcourses=False): for courseid in courses: with database: tbl_row_delete(database, "Course", [["idCourse", "=", courseid]])
def _delete_teacher(database, teachers, allteachers=False): for teacherid in teachers: with database: tbl_row_delete(database, "Faculty", [["idFaculty", "=", teacherid]])