-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakeShiftFile.py
More file actions
executable file
·35 lines (35 loc) · 1.21 KB
/
makeShiftFile.py
File metadata and controls
executable file
·35 lines (35 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
###date, shift, identifier, points, weekday or end, date in mm/dd/yy'
import calendar
from datetime import date
year=2021
month_range=[1]
shift_order = ['Night', 'Day', 'Swing']
filename='Shift_TEST.csv'
lines=[]
####may to september
for month in month_range:
month_c = calendar.monthcalendar(year, month)
for week in month_c:
for day in week:
if day==0:
pass
else:
d = date(year, month, day)
if week.index(day)<4:
daytype='Weekday'
points = [10,10,10] # 6 4 4
else:
daytype='Weekend'
points=[10,10,10] # 3.5 3 3
for i in range(3):
s = d.strftime('%d-%b')+','+shift_order[i]+','+str(i)+','+str(points[i])+','+daytype+' '+str(shift_order[i])+','+d.strftime(''"%m/%d/%y")+'\n'
print(s)
if week.index(day)==0:
lines.append(s)
elif week.index(day)==4:
lines.append(s)
else:
pass
f=open(filename,'w')
f.writelines(lines)
f.close()