Commit Graph

12 Commits

Author SHA1 Message Date
Lauréline Guérin 0424972fcf
misc: fix consider-using-max-builtin pylint error (#55505) 2021-07-15 15:02:14 +02:00
Lauréline Guérin 5bc1f273da
misc: fix misplaced-comparison-constant pylint error (#55505) 2021-07-15 15:02:13 +02:00
Lauréline Guérin dccfc33acf
misc: fix useless-object-inheritance pylint error (#55505) 2021-07-15 15:02:13 +02:00
Lauréline Guérin 34224c56aa
misc: apply isort (#52856) 2021-04-16 10:32:59 +02:00
Frédéric Péters eeda0c3f2e apply black 20.8b1 formatting 2020-12-29 10:42:33 +01:00
Benjamin Dauvergne ece063b2b3 api: optimize get_all_slots() and around it (#42169)
Workflow in get_all_slots() is simplified :
* first we accumulate, for each desk, the set of time slots when a booking cannot
occur or is already booked,
* then we generate the list of possible time slots and match them to the
exclusion and already booked set.

Intervals is replaced by a simpler data-structure, IntervalSet, it does
not need to be a map, a simple set is enough.

Also :
* moved TimePeriod.get_effective_timeperiods() to the agenda level , it
deduplictes TimePeriod between desks and remove excluded TimePeriod for
virtual agendas.

* added a named-tuple WeekTime to represent a TimePeriod base unit, so
we can use them in IntervalSet easily (as they can be compared) to
compute the effective time periods,

* the fact that base_duration is unique for a given virtual agenda is
now accounted and stated everywhere,

* the fact that generated time slots must have time in the local
timezone for the API to work is now stated everywhere,

* In get_all_slots(), also :
  * integrated the code of get_exceptions_by_desk() into get_all_slots()
  to further reduce the number of SQL queries.
  * used_min/max_datetime is reduced by the exclusion periods, and
    effective time periods are grouped based on the used_min/max_datetime of
    each agenda.
  * pre-filter slots for uniqueness when generating available datetimes
    (but for filling slot we still need exact availability information
    for each desk)
2020-05-19 18:19:34 +02:00
Frédéric Péters 30bbc8c90f general: reformat using black (#37464)
black--target-version py35 --skip-string-normalization --line-length 110 .
2019-12-16 16:24:38 +01:00
Frédéric Péters f4203d05f3 general: add support for Python 3 (#23678) 2018-05-13 15:19:14 +02:00
Benjamin Dauvergne b26c5c2283 fix interval sets when overlap is contained completely in an interval (#21290)
Also add more documentations and tests.
2018-01-22 14:02:30 +01:00
Frédéric Péters b364bdb1d6 general: add method to get opening hours of a desk on a given day (#21244) 2018-01-18 16:28:43 +01:00
Frédéric Péters 6004272376 trivial: fix indentation in new interval module 2017-12-30 14:29:02 +01:00
Benjamin Dauvergne 38b79a368c general: add custom implementation of interval sets (#20732) 2017-12-30 08:56:02 +01:00