<commit_before>.. _voga.specs.roger:

=================================
Specific for Lino Voga à la Roger
=================================

.. to test only this doc:

    $ python setup.py test -s tests.SpecsTests.test_roger

    >>> from lino import startup
    >>> startup('lino_voga.projects.roger.settings.doctests')
    >>> from lino.api.doctest import *


A customized management of membership fees
==========================================

In :mod:`lino_voga.projects.roger` they have the following rules for
handling memberships:

- Membership costs 15€  per year.
- Members get a discount on enrolments to courses.
- Customers can freely decide whether they want to be members or not.
- They become member by paying the membership fee.

To handle these rules, we have an additional field :attr:`member_until
<lino_voga.projects.roger.lib.courses.models.Pupil.member_until>` on
each pupil.

There is a custom plausibility checker
:class:`lino_voga.projects.roger.lib.courses.models.MemberChecker`
    
    
>>> dd.demo_date()
datetime.date(2015, 5, 22)


>>> rt.show(rt.actors.courses.Pupils)
... #doctest: +ELLIPSIS
======================================== ================================= ================== ============ ===== ===== ======== ==============
 Name                                     Address                           Participant Type   Section      LFV   CKK   Raviva   Mitglied bis
---------------------------------------- --------------------------------- ------------------ ------------ ----- ----- -------- --------------
 <NAME> (MEC)                     Aachener Straße, 4700 Eupen       Member                          No    Yes   No       31/12/2015
 <NAME> (ME)                       Alter Malmedyer Weg, 4700 Eupen   Helper                          No    No    No       31/12/2015
 <NAME> (MES)                Am Berg, 4700 Eupen               Non-member         Eupen        No    No    No       31/12/2015
 <NAME> (MS)                        Germany                           Member             Nidrum       No    No    No
 <NAME> (ME)                     Auenweg, 4700 Eupen               Helper                          No    No    No       31/12/2015
 <NAME> (ME)               Auf'm Rain, 4700 Eupen            Non-member                      No    No    No       31/12/2016
 <NAME> (MECLS)                   August-Thonnar-Str., 4700 Eupen   Member             Nidrum       Yes   Yes   No       31/12/2016
...
 <NAME> (MLS)                   4730 Raeren                       Non-member         Sonstige     Yes   No    No
 <NAME> (MEC)                   4730 Raeren                       Member                          No    Yes   No       31/12/2015
 <NAME> (ME)        Amsterdam, Netherlands            Helper                          No    No    No       31/12/2015
 <NAME> (ME)                      4730 Raeren                       Non-member                      No    No    No       31/12/2015
 <NAME> (MCS)                     4730 Raeren                       Member             Eupen        No    Yes   No
 <NAME> (ME)                         4730 Raeren                       Helper                          No    No    No       31/12/2015
======================================== ================================= ================== ============ ===== ===== ======== ==============
<BLANKLINE>


>>> print(dd.plugins.ledger.force_cleared_until)
None

>>> rt.show(plausibility.ProblemsByChecker, 'courses.MemberChecker')
============= ===================================== ==========================================
 Responsible   Controlled by                         Message
------------- ------------------------------------- ------------------------------------------
 <NAME>    *<NAME> (ME)*                  Member until 2015-12-31, but no payment.
 <NAME>    *<NAME> (ME)*               Member until 2015-12-31, but no payment.
 <NAME>    *<NAME> (ME)*          Member until 2015-12-31, but no payment.
 <NAME>    *<NAME> (ME)*              Member until 2015-12-31, but no payment.
 <NAME>    *<NAME> (MEC)*              Member until 2015-12-31, but no payment.
 <NAME>    *<NAME> (ME)*                 Member until 2015-12-31, but no payment.
 <NAME>    *<NAME> (ME)*                    Member until 2015-12-31, but no payment.
 <NAME>    *<NAME> (ME)*                 Member until 2015-12-31, but no payment.
 <NAME>    *<NAME> (ME)*   Member until 2015-12-31, but no payment.
 <NAME>    *<NAME> (MEL)*                     Member until 2015-12-31, but no payment.
