Win a 3 month subscription to Marco Behler Videos this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Setting preferences to employees  RSS feed

 
Swapna latha
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a question on setting preferences to employees. I have a list of date ranges with 52 weeks. Few weeks are repeated and are there in arraylist. Support first week of January is repeated for two times.Then the total number of weeks are 53. I will be giving preference to first employee. Dont know where to store i mean in a list or map ? Whatever the date range(week i.e., 01/01/2016-07/01/2016) that i have selected to first employee should also come to second employee as first preference. What ever the date range i have selected to first and second employee should also come to third one and so on.

The question is that the date range selection for first employee may be three weeks or two weeks as blocks (continuous weeks i.e., 01/01/2016-07/01/2016 , 08/01/2016-15/01/2016 and should be store as preference 1.Based on the need of weeks for second employee, might be one week or two weeks or three weeks, which are added to first employee to be added to second employee. Apart from that i need to add a new date range also to second employee which is not there in first employee. That is for second employee i need two date range preferences, one from the first employee preference, and second one is a distinct one which is not there in first one. Can any throw an light on this ?


Thanks & Regards,

Swapna Kori.
 
praveen kumaar
Ranch Hand
Posts: 456
22
Android Chrome Eclipse IDE Google App Engine Java Notepad Oracle Ubuntu Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi swapna,
The question is bit ambiguous.can you show us whatever you have tried may be that could help.

Kind Regards,
Praveen.
 
Swapna latha
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Praveen,

The problem is i have an arraylist of 52 weeks as preferences. 1st week is number as 1, 2nd week as 2, 3rd week as 3 and so on. Now question is if three employees have to chose the preferences in the order of seniority. The seniority chosen preference is to be awarded to him , meaning he has to get that one to him. So if 2nd employee chooses the same preference as the first senior employee, then second emplyee should not get awarded as it was awarded to first employee. So second employee chooses two preferences, one is the preference chosen by first employee and the other one is a different one. So the second employee should get the 2nd preference awarded. The third employee may choose any of the preferences of 2nd or 1st employee preferences and will check for award based on seniority. Got the question right ?
 
Junilu Lacar
Sheriff
Posts: 10929
158
Android Debian Eclipse IDE IntelliJ IDE Java Linux Mac Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does this have something to do with shift scheduling or vacation scheduling? The requirements seem very peculiar in that even though one employee has already been given the choice of a week, that same week still needs to be given as a choice to other employees. Seems pointless if they can't choose a week anyway because a more senior employee has already chosen it.
 
praveen kumaar
Ranch Hand
Posts: 456
22
Android Chrome Eclipse IDE Google App Engine Java Notepad Oracle Ubuntu Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Swapna,
junilu puts a very strong point.if you want the employee to chose the week accordingly with the seniority than why are you letting others to have this option.don't you think it's a kind of waste or fun with them(think practically,these kind of situations rarely exists).

Anyway,how would you store the weeks in the array list.i mean do you have the class for it or enum.IMO you can use an another arraylist.
when a senior does his selection than remove that week from 1st arraylist and put it in the 2nd one.when the 2nd employ choose his option kindly match the selection in the second arraylist.if it is present in the 2nd one deny him for that option.
Another approach,use a nested private class for the week and use a boolean variable in it,set it to false(default).provide an implementation so that when a employ selects that week from list then its boolean variable gets true.next time when any other employee selects that option then check for that variable if found true then the implementation should deny for it.

i have provided both the approaches with a little thinking and neither i have tried it.but i am providing this as may be it can help you to build a base for starting.

Kind regards,
Praveen.
 
Swapna latha
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Junilu Lacar wrote:Does this have something to do with shift scheduling or vacation scheduling? The requirements seem very peculiar in that even though one employee has already been given the choice of a week, that same week still needs to be given as a choice to other employees. Seems pointless if they can't choose a week anyway because a more senior employee has already chosen it.


Hi Junilu,

It has something to do with vacation scheduling. Just trying to find out an idea of how to really do the algorithm for this.
 
Junilu Lacar
Sheriff
Posts: 10929
158
Android Debian Eclipse IDE IntelliJ IDE Java Linux Mac Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How about you focus on your user experience first? If I were a user of the system, I'd certainly find it annoying to be given a choice and then told that it wasn't a valid choice after all. Once you figure out what the user experience would be like, it's easier to work backwards from there to see what the internal implementation would need to be to support it.
 
Swapna latha
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Junilu Lacar wrote:How about you focus on your user experience first? If I were a user of the system, I'd certainly find it annoying to be given a choice and then told that it wasn't a valid choice after all. Once you figure out what the user experience would be like, it's easier to work backwards from there to see what the internal implementation would need to be to support it.

I have an approach in mind. I am working on it. Once i build a skeleton form of it, will post the details with code.

thanks & regards,

Swapna
 
Swapna latha
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Swapna latha wrote:
Junilu Lacar wrote:How about you focus on your user experience first? If I were a user of the system, I'd certainly find it annoying to be given a choice and then told that it wasn't a valid choice after all. Once you figure out what the user experience would be like, it's easier to work backwards from there to see what the internal implementation would need to be to support it.

I have an approach in mind. I am working on it. Once i build a skeleton form of it, will post the details with code.

thanks & regards,

Swapna


Hi Junilu,

I got an simple approach. First I am setting the preference with key value pari in map. After each selection of dates the key value pairs are selected. From the employees i sorted out the most senior employee based on seniority date and then assigned him the same date as he is more senior and removed that date from available weeks and assigned the second senior from the chosen dates and available dates and so on.

Thanks & Regards,

Swapna.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!