Skip to content

Commit

Permalink
[Lutins] Tri des inscriptions par ordre de date de debut
Browse files Browse the repository at this point in the history
  • Loading branch information
bsongis committed Apr 29, 2016
1 parent 0b3eb28 commit 794ac20
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
23 changes: 12 additions & 11 deletions panel_inscriptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def SetInscrit(self, inscrit):
def GetCotisations(self):
self.cotisations = []
date = first_date
for inscription in self.inscrit.inscriptions:
for inscription in self.inscrit.GetInscriptions():
if inscription.debut:
date = max(date, inscription.debut)
while date.year < today.year + 2:
Expand Down Expand Up @@ -308,7 +308,7 @@ def __init__(self, parent):
self.SetSizer(self.sizer)
self.sizer.FitInside(self)

def OnToggleAllergie(self, event):
def OnToggleAllergie(self, _):
if self.inscrit:
allergies = []
for checkbox in self.allergies_checkboxes:
Expand Down Expand Up @@ -397,7 +397,7 @@ def OnChangementNom(self, event):
self.sizer.Layout()
break

def OnRattachementFamille(self, event):
def OnRattachementFamille(self, _):
if not self.famille_button.GetValue():
self.inscrit.famille = Famille()
else:
Expand All @@ -407,19 +407,19 @@ def OnRattachementFamille(self, event):
break
self.UpdateContents()

def OnChangementDateNaissance(self, event):
def OnChangementDateNaissance(self, _):
date_naissance = self.date_naissance_ctrl.GetValue()
self.age_ctrl.SetValue(GetAgeString(date_naissance))

def OnChangementCodePostal(self, event):
def OnChangementCodePostal(self, _):
code_postal = self.code_postal_ctrl.GetValue()
if code_postal and not self.ville_ctrl.GetValue():
for famille in creche.familles:
if famille.code_postal == code_postal and famille.ville:
self.ville_ctrl.SetValue(famille.ville)
break

def OnAjoutFrere(self, event):
def OnAjoutFrere(self, _):
history.Append(Delete(self.inscrit.famille.freres_soeurs, -1))
self.inscrit.famille.freres_soeurs.append(Frere_Soeur(self.inscrit.famille))
self.AjouteLigneFrere(len(self.inscrit.famille.freres_soeurs) - 1)
Expand Down Expand Up @@ -827,18 +827,18 @@ def OnValidationInscription(self, event):
history.Append(None)
self.UpdateContents()

def OnModeAccueilChoice(self, event):
def OnModeAccueilChoice(self, _):
history.Append(None)
self.inscrit.inscriptions[self.periode].mode = self.mode_accueil_choice.GetClientData(self.mode_accueil_choice.GetSelection())
self.UpdateContents()

def OnDureeReferenceChoice(self, event):
def OnDureeReferenceChoice(self, _):
history.Append(None)
duration = self.duree_reference_choice.GetClientData(self.duree_reference_choice.GetSelection())
self.inscrit.inscriptions[self.periode].SetReferenceDuration(duration)
self.UpdateContents()

def OnMode_5_5(self, event):
def OnMode_5_5(self, _):
history.Append(None)
inscription = self.inscrit.inscriptions[self.periode]
inscription.mode = MODE_5_5
Expand All @@ -847,7 +847,7 @@ def OnMode_5_5(self, event):
day.SetState(0)
self.UpdateContents()

def OnMondayCopy(self, event):
def OnMondayCopy(self, _):
history.Append(None)
inscription = self.inscrit.inscriptions[self.periode]
for i, day in enumerate(inscription.reference):
Expand Down Expand Up @@ -1138,7 +1138,8 @@ def UpdateContents(self):
self.conges_panel.Destroy()
self.conges_panel = None
self.GetCurrentPage().UpdateContents()



class InscriptionsPanel(GPanel):
name = "Inscriptions"
bitmap = GetBitmapFile("inscriptions.png")
Expand Down
1 change: 1 addition & 0 deletions sqlinterface.py
Original file line number Diff line number Diff line change
Expand Up @@ -809,6 +809,7 @@ def Load(self, progress_handler=default_progress_handler):
inscription.professeur = tmp
inscription.debut, inscription.fin, inscription.depart, inscription.mode, inscription.preinscription, inscription.forfait_mensuel_heures, inscription.forfait_mensuel, inscription.frais_inscription, inscription.allocation_mensuelle_caf, inscription.fin_periode_adaptation, inscription.semaines_conges, inscription.heures_permanences, inscription.idx = getdate(debut), getdate(fin), getdate(depart), mode, preinscription, forfait_mensuel_heures, forfait_mensuel, frais_inscription, allocation_mensuelle_caf, getdate(fin_periode_adaptation), semaines_conges, heures_permanences, idx
inscrit.inscriptions.append(inscription)
inscrit.inscriptions.sort(key=lambda element: element.debut)
for inscription in inscrit.inscriptions:
cur.execute('SELECT day, value, debut, fin, idx FROM REF_ACTIVITIES WHERE reference=?', (inscription.idx,))
for day, value, debut, fin, idx in cur.fetchall():
Expand Down
3 changes: 2 additions & 1 deletion sqlobjects.py
Original file line number Diff line number Diff line change
Expand Up @@ -2207,7 +2207,7 @@ def GetInscription(self, date, preinscription=False, departanticipe=True):
return inscription
return None

def GetInscriptions(self, date_debut, date_fin):
def GetInscriptions(self, date_debut=None, date_fin=None):
result = []
if not date_debut:
date_debut = datetime.date.min
Expand All @@ -2230,6 +2230,7 @@ def GetInscriptions(self, date_debut, date_fin):
result.append(inscription)
except:
pass
result.sort(key=lambda i: i.debut)
return result

def HasFacture(self, date):
Expand Down

0 comments on commit 794ac20

Please sign in to comment.