============= ===================================== ==========================================
<BLANKLINE>

>>> acc = rt.models.accounts.Account.get_by_ref(dd.plugins.courses.membership_fee_account)
>>> print(acc)
(membership_fee) Membership fee

>>> rt.show(ledger.MovementsByAccount, acc)
============ ========= ===================================== ============ ======== ============= =========
 Value date   Voucher   Description                           Debit        Credit   Match         Cleared
------------ --------- ------------------------------------- ------------ -------- ------------- ---------
 22/12/2015   *CSH 5*   *<NAME>*                     15,00                 **CSH 5:1**   Yes
 22/12/2015   *CSH 5*   *<NAME>*                  15,00                 **CSH 5:2**   Yes
 22/12/2015   *CSH 5*   *<NAME>*                   15,00                 **CSH 5:3**   Yes
 22/12/2015   *CSH 5*   *<NAME>*                   15,00                 **CSH 5:4**   Yes
 22/12/2015   *CSH 5*   *<NAME>*                         15,00                 **CSH 5:5**   Yes
 22/11/2015   *CSH 4*   *<NAME>*   15,00                 **CSH 4:1**   Yes
 22/11/2015   *CSH 4*   *<NAME>*                      15,00                 **CSH 4:2**   Yes
 22/11/2015   *CSH 4*   *<NAME>*                       15,00                 **CSH 4:3**   Yes
 22/11/2015   *CSH 4*   *<NAME>*                        15,00                 **CSH 4:4**   Yes
 22/10/2015   *CSH 3*   *<NAME>*                      15,00                 **CSH 3:1**   Yes
 22/10/2015   *CSH 3*   *<NAME>*               15,00                 **CSH 3:2**   Yes
 22/02/2015   *CSH 2*   *<NAME>*                     15,00                 **CSH 2:1**   Yes
 22/01/2015   *CSH 1*   *<NAME>*                       15,00                 **CSH 1:1**   Yes
 22/01/2015   *CSH 1*   *<NAME>*                      15,00                 **CSH 1:2**   Yes
 22/01/2015   *CSH 1*   *<NAME>*                 15,00                 **CSH 1:3**   Yes
                        **Balance 225.00 (15 movements)**     **225,00**
============ ========= ===================================== ============ ======== ============= =========
<BLANKLINE><commit_msg>test cases for #1273<commit_after>.. _voga.specs.roger:

=================================
Specific for Lino Voga à la Roger
=================================

.. to test only this doc:

    $ python setup.py test -s tests.SpecsTests.test_roger

    >>> from lino import startup
    >>> startup('lino_voga.projects.roger.settings.doctests')
    >>> from lino.api.doctest import *


A customized management of membership fees
==========================================

In :mod:`lino_voga.projects.roger` they have the following rules for
handling memberships:

- Membership costs 15€  per year.
- Members get a discount on enrolments to courses.
- Customers can freely decide whether they want to be members or not.
- They become member by paying the membership fee.

To handle these rules, we have an additional field :attr:`member_until
<lino_voga.projects.roger.lib.courses.models.Pupil.member_until>` on
each pupil.

There is a custom plausibility checker
:class:`lino_voga.projects.roger.lib.courses.models.MemberChecker`
    
    
>>> dd.demo_date()
datetime.date(2015, 5, 22)


>>> rt.show(rt.actors.courses.Pupils)
... #doctest: +ELLIPSIS
======================================== ================================= ================== ============ ===== ===== ======== ==============
 Name                                     Address                           Participant Type   Section      LFV   CKK   Raviva   Mitglied bis
