@@ -39,13 +39,14 @@ def get_application(app_id, info=None):
3939@app .route ('/application' , methods = ['POST' ])
4040@auth .oidc_auth
4141@before_request
42- def create_application ():
43- applicant_id = request .form .get ('id ' )
42+ def create_application (info = None ):
43+ applicant_rit_id = request .form .get ('rit_id ' )
4444 applicant = Applicant (
45- id = applicant_id ,
4645 body = request .form .get ('application' ),
4746 team = request .form .get ('team' ),
48- gender = request .form .get ('gender' ))
47+ gender = request .form .get ('gender' ),
48+ rit_id = applicant_rit_id ,
49+ )
4950 db .session .add (applicant )
5051 db .session .flush ()
5152 db .session .commit ()
@@ -66,7 +67,7 @@ def import_application():
6667 unparsed_applications = defaultdict (list )
6768 applications = {}
6869
69- old_apps = [int ( app .id ) for app in Applicant .query .all ()]
70+ old_apps = [app .id for app in Applicant .query .all ()]
7071
7172 try :
7273 document = docx .Document (word_file )
@@ -83,10 +84,10 @@ def import_application():
8384
8485 for array in unparsed_applications :
8586 app_info = unparsed_applications [array ][0 ].split ('\t ' )
86- app_id = app_info [0 ]
87+ app_rit_id = app_info [0 ]
8788 app_gender = gender [app_info [1 ]]
8889 app_text = app_info [2 ]
89- if int ( app_id ) in old_apps :
90+ if app_rit_id in old_apps :
9091 # If the application is already in the DB, skip it.
9192 continue
9293
@@ -96,9 +97,9 @@ def import_application():
9697 else :
9798 app_text += '\n {}' .format (line )
9899
99- applications [app_id ] = [app_gender , app_text ]
100+ applications [app_rit_id ] = [app_gender , app_text ]
100101 new_app = Applicant (
101- id = app_id ,
102+ rit_id = app_rit_id ,
102103 body = app_text ,
103104 team = - 1 ,
104105 gender = app_gender )
0 commit comments