cleans up code of 'statistiques' module
This commit is contained in:
@@ -32,13 +32,6 @@ LABELS = {
|
||||
}
|
||||
|
||||
|
||||
# TODO: Retrieve charts data from cache to avoid recalculating on each request
|
||||
class CachedDataSource:
|
||||
pass
|
||||
|
||||
# TODO: Clean up...
|
||||
|
||||
|
||||
class FieldValuesCountDataSource(SimpleDataSource):
|
||||
""" Generates data from a limited set of choices.
|
||||
|
||||
@@ -192,7 +185,6 @@ class AgePieChart(PieWrapper):
|
||||
super().__init__(data=data, title="Âge")
|
||||
|
||||
|
||||
|
||||
class IndividuGroupeChart(PieWrapper):
|
||||
|
||||
def __init__(self, queryset):
|
||||
@@ -257,7 +249,6 @@ class RencontreParMoisChart(ColumnWrapper):
|
||||
)
|
||||
|
||||
|
||||
|
||||
def gen_heure_minute(_from, to):
|
||||
start_hour = _from.hour
|
||||
stop_hour, stop_min = to.hour, to.minute
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
from django import forms
|
||||
from django.db.utils import OperationalError
|
||||
|
||||
from .models import FicheStatistique
|
||||
|
||||
class StatistiquesForm(forms.ModelForm):
|
||||
|
||||
class StatistiquesForm(forms.ModelForm):
|
||||
class Meta:
|
||||
model = FicheStatistique
|
||||
exclude = ["sujet"]
|
||||
@@ -16,7 +15,9 @@ def get_year_range():
|
||||
).order_by(
|
||||
'sujet__premiere_rencontre'
|
||||
)
|
||||
year = lambda f: f.sujet.premiere_rencontre.year
|
||||
|
||||
def year(fiche):
|
||||
return fiche.sujet.premiere_rencontre.year
|
||||
|
||||
# Need to call exists() in a try block
|
||||
# to avoid raising exception on first migration
|
||||
@@ -30,6 +31,6 @@ def get_year_range():
|
||||
else:
|
||||
return ()
|
||||
|
||||
class SelectRangeForm(forms.Form):
|
||||
|
||||
class SelectRangeForm(forms.Form):
|
||||
period = forms.ChoiceField(label="Année", choices=[(0, 'Tout')] + [(i, str(i)) for i in get_year_range()])
|
||||
|
||||
@@ -92,7 +92,6 @@ class FicheStatistique(models.Model):
|
||||
verbose_name = "Fiche statistique"
|
||||
|
||||
|
||||
|
||||
class GroupeLieux(models.Model):
|
||||
label = models.CharField(max_length=128, primary_key=True)
|
||||
lieux = models.ManyToManyField("maraudes.Lieu")
|
||||
@@ -103,4 +102,3 @@ class GroupeLieux(models.Model):
|
||||
class Meta:
|
||||
verbose_name = "Groupe de lieux"
|
||||
verbose_name_plural = "Groupes de lieux"
|
||||
|
||||
|
||||
@@ -160,7 +160,7 @@ class ComparatifHeures(MultipleChartsView):
|
||||
])
|
||||
|
||||
def get_queryset(self):
|
||||
#return self.get_observations_queryset()
|
||||
# Return self.get_observations_queryset()
|
||||
debut_essai = datetime.datetime(2017, 11, 23)
|
||||
|
||||
# Horaires démarrés le 23novembre 2017, calcul de la période effective d'application
|
||||
@@ -178,8 +178,9 @@ class ComparatifHeures(MultipleChartsView):
|
||||
print(debut_periode, fin_periode)
|
||||
return Observation.objects.filter(created_date__range=(debut_periode, fin_periode))
|
||||
|
||||
|
||||
# AjaxMixin
|
||||
class AjaxOrRedirectMixin(object):
|
||||
class AjaxOrRedirectMixin:
|
||||
""" For view that should be retrieved by Ajax only. If not,
|
||||
redirects to the primary view where these are displayed """
|
||||
|
||||
|
||||
Reference in New Issue
Block a user