Skip to content

Commit

Permalink
fix: query
Browse files Browse the repository at this point in the history
  • Loading branch information
k0000k committed Jan 25, 2024
1 parent 1163fa4 commit c68b670
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
1 change: 1 addition & 0 deletions server.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
8 changes: 2 additions & 6 deletions smart_campus/smart_campus.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit c68b670

Please sign in to comment.