patrols (Patrols main plugin)

A tested document

This is a tested document. The following instructions are used for initialization:

>>> from lino_patrols.projects.patrols1.startup import *

The patrols planner

The patrols planner is the central main feature of Lino Patrols. This is where most of the users spend most of their time.

>>> reset_sql_queries()
>>> rt.show(patrols.PatrolsPlanner, max_width=20, limit=7)
...
+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+
| Date                 | 10 (Bot-MdP)         | 20 (BM-FP-TB-MT-W)   | 30 (BM-FP-VP-B)      | 40 (Bayehon)         | 50 (Warche)          | 60 (Noire Eau)       | 70 (Vélo)            | 99 (etc)             |
+======================+======================+======================+======================+======================+======================+======================+======================+======================+
| `Saturday, 28 March  | `10:00 <…>`__ (0/3)  | `10:00 <…>`__ (0/3)  | `10:00 <…>`__ (0/3)  | `10:00 <…>`__ (0/3)  | `10:00 <…>`__ (0/3)  | `10:00 <…>`__ (0/3)  | `10:00 <…>`__ (0/3)  | `10:00 <…>`__ (0/3)  |
| 2026 <…>`__          | `13:00 <…>`__ (0/3)  | `13:00 <…>`__ (0/3)  | `13:00 <…>`__ (0/3)  | `13:00 <…>`__ (0/3)  | `13:00 <…>`__ (0/3)  | `13:00 <…>`__ (0/3)  | `13:00 <…>`__ (0/3)  | `13:00 <…>`__ (0/3)  |
+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+
| `Sunday, 29 March    | `10:00 <…>`__ (1/3)  | `10:00 <…>`__ (1/3)  | `10:00 <…>`__ (1/3)  | `10:00 <…>`__ (1/3)  | `10:00 <…>`__ (1/3)  | `10:00 <…>`__ (1/3)  | `10:00 <…>`__ (1/3)  | `10:00 <…>`__ (1/3)  |
| 2026 <…>`__          | Alfons Ausdemwald    | Dorothée             | Gregory Groteclaes   | Jan Jousten `13:00   | Marie-Louise Meier   | Alfons Ausdemwald    | Dorothée             | Gregory Groteclaes   |
|                      | `13:00 <…>`__ (1/3)  | Dobbelstein-         | `13:00 <…>`__ (1/3)  | <…>`__ (1/3)         | `13:00 <…>`__ (1/3)  | `13:00 <…>`__ (1/3)  | Dobbelstein-         | `13:00 <…>`__ (1/3)  |
|                      | Jan Jousten          | Demeulenaere `13:00  | Alfons Ausdemwald    | Dorothée             | Gregory Groteclaes   | Jan Jousten          | Demeulenaere `13:00  | Alfons Ausdemwald    |
|                      |                      | <…>`__ (1/3) Marie-  |                      | Dobbelstein-         |                      |                      | <…>`__ (1/3) Marie-  |                      |
|                      |                      | Louise Meier         |                      | Demeulenaere         |                      |                      | Louise Meier         |                      |
+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+
| `Monday, 30 March    | `10:00 <…>`__ (0/3)  | `10:00 <…>`__ (0/3)  | `10:00 <…>`__ (0/3)  | `10:00 <…>`__ (0/3)  | `10:00 <…>`__ (0/3)  | `10:00 <…>`__ (0/3)  | `10:00 <…>`__ (0/3)  | `10:00 <…>`__ (0/3)  |
| 2026 <…>`__          | `13:00 <…>`__ (0/3)  | `13:00 <…>`__ (0/3)  | `13:00 <…>`__ (0/3)  | `13:00 <…>`__ (0/3)  | `13:00 <…>`__ (0/3)  | `13:00 <…>`__ (0/3)  | `13:00 <…>`__ (0/3)  | `13:00 <…>`__ (0/3)  |
+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+
| `Tuesday, 31 March   | `10:00 <…>`__ (0/3)  | `10:00 <…>`__ (0/3)  | `10:00 <…>`__ (0/3)  | `10:00 <…>`__ (0/3)  | `10:00 <…>`__ (0/3)  | `10:00 <…>`__ (0/3)  | `10:00 <…>`__ (0/3)  | `10:00 <…>`__ (0/3)  |
| 2026 <…>`__ `Drapeau | `13:00 <…>`__ (0/3)  | `13:00 <…>`__ (0/3)  | `13:00 <…>`__ (0/3)  | `13:00 <…>`__ (0/3)  | `13:00 <…>`__ (0/3)  | `13:00 <…>`__ (0/3)  | `13:00 <…>`__ (0/3)  | `13:00 <…>`__ (0/3)  |
| rouge <…>`__         |                      |                      |                      |                      |                      |                      |                      |                      |
+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+
| `Wednesday, 1 April  | `10:00 <…>`__ (1/3)  | `10:00 <…>`__ (1/3)  | `10:00 <…>`__ (1/3)  | `10:00 <…>`__ (1/3)  | `10:00 <…>`__ (1/3)  | `10:00 <…>`__ (1/3)  | `10:00 <…>`__ (1/3)  | `10:00 <…>`__ (1/3)  |
| 2026 <…>`__          | Laurent Bastiaensen  | Daniel Emonts `13:00 | Henri Hilgers `13:00 | Karl Kaivers `13:00  | Michael Mießen       | Laurent Bastiaensen  | Daniel Emonts `13:00 | Henri Hilgers `13:00 |
|                      | `13:00 <…>`__ (1/3)  | <…>`__ (1/3) Michael | <…>`__ (1/3) Laurent | <…>`__ (1/3) Daniel  | `13:00 <…>`__ (1/3)  | `13:00 <…>`__ (1/3)  | <…>`__ (1/3) Michael | <…>`__ (1/3) Laurent |
|                      | Karl Kaivers         | Mießen               | Bastiaensen          | Emonts               | Henri Hilgers        | Karl Kaivers         | Mießen               | Bastiaensen          |
+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+
| `Thursday, 2 April   | `10:00 <…>`__ (0/3)  | `10:00 <…>`__ (0/3)  | `10:00 <…>`__ (0/3)  | `10:00 <…>`__ (0/3)  | `10:00 <…>`__ (0/3)  | `10:00 <…>`__ (0/3)  | `10:00 <…>`__ (0/3)  | `10:00 <…>`__ (0/3)  |
| 2026 <…>`__          | `13:00 <…>`__ (0/3)  | `13:00 <…>`__ (0/3)  | `13:00 <…>`__ (0/3)  | `13:00 <…>`__ (0/3)  | `13:00 <…>`__ (0/3)  | `13:00 <…>`__ (0/3)  | `13:00 <…>`__ (0/3)  | `13:00 <…>`__ (0/3)  |
+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+
| `Friday, 3 April     | `10:00 <…>`__ (0/3)  | `10:00 <…>`__ (0/3)  | `10:00 <…>`__ (0/3)  | `10:00 <…>`__ (0/3)  | `10:00 <…>`__ (0/3)  | `10:00 <…>`__ (0/3)  | `10:00 <…>`__ (0/3)  | `10:00 <…>`__ (0/3)  |
| 2026 <…>`__ `Good    | `13:00 <…>`__ (0/3)  | `13:00 <…>`__ (0/3)  | `13:00 <…>`__ (0/3)  | `13:00 <…>`__ (0/3)  | `13:00 <…>`__ (0/3)  | `13:00 <…>`__ (0/3)  | `13:00 <…>`__ (0/3)  | `13:00 <…>`__ (0/3)  |
| Friday <…>`__        |                      |                      |                      |                      |                      |                      |                      |                      |
+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+