---------------------------------------- --------------------------------- ------------------ ------------ ----- ----- -------- --------------
 <NAME> (MEC)                     <NAME>e, 4700 Eupen       Member                          No    Yes   No       31/12/2015
 <NAME> (ME)                       Alter Malmedyer Weg, 4700 Eupen   Helper                          No    No    No       31/12/2015
 <NAME> (MES)                Am Berg, 4700 Eupen               Non-member         Eupen        No    No    No       31/12/2015
 <NAME> (MS)                        Germany                           Member             Nidrum       No    No    No
 <NAME> (ME)                     Auenweg, 4700 Eupen               Helper                          No    No    No       31/12/2015
 <NAME> (ME)               Auf'm Rain, 4700 Eupen            Non-member                      No    No    No       31/12/2016
 <NAME> (MECLS)                   August-Thonnar-Str., 4700 Eupen   Member             Nidrum       Yes   Yes   No       31/12/2016
...
 <NAME> (MLS)                   4730 Raeren                       Non-member         Sonstige     Yes   No    No
 <NAME> (MEC)                   4730 Raeren                       Member                          No    Yes   No       31/12/2015
 <NAME> (ME)        Amsterdam, Netherlands            Helper                          No    No    No       31/12/2015
 <NAME> (ME)                      4730 Raeren                       Non-member                      No    No    No       31/12/2015
 <NAME> (MCS)                     4730 Raeren                       Member             Eupen        No    Yes   No
 <NAME> (ME)                         4730 Raeren                       Helper                          No    No    No       31/12/2015
======================================== ================================= ================== ============ ===== ===== ======== ==============
<BLANKLINE>


>>> print(dd.plugins.ledger.force_cleared_until)
None

>>> rt.show(plausibility.ProblemsByChecker, 'courses.MemberChecker')
============= ===================================== ==========================================
 Responsible   Controlled by                         Message
------------- ------------------------------------- ------------------------------------------
 <NAME>    *<NAME> (ME)*                  Member until 2015-12-31, but no payment.
 <NAME>    *<NAME> (ME)*               Member until 2015-12-31, but no payment.
 <NAME>    *<NAME> (ME)*          Member until 2015-12-31, but no payment.
 <NAME>    *<NAME> (ME)*              Member until 2015-12-31, but no payment.
 <NAME>    *<NAME> (MEC)*              Member until 2015-12-31, but no payment.
 <NAME>    *<NAME> (ME)*                 Member until 2015-12-31, but no payment.
 <NAME>    *<NAME> (ME)*                    Member until 2015-12-31, but no payment.
 <NAME>    *<NAME> (ME)*                 Member until 2015-12-31, but no payment.
 <NAME>    *<NAME> (ME)*   Member until 2015-12-31, but no payment.
 <NAME>    *<NAME> (MEL)*                     Member until 2015-12-31, but no payment.
============= ===================================== ==========================================
<BLANKLINE>

>>> acc = rt.models.accounts.Account.get_by_ref(dd.plugins.courses.membership_fee_account)
>>> print(acc)
(membership_fee) Membership fee

>>> rt.show(ledger.MovementsByAccount, acc)
============ ========= ===================================== ============ ======== ============= =========
 Value date   Voucher   Description                           Debit        Credit   Match         Cleared
------------ --------- ------------------------------------- ------------ -------- ------------- ---------
 22/12/2015   *CSH 5*   *<NAME>*                     15,00                 **CSH 5:1**   Yes
 22/12/2015   *CSH 5*   *<NAME>*                  15,00                 **CSH 5:2**   Yes
 22/12/2015   *CSH 5*   *<NAME>*                   15,00                 **CSH 5:3**   Yes
 22/12/2015   *CSH 5*   *<NAME>*                   15,00                 **CSH 5:4**   Yes
 22/12/2015   *CSH 5*   *<NAME>*                         15,00                 **CSH 5:5**   Yes
 22/11/2015   *CSH 4*   *<NAME>*   15,00                 **CSH 4:1**   Yes
 22/11/2015   *CSH 4*   *<NAME>*                      15,00                 **CSH 4:2**   Yes
 22/11/2015   *CSH 4*   *<NAME>*                       15,00                 **CSH 4:3**   Yes
 22/11/2015   *CSH 4*   *<NAME>*                        15,00                 **CSH 4:4**   Yes
 22/10/2015   *CSH 3*   *<NAME>*                      15,00                 **CSH 3:1**   Yes
 22/10/2015   *CSH 3*   *<NAME>*               15,00                 **CSH 3:2**   Yes
 22/02/2015   *CSH 2*   *<NAME>*                     15,00                 **CSH 2:1**   Yes
 22/01/2015   *CSH 1*   *<NAME>*                       15,00                 **CSH 1:1**   Yes
 22/01/2015   *CSH 1*   *<NAME>*                      15,00                 **CSH 1:2**   Yes
 22/01/2015   *CSH 1*   *<NAME>*                 15,00                 **CSH 1:3**   Yes
                        **Balance 225.00 (15 movements)**     **225,00**
