fmla_leave v1

The FMLA leave an employee has left in a 12-month period, in minutes: it starts at what the employee is entitled to, and a designation holds what will be taken

fmla_leave.book, as chobo doc writes it. Each account keeps a balance: what came in, less what went out. Every transfer keeps the bounds of the accounts: one that would break a bound is refused with the name the book gives that bound, and nothing of it moves. A transfer either moves at once (do), or first holds what it moves (hold); a hold is then posted (post, all of it or part), voided (void), or expires.

Accounts

AccountOne for eachUnitBoundsWhat it is
leaveemployee, periodminat least 0; a transfer that would go below is refused with not_enough_leavewhat is left of the 12 or 26 workweeks of 29 CFR 825.200
entitledone accountminoutside the book: no bounds, and it may go below 0where what an employee is entitled to comes from
takenone accountminoutside the book: no bounds, and it may go below 0where the leave goes once it is taken

How things move

How things move between the accounts of fmla_leave entitle designate leave(employee, period)minat least 0 (not_enough_leave) entitledmin · outside takenmin · outside

A box is an account, and an arrow a move of a transfer. A rounded, dashed box is an account outside the book, which has no bounds. A dashed arrow belongs to a transfer that holds first, and moves when the hold is posted.

Transfers

entitle

what the employee is entitled to in the period, from the rule fmla_entitlement

  • Moves minutes from entitled to leave(employee, period).
  • Key: once per employee and period. The same call again does nothing, and answers done_before; one that differs only in minutes is refused with key_conflict.
  • Moves at once (do).
OperationMay be refused withWhen
entitle.dokey_conflicta call with the same employee and period and other arguments came before
How each refusal comes about

entitle.do: key_conflict

 1  entitle.do(employee: employee-1, period: period-2, minutes: 1)  done
 2  entitle.do(employee: employee-1, period: period-2, minutes: 2)  refused: key_conflict

designate

held while the leave is designated: posted when it is taken, voided when it is not

  • Moves minutes from leave(employee, period) to taken.
  • Key: once per request. The same call again does nothing, and answers done_before; one that differs only in employee, period or minutes is refused with key_conflict; holding again with the same key after the hold has ended answers done_before, and holds nothing.
  • Holds first: the caller posts or voids the hold. It never expires, and stays held until one of them comes.
designate.hold held post posted void is refused: already_posted post for other amounts: key_conflict void voided post is refused: already_voided
The holdpostvoid
heldposts it: the amounts given, or all of it, and the rest goes back; more than it holds is refused with over_holdvoids it: what it holds goes back
posteddone_before with the same amounts; refused with key_conflict with othersrefused with already_posted
voidedrefused with already_voideddone_before
no hold with the keyrefused with no_such_holdrefused with no_such_hold
OperationMay be refused withWhen
designate.holdnot_enough_leaveleave(employee, period) would go below 0
designate.holdkey_conflicta call with the same request and other arguments came before
designate.holdalready_refuseda call with the same request and other arguments was refused by a bound before; a key a bound refused stays refused, even once there is enough (the same call again is refused with the same reason)
designate.postkey_conflictthe hold was posted before, for other amounts
designate.postalready_voidedthe hold is voided already
designate.postover_holdmore than the hold holds
designate.postno_such_holdthere is no hold with that request
designate.voidalready_postedthe hold is posted already
designate.voidno_such_holdthere is no hold with that request
How each refusal comes about

designate.hold: not_enough_leave

 1  designate.hold(request: request-1, employee: employee-2, period: period-3, minutes: 1)  refused: not_enough_leave (move 1 takes 1 from leave(employee-2, period-3): posted 0, held out 0)

designate.hold: key_conflict

 1  entitle.do(employee: employee-1, period: period-2, minutes: 1)                          done
 2  designate.hold(request: request-3, employee: employee-1, period: period-2, minutes: 1)  done
 3  designate.hold(request: request-3, employee: employee-1, period: period-2, minutes: 2)  refused: key_conflict

designate.hold: already_refused

 1  designate.hold(request: request-1, employee: employee-2, period: period-3, minutes: 1)  refused: not_enough_leave (move 1 takes 1 from leave(employee-2, period-3): posted 0, held out 0)
 2  designate.hold(request: request-1, employee: employee-2, period: period-3, minutes: 2)  refused: already_refused

designate.post: key_conflict

 1  entitle.do(employee: employee-1, period: period-2, minutes: 2)                          done
 2  designate.hold(request: request-3, employee: employee-1, period: period-2, minutes: 2)  done
 3  designate.post(request: request-3)                                                      done
 4  designate.post(request: request-3, minutes: 1)                                          refused: key_conflict

designate.post: already_voided

 1  entitle.do(employee: employee-1, period: period-2, minutes: 2)                          done
 2  designate.hold(request: request-3, employee: employee-1, period: period-2, minutes: 2)  done
 3  designate.void(request: request-3)                                                      done
 4  designate.post(request: request-3)                                                      refused: already_voided

designate.post: over_hold

 1  entitle.do(employee: employee-1, period: period-2, minutes: 2)                          done
 2  designate.hold(request: request-3, employee: employee-1, period: period-2, minutes: 2)  done
 3  designate.post(request: request-3, minutes: 3)                                          refused: over_hold

designate.post: no_such_hold

 1  designate.post(request: request-1)  refused: no_such_hold

designate.void: already_posted

 1  entitle.do(employee: employee-1, period: period-2, minutes: 2)                          done
 2  designate.hold(request: request-3, employee: employee-1, period: period-2, minutes: 2)  done
 3  designate.post(request: request-3)                                                      done
 4  designate.void(request: request-3)                                                      refused: already_posted

designate.void: no_such_hold

 1  designate.void(request: request-1)  refused: no_such_hold

Scenarios

17 scenarios, which chobo scenarios makes from the book. Pick one and step through it: after each step come the balances and the holds it left, and on the chart the arrows of the transfers it called light up (red when refused).

    AccountPostedHeld outHeld in
    HoldState
    How things move between the accounts of fmla_leave entitle designate leave(employee, period)minat least 0 (not_enough_leave) entitledmin · outside takenmin · outside