Die Dokumentation ab Version 39.5.17 von PLANTA project finden Sie in der neuen PLANTA Online-Hilfe.

ppms.period

The period API lets you create and delete periods.

Classes

PeriodCreator

The PeriodCreator is a context manager for creating new periods.

Methods

Function Parameters Return Value Description
PeriodCreator.__enter__(self)   The !PeriodCreator instance Enter the context to queue up period changes
PeriodCreator.__exit__(self, type, value, tb) type: Exception Type
value: Exception instance
tb: Traceback
  When the context is left, all periods are created
PeriodCreator.add(self, res_id, start_period, end_period) res_id: The Ressource to add periods for
start_period: Days since 01.01.1970
end_period: Days since 01.01.1970
  Adds a resource and timeframe to generate periods for. When the context is left, these periods will be created.

Note: The newly created periods will not be aggregated

Functions

Function Parameters Return Value Description
aggregate_periods(parent_res_id, start_period, end_period) parent_res_id: Ressource
start_period: Days since 01.01.1970
end_period: Days since 01.01.1970
  Aggregate the periods of the parent_res_id in the given timeframe up across all parent resources
aggregate_periods_from_start_to_end(res_id) res_id: Ressource   Aggregate all periods of the resource based on their Startperiode and Endperiode
any_child_resource_has_workday(resource_id, period) resource_id: Ressource
period: Days since 01.01.1970
True if the given period is a workday for any child resource, False if it isn't Check if a given date is a workday for any child resource of a department
delete_obsolete_periods(res_id) res_id: Ressource   Delete all period records outside the Startperiode and Endperiode
get_amount_of_children(parent_res_id) parent_res_id: Ressource The amount of child resources  
get_start_end_period_from_db(res_id) res_id: Ressource start and end period as a tuple Fetch the start and end period of a resource from the database
reset_summarized_periods(res_id) res_id: Ressource   Sets all aggregated dataitems in the period table to 0

Examples

Creating new periods

from ppms.period import PeriodCreator

with PeriodCreator() as creator:
    creator.add('R2', (100, 200))
    creator.add('R41', (100, 800))

         PLANTA project









 
  • Suche in Topic-Namen

  • Suche in Topic-Inhalten
This site is powered by the TWiki collaboration platform Powered by Perl