From b26adbeef1a0557aee5126409b76ebdfbd48acce Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Wed, 29 Dec 2021 14:41:33 +0100 Subject: [PATCH] comment & function name --- app/models/etudiants.py | 5 +- app/models/formsemestre.py | 5 +- app/templates/entreprises/_contact.html | 1 + app/templates/entreprises/_offre.html | 1 + .../entreprises/ajout_entreprise.html | 1 + .../entreprises/ajout_historique.html | 1 + app/templates/entreprises/contacts.html | 1 + .../entreprises/delete_confirmation.html | 1 + app/templates/entreprises/entreprises.html | 1 + .../entreprises/envoi_offre_form.html | 1 + .../entreprises/fiche_entreprise.html | 130 +++++++++--------- app/templates/entreprises/form.html | 1 + app/templates/entreprises/offres.html | 1 + 13 files changed, 84 insertions(+), 66 deletions(-) diff --git a/app/models/etudiants.py b/app/models/etudiants.py index 0f81ad6b..2dab949c 100644 --- a/app/models/etudiants.py +++ b/app/models/etudiants.py @@ -108,10 +108,13 @@ class Identite(db.Model): return r[0] if r else None def inscription_courante_date(self, date_debut, date_fin): + """La première inscription à un formsemestre incluant la + période [date_debut, date_fin] + """ r = [ ins for ins in self.formsemestre_inscriptions - if ins.formsemestre.est_courant_date(date_debut, date_fin) + if ins.formsemestre.contient_periode(date_debut, date_fin) ] return r[0] if r else None diff --git a/app/models/formsemestre.py b/app/models/formsemestre.py index dc13c1cc..28be4155 100644 --- a/app/models/formsemestre.py +++ b/app/models/formsemestre.py @@ -146,8 +146,9 @@ class FormSemestre(db.Model): today = datetime.date.today() return (self.date_debut <= today) and (today <= self.date_fin) - def est_courant_date(self, date_debut, date_fin) -> bool: - """Vrai si la date actuelle (now) est dans le semestre + def contient_periode(self, date_debut, date_fin) -> bool: + """Vrai si l'intervalle [date_debut, date_fin] est + inclus dans le semestre. (les dates de début et fin sont incluses) """ return (self.date_debut <= date_debut) and (date_fin <= self.date_fin) diff --git a/app/templates/entreprises/_contact.html b/app/templates/entreprises/_contact.html index eff3a8cb..0eb8ebfe 100644 --- a/app/templates/entreprises/_contact.html +++ b/app/templates/entreprises/_contact.html @@ -1,3 +1,4 @@ +{# -*- mode: jinja-html -*- #}

