DavidD003 commited on
Commit
4d0c01f
·
1 Parent(s): 0bba133

Update SchedBuilderClasses2.py

Browse files
Files changed (1) hide show
  1. SchedBuilderClasses2.py +32 -4
SchedBuilderClasses2.py CHANGED
@@ -53,6 +53,9 @@ class Slot():
53
  #del sch.slots[self.key()]
54
  if slAssignee is not None: #Case of specific assignment, only not follwoed through when its no ee and DNS
55
  sch.ee[slAssignee].assnBookKeeping(self,sch) #add this slot to the ee's assigned slot dictionary & other tasks
 
 
 
56
  #Logging for printout after
57
  if assnType!=None and slAssignee!=None:
58
  logTxt=''
@@ -250,7 +253,7 @@ class ee():
250
  return False
251
 
252
  class Schedule():
253
- def __init__(self,Acrew,slots,ee,preAssn,senList,polling,slLeg,sF=False,pNT=False,assnWWF=False,pVol=False,xtraDays=None,maxI=100):
254
  # self.ftInfoTbl=ftInfoTbl
255
  self.xtraDays=xtraDays #Selected on Gradio interface. a list of Monday and or Friday if those are to be scheduled. Used obly for gapOK funciton
256
  if 'Friday' in xtraDays: self.friOT=True
@@ -277,8 +280,9 @@ class Schedule():
277
  seqIDs=[int(k[:k.index('_')]) for k in self.slots]
278
  self.rev=0
279
  self.noVol=[] #A list to contain keys of slots with no eligible volunteers.
280
- self.assns=0
281
  self.maxI=maxI
 
282
 
283
  # @debug
284
  def trackAssn(self,i=0,loc=None):
@@ -635,9 +639,9 @@ class Schedule():
635
  # return self.fillOutSched_v3(WIPschd.noVol,iter,pre8=pre8,last=WIPschd)
636
  WIPschd.assnLog.extend([str(i)+' of '+str(NumSl-1)])
637
  if i==NumSl-1:
638
- WIPschd.assnLog.extend(['MADE IT'])
639
  self.assnLog.extend(WIPschd.assnLog) #Add whats been logged this final iteration to master log
640
- WIPschd.assnLog=self.assnLog #Replace WIP with the master since WIP sched object being passed as final outcome
641
  # return self.fillOutSched_v3(WIPschd.noVol,iter,pre8=pre8,winner=WIPschd)
642
  return WIPschd#,'WIN' #Once all voluntary assignments made, schedule done? May need to force more, or go through force function to designate 'no staff' slots
643
  else: #Case that assignment being made resulted in more slots being left with no EligVol.. add those slots to noVol list and re start the function
@@ -1033,6 +1037,30 @@ class Schedule():
1033
  ws2.cell(row=n+1,column=2+c).value=self.slLeg[self.slots[k].seqID-1][2]+' ('+self.slLeg[self.slots[k].seqID-1][1]+')'
1034
  c+=1
1035
  #==========================
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1036
 
1037
  wb.save(filename = dest_filename)
1038
  return dest_filename
 
53
  #del sch.slots[self.key()]
54
  if slAssignee is not None: #Case of specific assignment, only not follwoed through when its no ee and DNS
55
  sch.ee[slAssignee].assnBookKeeping(self,sch) #add this slot to the ee's assigned slot dictionary & other tasks
56
+ sch.assignments+=1
57
+ sch.aOnly.append((sch.assignments,sch.ee[slAssignee].dispNm(),self.key(),assnType))
58
+
59
  #Logging for printout after
60
  if assnType!=None and slAssignee!=None:
61
  logTxt=''
 
253
  return False
254
 
255
  class Schedule():
256
+ def __init__(self,Acrew,slots,ee,preAssn,senList,polling,slLeg,sF=False,pNT=True,assnWWF=False,pVol=True,xtraDays=None,maxI=100):
257
  # self.ftInfoTbl=ftInfoTbl
258
  self.xtraDays=xtraDays #Selected on Gradio interface. a list of Monday and or Friday if those are to be scheduled. Used obly for gapOK funciton
259
  if 'Friday' in xtraDays: self.friOT=True
 
280
  seqIDs=[int(k[:k.index('_')]) for k in self.slots]
281
  self.rev=0
282
  self.noVol=[] #A list to contain keys of slots with no eligible volunteers.
283
+ self.assignments=1
284
  self.maxI=maxI
285
+ self.aOnly=[]
286
 
287
  # @debug
288
  def trackAssn(self,i=0,loc=None):
 
639
  # return self.fillOutSched_v3(WIPschd.noVol,iter,pre8=pre8,last=WIPschd)
640
  WIPschd.assnLog.extend([str(i)+' of '+str(NumSl-1)])
641
  if i==NumSl-1:
642
+ WIPschd.assnLog.extend(['Done.'])
643
  self.assnLog.extend(WIPschd.assnLog) #Add whats been logged this final iteration to master log
644
+ WIPschd.assnLog=self.assnLog #Replace WIP with the master now that master had WIP tacked on to WWF assn since WIP sched object being passed as final outcome
645
  # return self.fillOutSched_v3(WIPschd.noVol,iter,pre8=pre8,winner=WIPschd)
646
  return WIPschd#,'WIN' #Once all voluntary assignments made, schedule done? May need to force more, or go through force function to designate 'no staff' slots
647
  else: #Case that assignment being made resulted in more slots being left with no EligVol.. add those slots to noVol list and re start the function
 
1037
  ws2.cell(row=n+1,column=2+c).value=self.slLeg[self.slots[k].seqID-1][2]+' ('+self.slLeg[self.slots[k].seqID-1][1]+')'
1038
  c+=1
1039
  #==========================
1040
+ #Print succint assignment log to a separate sheet
1041
+ ws2 = wb.create_sheet(title="Succint Assn Log")
1042
+ ws2.cell(row=1,column=1).value="This data can be used on Tab C of the schedule building web app to investigate what a schedule looked like mid-generation"
1043
+ ws2.cell(row=2,column=1).value='Assn #'
1044
+ ws2.cell(row=2,column=2).value='EE Nm'
1045
+ ws2.cell(row=2,column=3).value='Slot #_Job Nm'
1046
+ ws2.cell(row=2,column=4).value='Assignment Type'
1047
+ n=1
1048
+ for rec in self.aOnly:
1049
+ ws2.cell(column=1,row=2+n).value=rec[0]
1050
+ ws2.cell(column=2,row=2+n).value=rec[1]
1051
+ ws2.cell(column=3,row=2+n).value=rec[2]
1052
+ ws2.cell(column=4,row=2+n).value=rec[3]
1053
+ #==========================
1054
+ #Print verbose assignment log to a separate sheet
1055
+ ws2 = wb.create_sheet(title="Verbose Ass'n Log")
1056
+ ws2.cell(row=2,column=1).value='List of assignment decisions made throughout scheduling process'
1057
+ # ws2.cell(row=1,column=1).value='Note that the seniority value presented is not actual plant seniority number, but just the sequence of '
1058
+ n=1
1059
+ for rec in self.assnLog:
1060
+ ws2.cell(column=1,row=2+n).value=rec
1061
+ n+=1
1062
+
1063
+
1064
 
1065
  wb.save(filename = dest_filename)
1066
  return dest_filename