2

I have two tables, let's call them leave_request and the other one leave_given.

The employee submit a leave_request to take a vacation where he has to fill place of vacation, date of start, date of end, reason etc.

The boss of that employee will proceed that request and decide whether the employee can take the vacation or not. If he gives him one, leave_given is filled with the details that the employee gave (date start and date end might change as the boss may not like the dates).

Now, regarding the 'Status' of the request. I was first thinking that If id of leave_request is not found on leave_given then It's rejected If it's there then It's accepted which I believe make sense.

I'm however writing an application and I want the user to know If the request has not been proceed yet so I will have to add a status field.

My question is, does it make sense to do the following:

  • Add status in leave_request?
  • Once the employee make a request, Status is on hold by default.
  • If the boss accepts it, status will change to Accepted and It will be added to leave_given. If rejected, the status will change to Rejected and nothing will be added to leave_given.
  • I would use a single table (e.g. leave) with status values requested, accepted, and rejected. – Dan Guzman Jun 30 '18 at 17:14
  • I have to make two because the requested may not be the same as the given one. Can we say that my proposition make sense If we are using two tables? – Black Panther Jun 30 '18 at 17:23
  • With the single table design, there would be separate columns instead of tables. The request dates would be NOT NULL and accepted dates NULL until the request is accepted. – Dan Guzman Jun 30 '18 at 21:05
  • @black, is there any possibility of a manager giving leave without a request. To answer your question specifically, a status on leave request will be required under any scenario to record denied requests – LJ01 Jul 1 '18 at 9:34
  • 1
    @black. On that basis I would suggest that there are two different events, leave request and leave granted. A leave granted has an optional'source request' and a leave request has a status. granting leave creates a leave granted entry. Say 3 days were requested and day 1 + day 3 we're granted (not day 2) you could end up with 2 leave granted / request, and then leave taken should theoretically be a separate entity too, in order to be able to handle where an employee takes more / less leave than Is granted... – LJ01 Jul 8 '18 at 4:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.