Nom : {{ contact.nom }}
diff --git a/app/templates/entreprises/_offre.html b/app/templates/entreprises/_offre.html index fd21211d..ea69110e 100644 --- a/app/templates/entreprises/_offre.html +++ b/app/templates/entreprises/_offre.html @@ -1,3 +1,4 @@ +{# -*- mode: jinja-html -*- #}

Intitulé : {{ offre[0].intitule }}
diff --git a/app/templates/entreprises/ajout_entreprise.html b/app/templates/entreprises/ajout_entreprise.html index 4a70e83d..15cf174f 100644 --- a/app/templates/entreprises/ajout_entreprise.html +++ b/app/templates/entreprises/ajout_entreprise.html @@ -1,3 +1,4 @@ +{# -*- mode: jinja-html -*- #} {% extends 'base.html' %} {% import 'bootstrap/wtf.html' as wtf %} diff --git a/app/templates/entreprises/ajout_historique.html b/app/templates/entreprises/ajout_historique.html index f4da2661..c0a546d5 100644 --- a/app/templates/entreprises/ajout_historique.html +++ b/app/templates/entreprises/ajout_historique.html @@ -1,3 +1,4 @@ +{# -*- mode: jinja-html -*- #} {% extends 'base.html' %} {% import 'bootstrap/wtf.html' as wtf %} diff --git a/app/templates/entreprises/contacts.html b/app/templates/entreprises/contacts.html index 87112710..54d77bd5 100644 --- a/app/templates/entreprises/contacts.html +++ b/app/templates/entreprises/contacts.html @@ -1,3 +1,4 @@ +{# -*- mode: jinja-html -*- #} {% extends 'base.html' %} {% block app_content %} diff --git a/app/templates/entreprises/delete_confirmation.html b/app/templates/entreprises/delete_confirmation.html index 06b75b6a..4894bca3 100644 --- a/app/templates/entreprises/delete_confirmation.html +++ b/app/templates/entreprises/delete_confirmation.html @@ -1,3 +1,4 @@ +{# -*- mode: jinja-html -*- #} {% extends 'base.html' %} {% import 'bootstrap/wtf.html' as wtf %} diff --git a/app/templates/entreprises/entreprises.html b/app/templates/entreprises/entreprises.html index 9cbe2330..fe790a8d 100644 --- a/app/templates/entreprises/entreprises.html +++ b/app/templates/entreprises/entreprises.html @@ -1,3 +1,4 @@ +{# -*- mode: jinja-html -*- #} {% extends 'base.html' %} {% block app_content %} diff --git a/app/templates/entreprises/envoi_offre_form.html b/app/templates/entreprises/envoi_offre_form.html index c9db2c6c..f67cb4e4 100644 --- a/app/templates/entreprises/envoi_offre_form.html +++ b/app/templates/entreprises/envoi_offre_form.html @@ -1,3 +1,4 @@ +{# -*- mode: jinja-html -*- #} {% extends 'base.html' %} {% import 'bootstrap/wtf.html' as wtf %} diff --git a/app/templates/entreprises/fiche_entreprise.html b/app/templates/entreprises/fiche_entreprise.html index f3cc6826..d3453120 100644 --- a/app/templates/entreprises/fiche_entreprise.html +++ b/app/templates/entreprises/fiche_entreprise.html @@ -1,72 +1,76 @@ +{# -*- mode: jinja-html -*- #} {% extends 'base.html' %} {% block app_content %} - {% if logs %} -

-

Dernières opérations sur cette fiche

-
    - {% for log in logs %} -
  • - {{ log.date.strftime('%d %b %Hh%M') }} - {{ log.text|safe }} par {{ log.authenticated_user|get_nomcomplet }} -
  • - {% endfor %} -
-
- {% endif %} - {% if historique %} -
-

Historique

-
    - {% for data in historique %} -
  • - {{ data[0].date_debut.strftime('%d/%m/%Y') }} - {{ data[0].date_fin.strftime('%d/%m/%Y') }} - - {{ data[0].type_offre }} réalisé par {{ data[1].nom|format_nom }} {{ data[1].prenom|format_prenom }} en {{ data[0].formation_text }} - -
  • - {% endfor %} -
-
- {% endif %} -
-

Fiche entreprise - {{ entreprise.nom }} ({{ entreprise.siret }})

+{% if logs %} +
+

Dernières opérations sur cette fiche

+
    + {% for log in logs %} +
  • + {{ log.date.strftime('%d %b %Hh%M') }} + {{ log.text|safe }} par {{ log.authenticated_user|get_nomcomplet }} +
  • + {% endfor %} +
+
+{% endif %} +{% if historique %} +
+

Historique

+
    + {% for data in historique %} +
  • + {{ data[0].date_debut.strftime('%d/%m/%Y') }} - {{ + data[0].date_fin.strftime('%d/%m/%Y') }} + + {{ data[0].type_offre }} réalisé par {{ data[1].nom|format_nom }} {{ data[1].prenom|format_prenom }} en + {{ data[0].formation_text }} + +
  • + {% endfor %} +
+
+{% endif %} +
+

Fiche entreprise - {{ entreprise.nom }} ({{ entreprise.siret }})

-
-

- SIRET : {{ entreprise.siret }}
- Nom : {{ entreprise.nom }}
- Adresse : {{ entreprise.adresse }}
- Code postal : {{ entreprise.codepostal }}
- Ville : {{ entreprise.ville }}
- Pays : {{ entreprise.pays }} -

-
+
+

+ SIRET : {{ entreprise.siret }}
+ Nom : {{ entreprise.nom }}
+ Adresse : {{ entreprise.adresse }}
+ Code postal : {{ entreprise.codepostal }}
+ Ville : {{ entreprise.ville }}
+ Pays : {{ entreprise.pays }} +

+
- {% if contacts %} -
+ {% if contacts %} +
{% for contact in contacts %} - Contact {{loop.index}} - {% include 'entreprises/_contact.html' %} + Contact {{loop.index}} + {% include 'entreprises/_contact.html' %} {% endfor %} -
- {% endif %} - - {% if offres %} -
- {% for offre in offres %} - Offre {{loop.index}} (ajouté le {{offre[0].date_ajout.strftime('%d/%m/%Y') }}) - {% include 'entreprises/_offre.html' %} - {% endfor %} -
- {% endif %} - -
+ {% endif %} + + {% if offres %} +
+ {% for offre in offres %} + Offre {{loop.index}} (ajouté le {{offre[0].date_ajout.strftime('%d/%m/%Y') }}) + {% include 'entreprises/_offre.html' %} + {% endfor %} +
+ {% endif %} + + +
{% endblock %} \ No newline at end of file diff --git a/app/templates/entreprises/form.html b/app/templates/entreprises/form.html index 26add23e..066224d8 100644 --- a/app/templates/entreprises/form.html +++ b/app/templates/entreprises/form.html @@ -1,3 +1,4 @@ +{# -*- mode: jinja-html -*- #} {% extends 'base.html' %} {% import 'bootstrap/wtf.html' as wtf %} diff --git a/app/templates/entreprises/offres.html b/app/templates/entreprises/offres.html index 717364b9..ff3ab9bd 100644 --- a/app/templates/entreprises/offres.html +++ b/app/templates/entreprises/offres.html @@ -1,3 +1,4 @@ +{# -*- mode: jinja-html -*- #} {% extends 'base.html' %} {% block app_content %}