updated to 3 months

This commit is contained in:
stug 2022-05-28 16:35:47 +01:00
parent e9c82ceae0
commit 2b0fd9f1c9

View File

@ -89,6 +89,8 @@ def training_report():
#Create a list using the CSV file
input_data_reader = csv.reader(input_file)
input_data = list(input_data_reader)
#2.1 Set months variable
due_months = 3
#3. Process the data
#Start at row 1 for the OSM output
@ -129,8 +131,8 @@ def training_report():
except:
#this executes if the membership number is not in the list
safety_missing_list.append(member_number)
#Establish comparative date - set at 6 months
Xmonths_later = datetime.datetime.now() + relativedelta(months=+6)
#Establish comparative date - set by variable
Xmonths_later = datetime.datetime.now() + relativedelta(months=+due_months)
#If date is less than 6 momths from when program is ran, add to list using known_name, surname, email, member_role, group, district, training module
if safety < Xmonths_later and safety >= today:
safety_due_mandatory.writerow([input_data[line_num][0], input_data[line_num][3], input_data[line_num][2], input_data[line_num][4], input_data[line_num][5], input_data[line_num][8], input_data[line_num][13], input_data[line_num][21], input_data[line_num][19], input_data[line_num][37], '', ''])
@ -214,11 +216,11 @@ def training_report():
statistics_file.write('====================================\n')
statistics_file.write('\n')
statistics_file.write('Leaders who are late with Safety module: ' + str(len(safety_missing_list))+'\n')
statistics_file.write('Leaders who need to complete the Safety module within 6 months: ' + str(len(safety_due_list))+'\n')
statistics_file.write('Leaders who need to complete the Safety module within ' + str(due_months) + ' months: ' + str(len(safety_due_list))+'\n')
statistics_file.write('Leaders who are late with Safeguarding module: ' + str(len(safeguarding_missing_list))+'\n')
statistics_file.write('Leaders who need to complete the Safeguarding module within 6 months: ' + str(len(safeguarding_due_list))+'\n')
statistics_file.write('Leaders who need to complete the Safeguarding module within ' + str(due_months) + ' months: ' + str(len(safeguarding_due_list))+'\n')
statistics_file.write('Leaders who are late with First Aid module: ' + str(len(firstaid_missing_list))+'\n')
statistics_file.write('Leaders who need to complete the First Aid module within 6 months: ' + str(len(firstaid_due_list))+'\n')
statistics_file.write('Leaders who need to complete the First Aid module within ' + str(due_months) + ' months: ' + str(len(firstaid_due_list))+'\n')
#5: Close files to show they are done
safety_late_mandatory_file.close()
safeguarding_late_mandatory_file.close()