App::Dochazka::REST::Model::Tempintvls - object class for "scratch schedules"
use App::Dochazka::REST::Model::Tempintvls; ...
If tiid attribute has been populated, return it. If it hasn't been, populate it and return it.
Accessor for aid attribute. May return undef.
aid
Accessor for constructor_status attribute. May return undef.
constructor_status
Accessor for context attribute. May return undef.
context
Accessor for dbix_conn attribute. May return undef.
dbix_conn
Accessor for eid attribute. May return undef.
eid
Accessor for tsrange attribute. May return undef.
tsrange
Called automatically when new object is instantiated; assigns next TIID.
Takes a DBIx::Connector object and a tsrange. Checks the tsrange for sanity and populates the tsrange, lower_canon, lower_ymd, upper_canon, upper_ymd attributes. Returns a status object.
DBIx::Connector
lower_canon
lower_ymd
upper_canon
upper_ymd
The algorithm for generating fillup intervals takes lower and upper date bounds - it does not know about timestamps or tsranges
Expects to be called *after* _vet_tsrange.
_vet_tsrange
Takes a DBIx::Connector object and an employee object. First, retrieves from the database the employee object corresponding to the EID. Second, checks that the employee's privlevel did not change during the tsrange. Third, retrieves the prevailing schedule and checks that the schedule does not change at all during the tsrange. Returns a status object.
Takes a DBIx::Connector object and an AID. Verifies that the AID exists and populates the activity_obj attribute.
activity_obj
Returns boolean true if object has been completely vetted. Otherwise false.
Optionally takes an include_holidays boolean flag, which defaults to 0. This method expects to be called on a fully vetted object (see vetted, above).
include_holidays
vetted
This method attempts to INSERT records into the tempintvls table according to the tsrange and the employee's schedule. Returns a status object.
Note that this method does not create any attendance intervals. If the fillup operation is successful, the payload will contain a list of attendance intervals that will be created if the commit method is called.
commit
Constructor method. Returns an App::Dochazka::REST::Model::Tempintvls object.
App::Dochazka::REST::Model::Tempintvls
The constructor method does everything up to fillup. It also populates the constructor_status attribute with an App::CELL::Status object.
fillup
App::CELL::Status
Takes a PARAMHASH containing a DBIx::Connector object and a tiid property. Returns all intervals matching that tiid.
tiid
Optionally takes a PARAMHASH containing, optionally, a dry_run boolean value that defaults to 0.
dry_run
If dry_run is true, merely SELECTs intervals from the tempintvls table corresponding to the tsrange (already vetted and stored in the object by calling _vet_tsrange). This SELECT includes partial intervals (if any) at the beginning and end of the tsrange (using PostgreSQL intersection operator).
If dry_run is false, all the intervals from the SELECT are INSERTed into the intervals table.
There is no update method for tempintvls. Instead, delete and re-create.
Instance destructor. Once we are done with the scratch intervals, they can be deleted. Returns a status object.
Get next value from the temp_intvl_seq sequence
Missing function in Date::Calc
Given schedule hash (JSON string from database), return schedule hash keyed on the "low_dow" property. In other words, convert the schedule to hash format keyed on numeric form of "low_dow" i.e. 1 for MON, 2 for TUE, etc. The values are references to arrays containing the entries beginning on the given DOW.
Nathan Cutler, <presnypreklad@gmail.com>
<presnypreklad@gmail.com>
To install App::Dochazka::REST, copy and paste the appropriate command in to your terminal.
cpanm
cpanm App::Dochazka::REST
CPAN shell
perl -MCPAN -e shell install App::Dochazka::REST
For more information on module installation, please visit the detailed CPAN module installation guide.