Keep the replies on the list, please.On Oct 3, 2008, at 1:19 PM, WebObjects wrote: Hello So let me review:
You have Employees that will be signing up for Turns to work, right? The thing you need to know about the Employees is just their name (worry about how they log in later). The thing you need to know about the Turns are What the starting date & time, the ending date and time. For the first. Yes, I have Employees that will sign up for Turns to work on. 2nd. I was thinking to log in with the email address.
Right, but that's extra right now. How they log in is separate from the core business function of your application. Keep the number of things to think about small for now.
Stop. Normally? You can't model "Normally". If the Turns are variable at all, then you should work from the assumption that they all can change. ie. Monday has 4 Turns, startinng from 9am, and ending at 9pm, so we have a 3 hours /turn. THis turns are already set by the admin. for each day. ,.. but actually they are the same, from mon-fri, but on sat and sun are different.... maybe this info is useful.
This is exactly what I was talking about above. If Saturday and Sunday are already different, what about holidays?
Key questions:
1) Can more than one Employee sign up for the same Turn? 2) Are Turns the same (same start and end) from day-to-day? For each day of the week? 3) Can turns span two days? 4) Are any of these assumptions likely to change?
1. Yes. thats why I have( was thinking to have) maxEmployee attribute in turns
Okay, but I'm guessing that the max will very depending upon the day. Not every turn for all days will have the same maxEmployees, right? 2. Opps as I wrote, maybe I wasn't clear in the last mail. From mon - fri they are exactly the same. but from sat and sun they change. 3.I dunno what you mean.. If a turn can be in 2 days,??
Would a turn span from 10pm to 2am the next day? If so, you can't just store a date, you have to store a date-time. 4. Yes, depending on the admin, ie. if he sees that in the 3rd turn of wed the store its really full, he will need more employees working on that turn. and so on.
Okay, so you have to model the application to allow for the changes. Ok so. So far.. NO PK for eMail attribute. Just set it to Unique in the db schema. GOT IT. :D What is code? What is maxEmployee?
code its the numerical code of the turn, for mon the code will be 01 and the first turn will be 01 so the whole code will be 0101, for the second turn of monday will be 0102, and so on.. the same for the rest days, depending on the day. ie. Friday second turn will be 0502.
maxEmploeyy its the maxNumber of employes a turn may have.... mmmm.. maybe I should have a min as well?
Yes, and maybe an "ideal" so that the manager can say "Ideally I'd like 2, but I'll accept either 1 or 2 or 3" and the Employee can know that if the ideal has been reached, then their request may be denied, or something like that.
Employee <->> EmployeeTurn <<-> Turn <<-> WorkDay
Employee id email name password
Turn id startDateTime endDateTime minEmployees idealEmployees maxEmployees
EmployeeTurn id idEmployee idTurn creationTimestamp
WorkDay id dayOfWeek startingDateTime
This gives you the ability to get a WorkDay, and all of the turns() that are related. Each Turn then has employeeTurns() that give you a list of all the employees signed up for a turn, and when they signed up. You could also add an EmployeeTurnStatus table that would keep track of various statuses such as pending, approved, rejected, etc.
I'd plan on dynamically creating the "code" instead of setting it as a value in the DB. You can easily take the day of the week and the index of the Turn in the sorted array of Turns to create this on the fly, and if you change the Turns time or day it will automatically update.
The "code" for a given EmployeeTurn can simply be gotten by calling turn().code() so you don't need it on the EmployeeTurn entity.
Added bennifit is that when the Admin is setting up the Turns, you can easily validate the start and end times by comparing them to the WorkDay startingTime and the start and end times for other Turns that have been already created.
As far as most days being the same, you could easily setup a properties file that has that info in it and then add a button that creates the WorkDays for a week based on the values in the properties file, that way if you want to make Fridays have different Turns too, you don't have to change code, just open the properties file.
On a side note, this is the type of exercise that I love using D2JC for. You can make you model, run it, try it out, see where things are weird, change the model, run it again. No UI code or refactoring required.
Dave
Gus
On Oct 3, 2008, at 10:35 AM, David Avendasora wrote: On Oct 3, 2008, at 11:00 AM, WebObjects wrote: Hello, Well I have a dilemma here. Im not too good with db desings,.. so what I have its the following:
A table Employee with the following attributes:
id:PK
eMail
name
password.
a table Turn with the following
day (The name of the week day)
id:PK
code
startingTime
endTime
maxEmployee
What is code? What is maxEmployee?
and a Join table created via (create relationship button)
TurnXEmployee
id:pk
dateOfTurn
code
idEmployee
idTurn
the code's atributes are like the oid's
Hmm.... This implies that each Turn can have multiple employees working on it and the dateOfTurn and code can be different for each Employee/Turn combination. That doesn't seem right. If two employees can be assigned to one Turn, then the date should be the same too, right? ok so a few questions... should I put the eMail as Pk in the EOModel..
NO! Email addresses can change. Also, since you are designing a DB from scratch, NEVER use a real-world piece of information as a PK. NEVER. You are only asking for trouble later when something that everyone says will never change, changes. or just put it as Unique in the db schema in openbase?
Yes, if it is really, truly unique. Is it possible for an Employee to have more than one address? Can an address migrate from person to person as they come and go? the same question as for the codes.?
Same answer and questions as eMail. in the TurnXEmployee, I will need to add the code as pk(inEOModeler) or unique(in the DB)? this is because a Employee may have multiple turns, btu at the same time multiple turns of day "monday" ie.
and the same question for eMail in Employee table?
What exactly is the code field doing for you? Now. I asked a few days ago about the way to make this work. Overview: An Employee will log in to the system ( via eMail and password) and then a new page loads with a selectable calendar made with JS. when the user selects a day then in the right part of the page the turns for the selected day (day of the week) (mon - sun) will appear and the user can select during what time he want to work. and then submit. I read about the AjaxUpdateContainer, and the bindings it should have. but I dont know too much about JS or Ajax. (Im on the process in learning, pain in the ass), my question its.. if a WOIframe will work too? or will be easier and nicer to do it with the AjaxUpdateContainer. I tried to see the examples but could not find them...
Stop. Get the model right before you worry about what the UI is going to look like. Obviously you need to have an idea of what kind of information the user will be seeing/selecting, but don't worry about the design of the UI yet. If the data/object model is right, the UI will be obvious. So let me review: You have Employees that will be signing up for Turns to work, right? The thing you need to know about the Employees is just their name (worry about how they log in later). The thing you need to know about the Turns are What the starting date & time, the ending date and time. Key questions: 1) Can more than one Employee sign up for the same Turn? 2) Are Turns the same (same start and end) from day-to-day? For each day of the week? 3) Can turns span two days? 4) Are any of these assumptions likely to change? Dave
|