+ 1

Making a schedule program which takes month, year and workers as input.

I would like to make a program in Python which makes a schedule. Input will be month, year and number of workers. Requested output is workers assigned to days in the specified month, in a list format. Frome there on I would like to expand the program, e.g. giving the workers the option to specify preferences and apply rules for working a maximum number of days. For now I have some experience with scripting in Python but don't really know where to start. Some one any advise?

31st Oct 2017, 11:55 AM
MarkW
MarkW - avatar
3 ответов
+ 1
Thanks for your reaction. The first practical problem I run into is how to assign the workers to a specific day in a list. So fare I have made a list in which I have stored the days of the month and the day of the week. Now I would like to assign workers to the list. By doing so I would like to set certain rules, like a worker will not have a morning shift after a night shift and a worker will not work longer than 3 days in a row. I have a whole set of these kind of rules but for now I would like to start with assigning workers to a day with one of these rules which I can extend later on. This is the code I have so far: def kalender(year, month): import calendar kalender = calendar.monthcalendar(year,month) m = [] for i in range(len(kalender)): #makes every day a nested list for n in range(len(kalender[i])): kalender[i][n] = [kalender[i][n]] kalender[i][n].append(n) for i in range(len(kalender)): #removes the week list m = m + kalender[i] kalender = [] for i in range(len(m)): #removes empty days if m[i][0] != 0: kalender.append(m[i]) return kalender Any remarks on this code are appreciated as any suggestions how to assign workers tot the list as described above.
1st Nov 2017, 10:05 AM
MarkW
MarkW - avatar
0
Okay good thought, we can mix it up things starting up getting into know how calender api or predefined library works to make it more advanced or we can just ask for essential inputs like month , year and workers total. Secondly , we can logical develop in such a way our end result would be into excel formate because details into proper formate is more appealing. After that I've made individual worker account then yes sure it can be changed by worker which is been assigned to do work for 5 month but someone he would able to give 4 months 13 days. We can even calculate how long worker worked and in total how much time it will take to complete the task. Then you can sub divide the categorization of work like dividing into small groups of task where worker can flexiabley change the assigned day at FIRST TIME. Furthermore put your main concern on making project model. Once you would be clear with model and wireframming , implementing would become much more smoother because till that time every picture would be stear clear to you. All the very best
31st Oct 2017, 7:23 PM
Vipul Walia
Vipul Walia - avatar
0
Okay well you should think this way also like we have to assign particular day, month and year to particular workers (single element of the list) or to the group of workers (complete list of the workers). So while assigning mention the id of the worker and timestamp with it. Now comming to rules part first we have to get how much work a worker had done in hrs and from date to till date then we have to divide shifts into two mrg and nght 6hrs each with different time stamps like 00:00 to 6:00 and 6:00 to 24:00 .....now check in which section a worker worked if he is exceeded the work limits or not then count the days he worked in mrg or nght shift if he worked in mrg shift it will be assigned to nght shift automatically. Either i would brief you with alogo or you should give it try to do it step by step as you're mentioning the rules try to put in a loops and conditional statements. Don't worry I'll be in touch and keep working on it the minute you waste will cost you an hr ...if any problem in logic making then take a pen and paper and pin it down each things....make a flow first what then what thrn what and implement it.
1st Nov 2017, 11:27 AM
Vipul Walia
Vipul Walia - avatar