App::Dochazka::REST::Fillup - fillup routines
use App::Dochazka::REST::Fillup; ...
Get the next TIID and store in the object
Make accessors for all the attributes. Already done, above, in BEGIN block.
Performs various tests on the context attribute. If the value of that attribute is not what we're expecting, returns a non-OK status. Otherwise, returns an OK status.
context
The user can specify fillup dates either as a tsrange or as a list of individual dates.
One or the other must be given, not neither and not both.
Returns a status object.
This function takes one named argument: date_list, the value of which must be a reference to an array of dates, each in canonical YYYY-MM-DD form. For example, this
[ '2016-01-13', '2016-01-27', '2016-01-14' ]
is a legal date_list argument.
date_list
This function performs various checks on the date list, sorts it, and populates the tsrange and tsranges attributes based on it. For the sample date list given above, the tsrange will be something like
tsrange
tsranges
{ tsrange => "[\"2016-01-13 00:00:00+01\",\"2016-01-28 00:00:00+01\")" }
This is used to make sure the employee's schedule and priv level did not change during the time period represented by the date list, as well as in fillup_tempintvls to generate the tempintvl working set.
fillup_tempintvls
tempintvl
Takes constructor arguments. Checks the tsrange for sanity and populates the tsrange, lower_canon, lower_ymd, upper_canon, upper_ymd attributes. Returns a status object.
lower_canon
lower_ymd
upper_canon
upper_ymd
Expects to be called *after* _vet_tsrange.
_vet_tsrange
Takes 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.
DBIx::Connector
activity_obj
Returns boolean true if object has been completely vetted. Otherwise false.
This method takes no arguments and expects to be called on a fully vetted object (see vetted, above).
vetted
This method creates (and attempts to INSERT records corresponding to) a number of Tempintvl objects according to the tsrange (as stored in the Fillup object) and the employee's schedule.
Note that the purpose of this method is to generate a set of Tempintvl objects that could potentially become attendance intervals. The fillup_tempintvls method only deals with Tempintvls. It is up to the commit method to choose the right Tempintvls for the fillup operation in question and to construct and insert the corresponding Interval objects.
commit
Constructor method. Returns an App::Dochazka::REST::Fillup object.
App::Dochazka::REST::Fillup
The constructor method does everything up to fillup. It also populates the constructor_status attribute with an App::CELL::Status object.
fillup
constructor_status
App::CELL::Status
If the dry_run attribute is true, assemble and return an array of attendance intervals that would need to be created to reach 100% schedule fulfillment over the tsranges.
dry_run
If the dry_run attribute is false, iterate over all those intervals and INSERT them into the intervals table.
Alternatively, if dry_run is true and clobber is true, ignore existing attendance intervals that might conflict and just return the scheduled intervals. If dry_run is false, clobber setting is ignored.
clobber
Returns a status object containing all the fillup intervals generated, divided into "success" and "failure" sets, with the latter containing any intervals that failed to be inserted for whatever reason. If dry_run is true, all the intervals will be in the "success" set.
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.
Takes a date and a $holidays hashref. Returns true or false.
$holidays
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.