Skip to content

Commit 4f8a70a

Browse files
committed
Updated Syntax Major Change for Values
Simple updates to some syntax related questions. Major changes for values by changing the way information is passed to the methods and logically separated in the report structure. Was able to shorten the code by a little bit and make a cleaner way to update in the future. Added three new if statements to the third page generation for logically different questions than previously used too.
1 parent fe648f2 commit 4f8a70a

File tree

4 files changed

+173
-60
lines changed

4 files changed

+173
-60
lines changed

core/reportgen.py

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,9 @@ def handle_third_page(self, canvas: object, select_app: int, last_idx: int) -> N
368368

369369
#Increment
370370
yadd = 0
371+
senior_found = 0
372+
coll_found = 0
373+
curr_found = 0
371374

372375
current_idx = last_idx
373376

@@ -377,23 +380,23 @@ def handle_third_page(self, canvas: object, select_app: int, last_idx: int) -> N
377380

378381
paragraph_start = ['Faculty Mentor ?', 'Consultant/Agency', 'Text Messaging Option',
379382
'Name Verification Notice', 'Conduct Question: Conviction', 'SSN Verification Notice',
380-
'Graduation Date', 'Consultant Agency ?', 'Alumni ?', 'Citzenship ?', "Post-Secondary Colleges/Universities",
383+
'Graduation Date', 'Consultant Agency ?', 'Alumni ?', 'Citzenship ?',
381384
'Conduct Question: Expulsion', 'Conduct: Pending Action', 'Multi type question',
382385
'End of App']
383386

384-
req_start = ['Request and/or Answer', 'Long REQ', 'Short REQ', 'Med REQ', "Post-Secondary Colleges/Universities"]
387+
req_start = ['Request and/or Answer', 'Long REQ', 'Short REQ', 'Med REQ']
385388

386389
_list = []
387390

388391
for val in self.page_3:
389392
current_idx += 1
390393
_str = self.nested_list[select_app][current_idx]
391394
struct = core.ReportStructure(_str)
395+
target = str(_str).split("!")
392396

393397
if val in paragraph_start:
394398
yadd -= 10
395399
elif val in req_start:
396-
target = str(_str).split("!")
397400

398401
req_syntax = {
399402
'PAYMENT RECONCILIATION': s.payment_syntax(target),
@@ -418,23 +421,37 @@ def handle_third_page(self, canvas: object, select_app: int, last_idx: int) -> N
418421
'INT CURR RESIDE IN US': s.currently_reside_syntax(target),
419422
'FAMILY OBLIGATION OTHER': s.family_obj_extra_syntax(target),
420423
'FAMILY OBLIGATION CARE': s.family_obj_extra_syntax(target),
421-
'INT VISA STATUS CHANGE': s.int_visa_status_syntax(target),
424+
'INT VISA STATUS CHANGE': s.int_visa_status_syntax(target)
422425
}
423426

424427
for key, value in req_syntax.items():
425428
if target[3] == key:
426429
_list = value
427430
yadd -= 10
431+
432+
elif val == 'Post-Secondary Colleges/Universities':
433+
_list = s.post_coll_univ_syntax(target, coll_found)
434+
coll_found += 1
428435

429-
if _list != None:
430-
for x in range(len(_list)):
431-
canvas.drawString(xstart, ystart+yadd, str(_list[x]))
432-
yadd -= 10
436+
elif val == 'Senior Year Course(s)':
437+
_list = s.senior_year_syntax(target, senior_found)
438+
senior_found += 1
433439

434-
_list = []
440+
elif val == 'Current enrolled course':
441+
_list = s.current_course_syntax(target, curr_found)
442+
curr_found += 1
443+
444+
445+
if _list != None:
446+
for x in range(len(_list)):
447+
canvas.drawString(xstart, ystart+yadd, str(_list[x]))
448+
yadd -= 10
449+
450+
_list = []
435451

436452
conv = struct.transform_page(val)
437453

454+
438455
if conv != "None":
439456
canvas.drawString(xstart, ystart+yadd, str(conv)) # prints syntax values
440457
# canvas.drawString(xstart, ystart+yadd, val + _str)

core/reportstructure.py

Lines changed: 27 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ def transform_page(self, val: str) -> str:
183183
'Long REQ': _list,
184184
'Short REQ': _list[-1],
185185
'Med REQ': _list,
186-
"Senior Year Course(s)": _list,
186+
"Senior Year Course(s)": None,
187187
"Issued Date": f"Issued: {_list[-1]}"
188188
}
189189

