Added error-check if replacement is already assigned elsewhere
This commit is contained in:
parent
07ffe59aaf
commit
45e9df6a48
@ -13,10 +13,6 @@ import scheduledPayrollWindow as PWin
|
||||
#TODO document how to get through the cert expiration every week
|
||||
|
||||
#TODO do error checking within while loop (update text color / valid status)
|
||||
#TODO make an error if try to sub in a person if they are already working elsewhere at that time
|
||||
|
||||
|
||||
#TODO delete filename parameters in window functions (only helper functions need it)
|
||||
|
||||
|
||||
#---LOW PRIORITY (due to payroll being entered by ULAs directly)---
|
||||
|
@ -88,6 +88,15 @@ def isAssigned(netID,period,date):
|
||||
ret=True
|
||||
return ret
|
||||
|
||||
#Test if a ULA is assigned to ANY section at the given date-time, return the section if True, else return False
|
||||
def isBusy(netID,time,date):
|
||||
secD = pd.read_csv(sectionDatabaseFilename,dtype=str,index_col=False)
|
||||
filt = secD.loc[(secD['Time']==time) & (secD['Date']==date)].apply(lambda r: r.astype('string').str.contains(netID).any(),axis=1)
|
||||
if filt.any():
|
||||
return secD.loc[(secD['Time']==time) & (secD['Date']==date) & (secD.isin([netID]).any(axis=1))]['Section'].to_string(index=False)
|
||||
else:
|
||||
return False
|
||||
|
||||
#Overwrite a netID in one row of the section database with another
|
||||
def reassign(date,period,oldID,newID):
|
||||
secD = pd.read_csv(sectionDatabaseFilename,dtype=str,index_col=False)
|
||||
|
@ -1 +1 @@
|
||||
2023-10-11 14:08:24.903282
|
||||
2023-10-11 15:40:17.780872
|
@ -53,6 +53,12 @@ def subAppWin(staffDatabaseFilename,secDFilename,subRequestsFilename,subRequests
|
||||
subRequests[i][6]+=oldID+" not assigned\n" #Add to the list of errors with this request
|
||||
if newID != "" and HF.isAssigned(newID,period,date):
|
||||
subRequests[i][6]+=newID+" already assigned\n" #Add to the list of errors with this request
|
||||
#Test if replacement is already busy with a different section
|
||||
if newID != "":
|
||||
elsewhere = HF.isBusy(newID,HF.getTimeFromSection(period),date)
|
||||
if elsewhere != False:
|
||||
subRequests[i][6]+=newID+" assigned elsewhere ("+elsewhere+")\n" #Add to the list of errors with this request
|
||||
|
||||
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
|
Loading…
x
Reference in New Issue
Block a user