- Tumbleweed 0.559-2.4
- Leap-15.6
App::Dochazka::REST::Fillup(3pm) | User Contributed Perl Documentation | App::Dochazka::REST::Fillup(3pm) |
NAME¶
App::Dochazka::REST::Fillup - fillup routines
SYNOPSIS¶
use App::Dochazka::REST::Fillup; ...
METHODS¶
populate¶
Get the next TIID and store in the object
Accessors¶
Make accessors for all the attributes. Already done, above, in BEGIN block.
_vet_context¶
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.
_vet_date_spec¶
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.
_vet_date_list¶
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.
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 => "[\"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.
Returns a status object.
_vet_tsrange¶
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.
_vet_employee¶
Expects to be called *after* "_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.
_vet_activity¶
Takes a "DBIx::Connector" object and an AID. Verifies that the AID exists and populates the "activity_obj" attribute.
vetted¶
Returns boolean true if object has been completely vetted. Otherwise false.
fillup_tempintvls¶
This method takes no arguments and expects to be called on a fully vetted object (see "vetted", above).
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.
Returns a status object.
new¶
Constructor method. Returns an "App::Dochazka::REST::Fillup" object.
The constructor method does everything up to "fillup". It also populates the "constructor_status" attribute with an "App::CELL::Status" object.
commit¶
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.
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.
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.
DESTROY¶
Instance destructor. Once we are done with the scratch intervals, they can be deleted. Returns a status object.
FUNCTIONS¶
_next_tiid¶
Get next value from the temp_intvl_seq sequence
Days_to_Date¶
Missing function in Date::Calc
_init_lower_sched_hash¶
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.
_is_holiday¶
Takes a date and a $holidays hashref. Returns true or false.
AUTHOR¶
Nathan Cutler, "<presnypreklad@gmail.com>"
2024-03-27 | perl v5.40.0 |