Added functionality to avoid catching people who are missing first aid in the first 3 years of a role.
This commit is contained in:
parent
0407bd69e4
commit
a47094f4e9
@ -4,8 +4,8 @@
|
|||||||
#Licence: GPL-3.0-or-later
|
#Licence: GPL-3.0-or-later
|
||||||
#Written by Stuart Griffiths, stuart.griffiths@birminghamscouts.org.uk
|
#Written by Stuart Griffiths, stuart.griffiths@birminghamscouts.org.uk
|
||||||
#Started 19/05/2022
|
#Started 19/05/2022
|
||||||
#Version:0.6
|
#Version:0.7
|
||||||
#Released: 02/10/2022
|
#Released: 30/05/2023
|
||||||
#Status: Working - outputs to 2 seperate CSV files
|
#Status: Working - outputs to 2 seperate CSV files
|
||||||
#Inputs: CSV
|
#Inputs: CSV
|
||||||
#Outputs: multiple CSV and 1 x text file
|
#Outputs: multiple CSV and 1 x text file
|
||||||
@ -165,7 +165,6 @@ def training_report():
|
|||||||
multi_role = False
|
multi_role = False
|
||||||
if next_line_membership != current_line_membership:
|
if next_line_membership != current_line_membership:
|
||||||
#3.1 acquire dates
|
#3.1 acquire dates
|
||||||
#Get today's date
|
|
||||||
today1 = str(datetime.date.today())
|
today1 = str(datetime.date.today())
|
||||||
today = datetime.datetime.strptime(today1, "%Y-%m-%d") #dodgy work around comparing datetime to date object error
|
today = datetime.datetime.strptime(today1, "%Y-%m-%d") #dodgy work around comparing datetime to date object error
|
||||||
#Establish comparative date - set by variable
|
#Establish comparative date - set by variable
|
||||||
@ -321,9 +320,16 @@ def training_report():
|
|||||||
#3.3.3 First Aid
|
#3.3.3 First Aid
|
||||||
#Read the column
|
#Read the column
|
||||||
firstaid = input_data[line_num][40]
|
firstaid = input_data[line_num][40]
|
||||||
|
#Check if in first 3 years of role
|
||||||
|
three_years_later = role_start + relativedelta(months=+36)
|
||||||
|
#compare to today
|
||||||
|
if today < three_years_later:
|
||||||
|
first_3years = True
|
||||||
|
else:
|
||||||
|
first_3years = False
|
||||||
#Check is it late?
|
#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 date is blank, not in first 3 years and first aid is required, 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 and newbie == False:
|
if firstaid == "" and role_training == True and firstaid_required == True and newbie == False and first_3years == False:
|
||||||
firstaid_status = True
|
firstaid_status = True
|
||||||
member_number = input_data[line_num][0]
|
member_number = input_data[line_num][0]
|
||||||
#check whether membership number is in the index and add it if not
|
#check whether membership number is in the index and add it if not
|
||||||
@ -450,8 +456,10 @@ def training_report():
|
|||||||
if input_data[line_num][41] != "":
|
if input_data[line_num][41] != "":
|
||||||
#Convert string to date object, has to be done here for the blanks!
|
#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")
|
firstaid = datetime.datetime.strptime(input_data[line_num][41], "%d/%m/%Y")
|
||||||
|
#Check if in first 3 years of role
|
||||||
|
three_years_later = role_start + relativedelta(months=+36)
|
||||||
#If date is less than 6 months from when program is ran, add to list using known_name, surname, email, member_role, group, district, training module
|
#If date is less than 6 months from when program is ran, add to list using known_name, surname, email, member_role, group, district, training module
|
||||||
if firstaid < Xmonths_later and firstaid >= today:
|
if firstaid < Xmonths_later and firstaid >= today and today >= three_years_later:
|
||||||
firstaid_due_status = True
|
firstaid_due_status = True
|
||||||
member_number = input_data[line_num][0]
|
member_number = input_data[line_num][0]
|
||||||
#check whether membership number is in the index and add it if not
|
#check whether membership number is in the index and add it if not
|
||||||
|
Loading…
Reference in New Issue
Block a user