@@ -210,7 +210,7 @@ def transform_page(self, val: str) -> str:
210210
"Question Answer": _list[-2:-1],
211211
"Graduation Date": f"Expected Graduation Date: {_list[-1][:-3]}-{_list[-1][-3:]}",
212212
"High School Info": None,
213-
"Current enrolled course": _list,
213+
"Current enrolled course": None,
214214
"Previous Applicant": f"Previous Applicant: Yes",
215215
"VISA Info": f"Visa: {_list[-1]}",
216216
"VISA end date": f"End date: {_list[-1][:4]}-{_list[-1][4:]}"
@@ -224,13 +224,13 @@ def transform_page(self, val: str) -> str:
224224
"Semester": f"Semester: {_list[-1]}",
225225
"Question statement": _list[-2:-1],
226226
"Grade level": None,
227-
"Admissions Test": _list,
228-
"Post-Secondary Colleges/Universities": f"Institution: {_list[-1]}",
227+
"Admissions Test": None,
228+
"Post-Secondary Colleges/Universities": None,
229229
"Hours Earned": f"Hours Earned: {_list[-1]}",
230230
"End of App": "End of App",
231231
"Degree Earned": f"Degree: {_list[-1]}",
232-
"Skip": None,
233-
'Transfer Information': _list,
232+
"Skip": f'Expected Graduation Date: {_list[-1][:4]}-{_list[-1][4:]}',
233+
'Transfer Information': None,
234234
"Language": _list,
235235
"Old Admission Test Score": _list,
236236
"Old Admission Test": _list,
@@ -246,30 +246,27 @@ def transform_page(self, val: str) -> str:
246246
for idx in range(len(dictionaries)):
247247
for key, value in dictionaries[idx].items():
248248
if key == val:
249-
if key == "Med REQ" or key == "Long REQ":
250-
value = v.long_med_req_value(_list)
251-
elif key == "Request and/or Answer":
252-
value = v.req_and_or_answer_value(_list)
253-
elif key == 'Multi type question' or key == "Degree Earned" or key == 'Semester':
254-
value = v.additional_value(_list)
255-
elif key == 'Ethnicity/Race':
256-
value = v.ethnicity_race_value(_list)
257-
elif key == 'Address Two':
258-
value = v.address_value(_list)
259-
elif key == 'Student Gender':
260-
value = v.gender_value(_list)
261-
elif key == 'Start Extra Contact Info':
262-
value = v.extra_value(_list)
263-
elif key == 'App ID':
264-
value = v.app_value(_list)
265-
elif key == 'SSN':
266-
value = v.ssn_value(_list)
267-
elif key == 'Short MSG':
268-
value = v.short_msg_value(_list)
269-
elif key == 'Grade level':
270-
value = v.grade_level_value(_list)
271-
elif key == 'High School Info':
272-
value = v.high_school_value(_list)
249+
req_start = {
250+
'Med REQ': v.long_med_req_value(_list, key),
251+
'Long REQ': v.long_med_req_value(_list, key),
252+
'Request and/or Answer': v.req_and_or_answer_value(_list, key),
253+
'Multi type question': v.additional_value(_list, key),
254+
'Degree Earned': v.additional_value(_list, key),
255+
'Semester': v.additional_value(_list, key),
256+
'Ethnicity/Race': v.ethnicity_race_value(_list, key),
257+
'Address Two': v.address_value(_list, key),
258+
'Student Gender': v.gender_value(_list, key),
259+
'Start Extra Contact Info': v.extra_value(_list, key),
260+
'App ID': v.app_value(_list, key),
261+
'SSN': v.ssn_value(_list, key),
262+
'Short MSG': v.short_msg_value(_list, key),
263+
'Grade level': v.grade_level_value(_list, key),
264+
'High School Info': v.high_school_value(_list, key),
265+
'Admissions Test': v.admissions_value(_list, key)
266+
}
267+
268+
if key in req_start:
269+
value = req_start[key]
273270

274271
converted_mark = str(value).replace("\\", "")
275272
break

core/syntax.py

Lines changed: 56 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ def payment_syntax(self, _list: list) -> list:
2525

2626
target = _list[-1]
2727