============ ========= ===================================== ============ ======== ============= =========
<BLANKLINE>



Menu walk
=========

Here is the output of :func:`walk_menu_items
<lino.api.doctests.walk_menu_items>` for this database:

>>> walk_menu_items('rolf')
... #doctest: -ELLIPSIS +NORMALIZE_WHITESPACE +REPORT_UDIFF
- Kontakte --> Personen : 72
- Kontakte --> Organisationen : 30
- Kontakte --> Partner : 101
- Kontakte --> Partnerlisten : 9
- Büro --> Meine Datenkontrollliste : 0
- Büro --> Meine Mitteilungen : 2
- Büro --> Meine Notizen : 34
- Büro --> Meine Uploads : 1
- Büro --> Mein E-Mail-Ausgang : 1
- Büro --> Meine Auszüge : 0
- Kalender --> Meine Termine : 100
- Kalender --> Überfällige Termine : 15
- Kalender --> Meine Aufgaben : 1
- Kalender --> Meine Gäste : 1
- Kalender --> Meine Anwesenheiten : 1
- Kalender --> Buchungen : 4
- Buchhaltung --> Verkauf --> Verkaufsrechnungen (SLS) : 0
- Buchhaltung --> Verkauf --> Gutschriften Verkauf (SLC) : 0
- Buchhaltung --> Einkauf --> Einkaufsrechnungen (PRC) : 0
- Buchhaltung --> Finanzjournale --> Zahlungsaufträge (PMO) : 0
- Buchhaltung --> Finanzjournale --> Kasse (CSH) : 0
- Buchhaltung --> Finanzjournale --> Bestbank (BNK) : 0
- Buchhaltung --> Finanzjournale --> Diverse Buchungen (MSC) : 0
- Aktivitäten --> Teilnehmer : 36
- Aktivitäten --> Kursleiter : 9
- Aktivitäten --> Kurse : 24
- Aktivitäten --> Ausfahrten : 1
- Aktivitäten --> Reisen : 3
- Aktivitäten --> Themen : 6
- Aktivitäten --> Aktivitätenreihen : 11
- Aktivitäten --> Offene Einschreibungsanfragen : 10
- Aktivitäten --> Auszustellende Teilnahmebescheinigungen : 69
- Berichte --> System --> Broken GFKs : 0
- Berichte --> Buchhaltung --> Schuldner : 0
- Berichte --> Buchhaltung --> Gläubiger : 14
- Berichte --> MwSt. --> Offene Rechnungen : 18
- Konfigurierung --> System --> Benutzer : 6
- Konfigurierung --> System --> Hilfetexte : 3
- Konfigurierung --> Orte --> Länder : 9
- Konfigurierung --> Orte --> Orte : 79
- Konfigurierung --> Kontakte --> Organisationsarten : 17
- Konfigurierung --> Kontakte --> Funktionen : 6
- Konfigurierung --> Kontakte --> Listenarten : 4
- Konfigurierung --> Kalender --> Kalenderliste : 9
- Konfigurierung --> Kalender --> Räume : 8
- Konfigurierung --> Kalender --> Prioritäten : 5
- Konfigurierung --> Kalender --> Periodische Terminregeln : 17
- Konfigurierung --> Kalender --> Gastrollen : 4
- Konfigurierung --> Kalender --> Kalendereintragsarten : 9
- Konfigurierung --> Kalender --> Externe Kalender : 1
- Konfigurierung --> Tarife --> Tarife : 12
- Konfigurierung --> Tarife --> Tarifkategorien : 6
- Konfigurierung --> Buchhaltung --> Kontengruppen : 8
- Konfigurierung --> Buchhaltung --> Konten : 14
- Konfigurierung --> Buchhaltung --> Journale : 8
- Konfigurierung --> Buchhaltung --> Buchungsperioden : 18
- Konfigurierung --> Buchhaltung --> Zahlungsbedingungen : 9
- Konfigurierung --> MwSt. --> MwSt-Regeln : 12
- Konfigurierung --> MwSt. --> Papierarten : 3
- Konfigurierung --> Aktivitäten --> Aktivitätsarten : 1
- Konfigurierung --> Aktivitäten --> Kursleiterarten : 5
- Konfigurierung --> Aktivitäten --> Teilnehmerarten : 4
- Konfigurierung --> Aktivitäten --> Timetable Slots : 1
- Konfigurierung --> Büro --> Notizarten : 4
- Konfigurierung --> Büro --> Ereignisarten : 2
- Konfigurierung --> Büro --> Upload-Arten : 1
- Konfigurierung --> Büro --> Auszugsarten : 12
- Explorer --> System --> Vollmachten : 1
- Explorer --> System --> Benutzerarten : 4
- Explorer --> System --> Datenbankmodelle : 77
- Explorer --> System --> Datentests : 9
- Explorer --> System --> Datenprobleme : 14
- Explorer --> System --> Mitteilungen : 4
- Explorer --> Kontakte --> Kontaktpersonen : 1
- Explorer --> Kontakte --> List memberships : 1
- Explorer --> Kalender --> Aufgaben : 1
- Explorer --> Kalender --> Anwesenheiten : 1
- Explorer --> Kalender --> Abonnements : 36
- Explorer --> Kalender --> Termin-Zustände : 5
- Explorer --> Kalender --> Gast-Zustände : 4
- Explorer --> Kalender --> Aufgaben-Zustände : 4
- Explorer --> Buchhaltung --> Ausgleichungsregeln : 12
- Explorer --> Buchhaltung --> Belege : 205
- Explorer --> Buchhaltung --> Belegarten : 5
- Explorer --> Buchhaltung --> Bewegungen : 697
- Explorer --> Buchhaltung --> Geschäftsjahre : 7
- Explorer --> Buchhaltung --> Handelsarten : 4
- Explorer --> Buchhaltung --> Journalgruppen : 4
- Explorer --> MwSt. --> MwSt.-Regimes : 9
- Explorer --> MwSt. --> MwSt.-Klassen : 3
- Explorer --> MwSt. --> Produktrechnungen : 84
- Explorer --> MwSt. --> Produktrechnungszeilen : 102
- Explorer --> MwSt. --> Fakturationspläne : 2
- Explorer --> Aktivitäten --> Aktivitäten : 26
- Explorer --> Aktivitäten --> Einschreibungen : 78
- Explorer --> Aktivitäten --> Einschreibungs-Zustände : 3
- Explorer --> Finanzjournale --> Kontoauszüge : 22
- Explorer --> Finanzjournale --> Diverse Buchungen : 1
- Explorer --> Finanzjournale --> Zahlungsaufträge : 17
- Explorer --> SEPA --> Bankkonten : 18
- Explorer --> Büro --> Notizen : 101
- Explorer --> Büro --> Uploads : 1
- Explorer --> Büro --> Upload-Bereiche : 1
- Explorer --> Büro --> E-Mail-Ausgänge : 1
- Explorer --> Büro --> Anhänge : 1
- Explorer --> Büro --> Auszüge : 0
<BLANKLINE>
{'fraction_non_alphanumeric': 0.2267601834367413, 'fraction_numerical': 0.05670353385486917, 'mean_word_length': 1.5694482949819795, 'pattern_counts': {'":': 0, '<': 110, '<?xml version=': 0, '>': 360, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 20, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1315610', 'n_tokens_mistral': 6249, 'n_tokens_neox': 5307, 'n_words': 1417}