This causes 14 SQL requests in cal.Event : 7 rows, each doing one request for the warnings of each day, the other for the patrol events. There are 7*8*2 = 112 events being displayed. For each event there is an SQL request to cal_guest.

>>> show_sql_summary()
===================== =========== =======
 table                 stmt_type   count
--------------------- ----------- -------
 cal_event             SELECT      14
 cal_eventtype         SELECT      2
 cal_guest             SELECT      112
 cal_recurrentevent    SELECT      1
 django_content_type   SELECT      1
 system_siteconfig     SELECT      1
===================== =========== =======
>>> rt.show(patrols.PatrolsPlanner, display_mode="list", limit=7)
...
- # [Saturday, 28 March 2026](…)

  ### | 10 (Bot-MdP)


  | [10:00](…) (0/3)
  [13:00](…) (0/3)
  ...
- # [Sunday, 29 March 2026](…)

...

- # [Friday, 3 April 2026](…)
  [Good Friday](…)
  ...

  ### | 99 (etc)


  | [10:00](…) (0/3)
  [13:00](…) (0/3)

Notification options

>>> ar = rt.login('robin')
>>> ar.show("notify.MyOptions", ar.get_user(), language="fr")
==================== =============
 Type de message      Me notifier
-------------------- -------------
 Rappels calendrier   Oui
 Modifications        Non
 Messages système     Oui
==================== =============