From c68b670250677b249e008f9486ffa43a8be3040b Mon Sep 17 00:00:00 2001 From: k0000k Date: Thu, 25 Jan 2024 13:39:51 +0900 Subject: [PATCH] fix: query --- server.py | 1 + smart_campus/smart_campus.py | 8 ++------ 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/server.py b/server.py index ba20739..9beb3d5 100644 --- a/server.py +++ b/server.py @@ -17,6 +17,7 @@ async def smart_campus_controller(smart_campus_req: SmartCampusReq): student_id는 학번을 의미합니다. """ from smart_campus.smart_campus import smart_campus_crawling + result = smart_campus_crawling(smart_campus_req.token, smart_campus_req.student_id) try: result = smart_campus_crawling(smart_campus_req.token, smart_campus_req.student_id) except: diff --git a/smart_campus/smart_campus.py b/smart_campus/smart_campus.py index 93eee2d..9d37fca 100644 --- a/smart_campus/smart_campus.py +++ b/smart_campus/smart_campus.py @@ -451,18 +451,14 @@ def smart_campus_crawling(token, student_id): user_id = session.query(Users).filter_by(student_id=student_id).first().id smart_campus.course(token, user_id) - courses = session.query(UserCourseRelation).all() + courses = session.query(UserCourseRelation).filter_by(user_id=user_id) for course in courses: real_id = session.query(Course).filter_by(id=course.course_id).first() subject_num = int(real_id.course_code) smart_campus.get_date(token, subject_num) - - for course in courses: - real_id = session.query(Course).filter_by(id=course.course_id).first() - subject_num = int(real_id.course_code) - smart_campus.get_calander_data(token, subject_num, user_id) + smart_campus.save_user_course_data(token, user_id) smart_campus.save_to_do_to_calendar(token, user_id)