28-
return [f"Transcation Time: {target[0:8]}",
28+
return [f"Transcation Time: {target[0:4]}-{target[4:6]}-{target[6:8]} {target[8:10]}:{target[10:12]}:{target[12:14]}",
2929
f"Payment Status: {target[15:19]}",
30-
f"Payment Amount: {target[19:24]}",
30+
f"Payment Amount: ${target[22:24]}",
3131
f"Transcation Trace: {target[24:36]}",
3232
f"Customer Reference: {target[36:48]}",
3333
f"Card Type: {target[48]}",
3434
f"Last 4 digit card number: {target[49:53]}",
35-
f"Card Expiration Date: {target[53:57]}", '']
35+
f"Card Expiration Date: {target[53:55]}/{target[55:57]}", '']
3636

3737
def hs_diploma_syntax(self, _list: list) -> list:
3838
"""Text fully listing the question given for HS Diploma information including
@@ -98,10 +98,12 @@ def hs_ged_syntax(self, _list: list) -> list:
9898

9999
target = target.replace('N', "No").replace('Y', "Yes")
100100

101+
extra = str(_list[-1]).replace('\\', '')
102+
101103

102104
return ['3. If you did not graduate from high school, do you have a DEG or have you completed',
103105
'another high school equivalency program?',
104-
f'{target}', '']
106+
f'{target}-{extra}', '']
105107

106108
def prev_syntax(self, _list: list) -> list:
107109
"""Text fully listing the question given from previous college information from
@@ -279,7 +281,7 @@ def country_syntax(self, _list: list) -> list:
279281
"""Text fully listing the question given from country application information from
280282
students on ApplyTexas.
281283
282-
:param _list: lsit of designated markdown text
284+
:param _list: list of designated markdown text
283285
:type _list: list
284286
:return: list of strings to display the proper output
285287
:rtype: list
@@ -326,6 +328,55 @@ def former_syntax(self, _list: list) -> list:
326328
'Have you previously applied?',
327329
f'{output[1]}']
328330

331+
def post_coll_univ_syntax(self, _list: list, found: int) -> list:
332+
333+
if _list[0] != 'PCL':
334+
return
335+
336+
institution = str(_list[-1]).replace('\\', '')
337+
338+
if found == 0:
339+
return ['','1. Please list ALL post-secondary colleges or universities you have previously attended or',
340+
'are presently attending, including for extension, correspondence, and distance learning',
341+
'credit, starting with the most recent. Failure to list all institutions will be considered',
342+
'an intentional omission an may lead to forced withdrawal.', '',
343+
f'Name of Insitition: {institution}',
344+
f'Code: {_list[1]}/{_list[2]}',
345+
f'Dates Attended: {_list[4][:4]}/{_list[4][4:6]}{_list[4][6]}{_list[4][7:11]}/{_list[4][11:14]}']
346+
347+
return ["",f'Name of Insitition: {institution}',
348+
f'Code: {_list[1]}/{_list[2]}',
349+
f'Dates Attended: {_list[4][:4]}/{_list[4][4:6]}{_list[4][6]}{_list[4][7:11]}/{_list[4][11:14]}']
350+
351+
def senior_year_syntax(self, _list: list, found: int) -> list:
352+
353+
if _list[0] != 'CRS':
354+
return
355+
356+
target = str(_list[-1]).replace('\\', '')
357+
358+
if found == 0:
359+
return ['', '4. Please list exact titles of courses to be completed your senior year and the number of',
360+
'credits you will earn for each. Include college coursework you will complete your senior year.', '',
361+
f'{target}', '']
362+
363+
return [f'{target}', '']
364+
365+
def current_course_syntax(self, _list: list, found: int) -> list:
366+
367+
if _list[0] != 'CRS':
368+
return
369+
370+
target = str(_list[-1]).replace('\\', '')
371+
course = str(_list[-2]).strip()
372+
373+
if found == 0:
374+
return ['', '4. Please list the college or university courses you are currently enrolled in and courses',
375+
'you anticipate completing before you transfer', '',
376+
f'{_list[4]} {course}/{target}', '']
377+
378+
return [ f'{_list[4]} {course}/{target}', '']
379+
329380
def family_obj_income_syntax(self, _list: list) -> list:
330381
"""Text fully listing the question given from family obligation income information from
331382
students on ApplyTexas.

0 commit comments

Comments
 (0)