File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed
Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -211,6 +211,24 @@ def get_all_courses_by_major(major_id):
211211 'courses' : all_courses
212212 }), 200 )
213213
214+ """
215+ Provides all existing courses, filtered by major KD ORG
216+ regardless active term/period
217+ """
218+ @router_main .route ("/majors/kd/<major_kd_org>/all_courses" , methods = ["GET" ])
219+ def get_all_courses_by_kd_org (major_kd_org ):
220+ major = Major .objects (kd_org = major_kd_org ).first ()
221+ if (
222+ major is None
223+ ): # there is still no user from desired major that already use update matkul
224+ return ({}, 200 )
225+ periods = Period .objects (major_id = major .id ).all ()
226+ all_courses = []
227+ for period in periods :
228+ for course in period .courses :
229+ all_courses .append (course .serialize_ulas_kelas ())
230+ return (jsonify ({"courses" : all_courses }), 200 )
231+
214232'''
215233Provides all existing courses
216234regardless of major or active term/period
@@ -225,4 +243,4 @@ def get_all_courses():
225243 all_courses .append (course .serialize_ulas_kelas ())
226244 return (jsonify ({
227245 'courses' : all_courses
228- }), 200 )
246+ }), 200 )
You can’t perform that action at this time.
0 commit comments