Skip to content

Commit

Permalink
Updated report.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Nick-prog committed Jul 3, 2024
1 parent 64236cc commit e421bb4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
14 changes: 8 additions & 6 deletions core/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,14 +181,16 @@ def find_consultant_agency(self, app_data: list, filename: str) -> list:
_list = []

for idx, items in enumerate(app_data):
if str(items) == 'Consultant/Agency':
if items == 'Spring 2025':
_list.append(items)
elif str(items) == 'Consultant/Agency':
_list.append(app_data[idx+3])
elif str(items).startswith('Student Contact'):
self.student_flag = 1
elif self.student_flag == 1 and str(items).startswith('Date of Birth'):
self.student_flag = 0
_list.append(items[:25])
_list.append(items[26:])
_list.append(items[15:25])
_list.append(items[33:])
_list.append(filename)

return _list
Expand All @@ -197,11 +199,11 @@ def generate_xlsx_sheet(self, _list: list, filename: str) -> None:
_temp = []

for idx, items in enumerate(_list):
if len(items[0]) >= 4:
_temp.append([items[0][0], items[0][1], items[0][2], items[0][3], items[1]])
if len(items[0]) >= 5:
_temp.append([items[0][0], items[0][1], items[0][2], items[0][3], items[0][4], items[1]])

if len(_temp) != 0:
df = pd.DataFrame(_temp)
download_default = str(os.path.join(Path.home(), "Downloads"))
filepath = f'{download_default}/{filename}.xlsx'
df.to_excel(filepath, index=False, header= ["DOB", "Gender", "Info", "Filename", "Name"])
df.to_excel(filepath, index=False, header= ["Semester", "DOB", "Gender", "Info", "Filename", "Name"])
11 changes: 6 additions & 5 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def create_xlsx(translated_spe: list, filename: str)-> None:
def merge_xlsx()-> None:
# specifying the path to csv files
input_folder = str(os.path.join(Path.home(), "Downloads"))
output_file = str(os.path.join(input_folder, 'total.xlsx'))
output_file = str(os.path.join(input_folder, 'Spring 2024 total.xlsx'))

# Create a list to hold the dataframes
dfs = []
Expand All @@ -145,7 +145,8 @@ def merge_xlsx()-> None:
if __name__ == "__main__":

# find_spe_files() # Multiple .spe files
# find_spe_file() # Singluar .spe file
# print('Done')
merge_xlsx()
print('Done Done')
find_spe_file() # Singluar .spe file
print('Done')

# merge_xlsx()
# print('Done Done')

0 comments on commit e421bb4

Please sign in to comment.