Corrected first aid not filtering for newbies and changed district report zip files to end up in the district folders. Removed combined group zip files as you cannot send a zip file containing zip files through gmail for some reason.
This commit is contained in:
parent
098ca834f0
commit
34e4491d97
@ -4,8 +4,8 @@
|
||||
#Licence: GPL-3.0-or-later
|
||||
#Written by Stuart Griffiths, stuart.griffiths@birminghamscouts.org.uk
|
||||
#Started 19/05/2022
|
||||
#Version:0.5
|
||||
#Released: 22/09/2022
|
||||
#Version:0.6
|
||||
#Released: 02/10/2022
|
||||
#Status: Working - outputs to 2 seperate CSV files
|
||||
#Inputs: CSV
|
||||
#Outputs: multiple CSV and 1 x text file
|
||||
@ -159,6 +159,10 @@ def training_report():
|
||||
a= 1
|
||||
#If membership numbers are equal, we are not at primary role so want to skip to next line
|
||||
#if they are not equal, we are at primary role and so want to process
|
||||
if next_line_membership == current_line_membership:
|
||||
multi_role = True
|
||||
else:
|
||||
multi_role = False
|
||||
if next_line_membership != current_line_membership:
|
||||
#3.1 acquire dates
|
||||
#Get today's date
|
||||
@ -182,8 +186,10 @@ def training_report():
|
||||
role_start = datetime.datetime.strptime(input_data[line_num][9], "%d/%m/%Y")
|
||||
role_start_period = role_start + relativedelta(months=+5)
|
||||
#need to flag if in role start period
|
||||
if today < role_start_period:
|
||||
if today < role_start_period and multi_role == False:
|
||||
newbie = True
|
||||
else:
|
||||
newbie = False
|
||||
#3.3.1 safety
|
||||
#Read the column
|
||||
safety = input_data[line_num][36]
|
||||
@ -317,7 +323,7 @@ def training_report():
|
||||
firstaid = input_data[line_num][40]
|
||||
#Check is it late?
|
||||
#If date is blank, add to list using membership no, known_name, surname, email, telephone, member_role, manager, group, district, safety due, safeguarding due, first aid due
|
||||
if firstaid == "" and role_training == True and firstaid_required == True:
|
||||
if firstaid == "" and role_training == True and firstaid_required == True and newbie == False:
|
||||
firstaid_status = True
|
||||
member_number = input_data[line_num][0]
|
||||
#check whether membership number is in the index and add it if not
|
||||
@ -343,7 +349,7 @@ def training_report():
|
||||
SCW_firstaid_missing_list.append(member_number)
|
||||
if district_name == 'Tame Valley Birmingham':
|
||||
tame_firstaid_missing_list.append(member_number)
|
||||
if input_data[line_num][41] != "" and role_training == True and firstaid_required == True:
|
||||
if input_data[line_num][41] != "" and role_training == True and firstaid_required == True and newbie == False:
|
||||
#Convert string to date object, has to be done here for the blanks!
|
||||
firstaid = datetime.datetime.strptime(input_data[line_num][41], "%d/%m/%Y")
|
||||
#Check is it late?
|
||||
|
@ -4,8 +4,8 @@
|
||||
#Licence: GPL-3.0-or-later
|
||||
#Written by Stuart Griffiths, stuart.griffiths@birminghamscouts.org.uk
|
||||
#Started 02/07/2022
|
||||
#Version:0.3
|
||||
#Released: 25/09/2022
|
||||
#Version:0.4
|
||||
#Released: 02/10/2022
|
||||
#Status: Working
|
||||
#Inputs: CSVs
|
||||
#Outputs: XLSXs, zip files, folder
|
||||
@ -3322,6 +3322,56 @@ def convert_csv_xlsx():
|
||||
pyminizip.compress_multiple(spitfire_list, [], str(working_folder) + '/' + "spitfire.zip", "BhamSc@uts", 1)
|
||||
pyminizip.compress_multiple(tame_list, [], str(working_folder) + '/' + "tame.zip", "BhamSc@uts", 1)
|
||||
|
||||
#move to district folder
|
||||
file_title = 'county.zip'
|
||||
folder_name = 'county'
|
||||
file_name = working_folder + '/' + str(file_title)
|
||||
#move file to the right place
|
||||
file_name_destination = working_folder + '/' + folder_name + '/' + file_title
|
||||
shutil.move(file_name, file_name_destination)
|
||||
|
||||
file_title = 'CVS.zip'
|
||||
folder_name = 'CVS'
|
||||
file_name = working_folder + '/' + str(file_title)
|
||||
#move file to the right place
|
||||
file_name_destination = working_folder + '/' + folder_name + '/' + file_title
|
||||
shutil.move(file_name, file_name_destination)
|
||||
|
||||
file_title = 'rea.zip'
|
||||
folder_name = 'rea'
|
||||
file_name = working_folder + '/' + str(file_title)
|
||||
#move file to the right place
|
||||
file_name_destination = working_folder + '/' + folder_name + '/' + file_title
|
||||
shutil.move(file_name, file_name_destination)
|
||||
|
||||
file_title = 'SCE.zip'
|
||||
folder_name = 'SCE'
|
||||
file_name = working_folder + '/' + str(file_title)
|
||||
#move file to the right place
|
||||
file_name_destination = working_folder + '/' + folder_name + '/' + file_title
|
||||
shutil.move(file_name, file_name_destination)
|
||||
|
||||
file_title = 'SCW.zip'
|
||||
folder_name = 'SCW'
|
||||
file_name = working_folder + '/' + str(file_title)
|
||||
#move file to the right place
|
||||
file_name_destination = working_folder + '/' + folder_name + '/' + file_title
|
||||
shutil.move(file_name, file_name_destination)
|
||||
|
||||
file_title = 'spitfire.zip'
|
||||
folder_name = 'spitfire'
|
||||
file_name = working_folder + '/' + str(file_title)
|
||||
#move file to the right place
|
||||
file_name_destination = working_folder + '/' + folder_name + '/' + file_title
|
||||
shutil.move(file_name, file_name_destination)
|
||||
|
||||
file_title = 'tame.zip'
|
||||
folder_name = 'tame'
|
||||
file_name = working_folder + '/' + str(file_title)
|
||||
#move file to the right place
|
||||
file_name_destination = working_folder + '/' + folder_name + '/' + file_title
|
||||
shutil.move(file_name, file_name_destination)
|
||||
|
||||
print("Folder sorting and zipping completed!")
|
||||
|
||||
_96_group_list = [str(CVS_folder) + '/' + '96_due_mandatory_training.xlsx', str(CVS_folder) + '/' + '96_late_mandatory_training.xlsx']
|
||||
@ -3343,7 +3393,7 @@ def convert_csv_xlsx():
|
||||
_325_group_list = [str(CVS_folder) + '/' + '325_due_mandatory_training.xlsx', str(CVS_folder) + '/' + '325_late_mandatory_training.xlsx']
|
||||
|
||||
|
||||
pyminizip.compress_multiple(_96_group_list, [], str(CVS_folder) + '/' + "81bham.zip", "BhamSc@uts", 1)
|
||||
pyminizip.compress_multiple(_96_group_list, [], str(CVS_folder) + '/' + "96bham.zip", "BhamSc@uts", 1)
|
||||
pyminizip.compress_multiple(_192_group_list, [], str(CVS_folder) + '/' + "192bham.zip", "BhamSc@uts", 1)
|
||||
pyminizip.compress_multiple(_24_group_list, [], str(CVS_folder) + '/' + "24bham.zip", "BhamSc@uts", 1)
|
||||
pyminizip.compress_multiple(_254_group_list, [], str(CVS_folder) + '/' + "254bham.zip", "BhamSc@uts", 1)
|
||||
@ -3361,8 +3411,8 @@ def convert_csv_xlsx():
|
||||
pyminizip.compress_multiple(_148_group_list, [], str(CVS_folder) + '/' + "148bham.zip", "BhamSc@uts", 1)
|
||||
pyminizip.compress_multiple(_325_group_list, [], str(CVS_folder) + '/' + "325bham.zip", "BhamSc@uts", 1)
|
||||
|
||||
CVS_group_list = [str(CVS_folder) + '/' + "81bham.zip", str(CVS_folder) + '/' + "192bham.zip", str(CVS_folder) + '/' + "24bham.zip", str(CVS_folder) + '/' + "254bham.zip", str(CVS_folder) + '/' + "89bham.zip",str(CVS_folder) + '/' + "220bham.zip", str(CVS_folder) + '/' + "260bham.zip",str(CVS_folder) + '/' + "100bham.zip",str(CVS_folder) + '/' + "219bham.zip",str(CVS_folder) + '/' + "198bham.zip",str(CVS_folder) + '/' + "232bham.zip",str(CVS_folder) + '/' + "258bham.zip",str(CVS_folder) + '/' + "29bham.zip",str(CVS_folder) + '/' + "279bham.zip",str(CVS_folder) + '/' + "304bham.zip",str(CVS_folder) + '/' + "148bham.zip",str(CVS_folder) + '/' + "325bham.zip",]
|
||||
pyminizip.compress_multiple(CVS_group_list, [], str(working_folder) + '/' + "cvs_groups.zip", "BhamSc@uts", 1)
|
||||
#CVS_group_list = [str(CVS_folder) + '/' + "81bham.zip", str(CVS_folder) + '/' + "192bham.zip", str(CVS_folder) + '/' + "24bham.zip", str(CVS_folder) + '/' + "254bham.zip", str(CVS_folder) + '/' + "89bham.zip",str(CVS_folder) + '/' + "220bham.zip", str(CVS_folder) + '/' + "260bham.zip",str(CVS_folder) + '/' + "100bham.zip",str(CVS_folder) + '/' + "219bham.zip",str(CVS_folder) + '/' + "198bham.zip",str(CVS_folder) + '/' + "232bham.zip",str(CVS_folder) + '/' + "258bham.zip",str(CVS_folder) + '/' + "29bham.zip",str(CVS_folder) + '/' + "279bham.zip",str(CVS_folder) + '/' + "304bham.zip",str(CVS_folder) + '/' + "148bham.zip",str(CVS_folder) + '/' + "325bham.zip",]
|
||||
#pyminizip.compress_multiple(CVS_group_list, [], str(working_folder) + '/' + "cvs_groups.zip", "BhamSc@uts", 1)
|
||||
|
||||
_74_group_list = [str(rea_folder) + '/' + '74_due_mandatory_training.xlsx', str(rea_folder) + '/' + '74_late_mandatory_training.xlsx']
|
||||
_191_group_list = [str(rea_folder) + '/' + '191_due_mandatory_training.xlsx', str(rea_folder) + '/' + '191_late_mandatory_training.xlsx']
|
||||
@ -3402,8 +3452,8 @@ def convert_csv_xlsx():
|
||||
pyminizip.compress_multiple(_218_group_list, [], str(rea_folder) + '/' + "218bham.zip", "BhamSc@uts", 1)
|
||||
pyminizip.compress_multiple(_332_group_list, [], str(rea_folder) + '/' + "332bham.zip", "BhamSc@uts", 1)
|
||||
|
||||
rea_group_list = [str(rea_folder) + '/' + "74bham.zip", str(rea_folder) + '/' + "191bham.zip", str(rea_folder) + '/' + "145bham.zip", str(rea_folder) + '/' + "108bham.zip", str(rea_folder) + '/' + "169bham.zip",str(rea_folder) + '/' + "293bham.zip", str(rea_folder) + '/' + "281bham.zip",str(rea_folder) + '/' + "277bham.zip",str(rea_folder) + '/' + "195bham.zip",str(rea_folder) + '/' + "238bham.zip",str(rea_folder) + '/' + "206bham.zip",str(rea_folder) + '/' + "283bham.zip",str(rea_folder) + '/' + "42bham.zip",str(rea_folder) + '/' + "95bham.zip",str(rea_folder) + '/' + "303bham.zip",str(rea_folder) + '/' + "113bham.zip",str(rea_folder) + '/' + "218bham.zip",str(rea_folder) + '/' + "332bham.zip",]
|
||||
pyminizip.compress_multiple(rea_group_list, [], str(working_folder) + '/' + "rea_groups.zip", "BhamSc@uts", 1)
|
||||
#rea_group_list = [str(rea_folder) + '/' + "74bham.zip", str(rea_folder) + '/' + "191bham.zip", str(rea_folder) + '/' + "145bham.zip", str(rea_folder) + '/' + "108bham.zip", str(rea_folder) + '/' + "169bham.zip",str(rea_folder) + '/' + "293bham.zip", str(rea_folder) + '/' + "281bham.zip",str(rea_folder) + '/' + "277bham.zip",str(rea_folder) + '/' + "195bham.zip",str(rea_folder) + '/' + "238bham.zip",str(rea_folder) + '/' + "206bham.zip",str(rea_folder) + '/' + "283bham.zip",str(rea_folder) + '/' + "42bham.zip",str(rea_folder) + '/' + "95bham.zip",str(rea_folder) + '/' + "303bham.zip",str(rea_folder) + '/' + "113bham.zip",str(rea_folder) + '/' + "218bham.zip",str(rea_folder) + '/' + "332bham.zip",]
|
||||
#pyminizip.compress_multiple(rea_group_list, [], str(working_folder) + '/' + "rea_groups.zip", "BhamSc@uts", 1)
|
||||
|
||||
_298_group_list = [str(spitfire_folder) + '/' + '298_due_mandatory_training.xlsx', str(spitfire_folder) + '/' + '298_late_mandatory_training.xlsx']
|
||||
_144_group_list = [str(spitfire_folder) + '/' + '144_due_mandatory_training.xlsx', str(spitfire_folder) + '/' + '144_late_mandatory_training.xlsx']
|
||||
@ -3441,8 +3491,8 @@ def convert_csv_xlsx():
|
||||
pyminizip.compress_multiple(_330_group_list, [], str(spitfire_folder) + '/' + "330bham.zip", "BhamSc@uts", 1)
|
||||
pyminizip.compress_multiple(_331_group_list, [], str(spitfire_folder) + '/' + "331bham.zip", "BhamSc@uts", 1)
|
||||
|
||||
spitfire_group_list = [str(spitfire_folder) + '/' + "298bham.zip", str(spitfire_folder) + '/' + "144bham.zip", str(spitfire_folder) + '/' + "34bham.zip", str(spitfire_folder) + '/' + "234bham.zip", str(spitfire_folder) + '/' + "237bham.zip",str(spitfire_folder) + '/' + "126bham.zip", str(spitfire_folder) + '/' + "87bham.zip",str(spitfire_folder) + '/' + "261bham.zip",str(spitfire_folder) + '/' + "118bham.zip",str(spitfire_folder) + '/' + "184bham.zip",str(spitfire_folder) + '/' + "155bham.zip",str(spitfire_folder) + '/' + "211bham.zip",str(spitfire_folder) + '/' + "309bham.zip",str(spitfire_folder) + '/' + "141bham.zip",str(spitfire_folder) + '/' + "305bham.zip",str(spitfire_folder) + '/' + "330bham.zip",str(spitfire_folder) + '/' + "331bham.zip"]
|
||||
pyminizip.compress_multiple(spitfire_group_list, [], str(working_folder) + '/' + "spitfire_groups.zip", "BhamSc@uts", 1)
|
||||
#spitfire_group_list = [str(spitfire_folder) + '/' + "298bham.zip", str(spitfire_folder) + '/' + "144bham.zip", str(spitfire_folder) + '/' + "34bham.zip", str(spitfire_folder) + '/' + "234bham.zip", str(spitfire_folder) + '/' + "237bham.zip",str(spitfire_folder) + '/' + "126bham.zip", str(spitfire_folder) + '/' + "87bham.zip",str(spitfire_folder) + '/' + "261bham.zip",str(spitfire_folder) + '/' + "118bham.zip",str(spitfire_folder) + '/' + "184bham.zip",str(spitfire_folder) + '/' + "155bham.zip",str(spitfire_folder) + '/' + "211bham.zip",str(spitfire_folder) + '/' + "309bham.zip",str(spitfire_folder) + '/' + "141bham.zip",str(spitfire_folder) + '/' + "305bham.zip",str(spitfire_folder) + '/' + "330bham.zip",str(spitfire_folder) + '/' + "331bham.zip"]
|
||||
#pyminizip.compress_multiple(spitfire_group_list, [], str(working_folder) + '/' + "spitfire_groups.zip", "BhamSc@uts", 1)
|
||||
|
||||
_143_group_list = [str(SCE_folder) + '/' + '143_due_mandatory_training.xlsx', str(SCE_folder) + '/' + '143_late_mandatory_training.xlsx']
|
||||
_21_group_list = [str(SCE_folder) + '/' + '21_due_mandatory_training.xlsx', str(SCE_folder) + '/' + '21_late_mandatory_training.xlsx']
|
||||
@ -3470,8 +3520,8 @@ def convert_csv_xlsx():
|
||||
pyminizip.compress_multiple(_326_group_list, [], str(SCE_folder) + '/' + "326bham.zip", "BhamSc@uts", 1)
|
||||
pyminizip.compress_multiple(_102_group_list, [], str(SCE_folder) + '/' + "102bham.zip", "BhamSc@uts", 1)
|
||||
|
||||
SCE_group_list = [str(SCE_folder) + '/' + "143bham.zip", str(SCE_folder) + '/' + "21bham.zip", str(SCE_folder) + '/' + "197bham.zip", str(SCE_folder) + '/' + "209bham.zip", str(SCE_folder) + '/' + "167bham.zip",str(SCE_folder) + '/' + "235bham.zip", str(SCE_folder) + '/' + "227bham.zip",str(SCE_folder) + '/' + "172bham.zip",str(SCE_folder) + '/' + "257bham.zip",str(SCE_folder) + '/' + "164bham.zip",str(SCE_folder) + '/' + "326bham.zip",str(SCE_folder) + '/' + "102bham.zip"]
|
||||
pyminizip.compress_multiple(SCE_group_list, [], str(working_folder) + '/' + "SCE_groups.zip", "BhamSc@uts", 1)
|
||||
#SCE_group_list = [str(SCE_folder) + '/' + "143bham.zip", str(SCE_folder) + '/' + "21bham.zip", str(SCE_folder) + '/' + "197bham.zip", str(SCE_folder) + '/' + "209bham.zip", str(SCE_folder) + '/' + "167bham.zip",str(SCE_folder) + '/' + "235bham.zip", str(SCE_folder) + '/' + "227bham.zip",str(SCE_folder) + '/' + "172bham.zip",str(SCE_folder) + '/' + "257bham.zip",str(SCE_folder) + '/' + "164bham.zip",str(SCE_folder) + '/' + "326bham.zip",str(SCE_folder) + '/' + "102bham.zip"]
|
||||
#pyminizip.compress_multiple(SCE_group_list, [], str(working_folder) + '/' + "SCE_groups.zip", "BhamSc@uts", 1)
|
||||
|
||||
_163_group_list = [str(SCW_folder) + '/' + '163_due_mandatory_training.xlsx', str(SCW_folder) + '/' + '163_late_mandatory_training.xlsx']
|
||||
_31_group_list = [str(SCW_folder) + '/' + '163_due_mandatory_training.xlsx', str(SCW_folder) + '/' + '31_late_mandatory_training.xlsx']
|
||||
@ -3491,8 +3541,8 @@ def convert_csv_xlsx():
|
||||
pyminizip.compress_multiple(_171_group_list, [], str(SCW_folder) + '/' + "171bham.zip", "BhamSc@uts", 1)
|
||||
pyminizip.compress_multiple(_242_group_list, [], str(SCW_folder) + '/' + "242bham.zip", "BhamSc@uts", 1)
|
||||
|
||||
SCW_group_list = [str(SCW_folder) + '/' + "163bham.zip", str(SCW_folder) + '/' + "31sutton.zip", str(SCW_folder) + '/' + "248bham.zip", str(SCW_folder) + '/' + "33bham.zip", str(SCW_folder) + '/' + "13bham.zip",str(SCW_folder) + '/' + "67bham.zip", str(SCW_folder) + '/' + "171bham.zip",str(SCW_folder) + '/' + "242bham.zip"]
|
||||
pyminizip.compress_multiple(SCW_group_list, [], str(working_folder) + '/' + "SCW_groups.zip", "BhamSc@uts", 1)
|
||||
#SCW_group_list = [str(SCW_folder) + '/' + "163bham.zip", str(SCW_folder) + '/' + "31sutton.zip", str(SCW_folder) + '/' + "248bham.zip", str(SCW_folder) + '/' + "33bham.zip", str(SCW_folder) + '/' + "13bham.zip",str(SCW_folder) + '/' + "67bham.zip", str(SCW_folder) + '/' + "171bham.zip",str(SCW_folder) + '/' + "242bham.zip"]
|
||||
#pyminizip.compress_multiple(SCW_group_list, [], str(working_folder) + '/' + "SCW_groups.zip", "BhamSc@uts", 1)
|
||||
|
||||
_25_group_list = [str(tame_folder) + '/' + '25_due_mandatory_training.xlsx', str(tame_folder) + '/' + '25_late_mandatory_training.xlsx']
|
||||
_114_group_list = [str(tame_folder) + '/' + '114_due_mandatory_training.xlsx', str(tame_folder) + '/' + '114_late_mandatory_training.xlsx']
|
||||
@ -3524,8 +3574,8 @@ def convert_csv_xlsx():
|
||||
pyminizip.compress_multiple(_327_group_list, [], str(tame_folder) + '/' + "327bham.zip", "BhamSc@uts", 1)
|
||||
pyminizip.compress_multiple(_333_group_list, [], str(tame_folder) + '/' + "333bham.zip", "BhamSc@uts", 1)
|
||||
|
||||
tame_group_list = [str(tame_folder) + '/' + "25bham.zip", str(tame_folder) + '/' + "114bham.zip", str(tame_folder) + '/' + "64bham.zip", str(tame_folder) + '/' + "236bham.zip", str(tame_folder) + '/' + "177bham.zip",str(tame_folder) + '/' + "210bham.zip", str(tame_folder) + '/' + "244bham.zip",str(tame_folder) + '/' + "213bham.zip",str(tame_folder) + '/' + "32bham.zip",str(tame_folder) + '/' + "5bham.zip",str(tame_folder) + '/' + "222bham.zip",str(tame_folder) + '/' + "313bham.zip",str(tame_folder) + '/' + "327bham.zip",str(tame_folder) + '/' + "333bham.zip"]
|
||||
pyminizip.compress_multiple(tame_group_list, [], str(working_folder) + '/' + "tame_groups.zip", "BhamSc@uts", 1)
|
||||
#tame_group_list = [str(tame_folder) + '/' + "25bham.zip", str(tame_folder) + '/' + "114bham.zip", str(tame_folder) + '/' + "64bham.zip", str(tame_folder) + '/' + "236bham.zip", str(tame_folder) + '/' + "177bham.zip",str(tame_folder) + '/' + "210bham.zip", str(tame_folder) + '/' + "244bham.zip",str(tame_folder) + '/' + "213bham.zip",str(tame_folder) + '/' + "32bham.zip",str(tame_folder) + '/' + "5bham.zip",str(tame_folder) + '/' + "222bham.zip",str(tame_folder) + '/' + "313bham.zip",str(tame_folder) + '/' + "327bham.zip",str(tame_folder) + '/' + "333bham.zip"]
|
||||
#pyminizip.compress_multiple(tame_group_list, [], str(working_folder) + '/' + "tame_groups.zip", "BhamSc@uts", 1)
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user