diff --git a/maraudes/notes.py b/maraudes/notes.py index 6d317e0..b6d5c75 100644 --- a/maraudes/notes.py +++ b/maraudes/notes.py @@ -5,21 +5,25 @@ from . import managers # Extends 'notes' module + class Observation(Note): """ Note dans le cadre d'une rencontre """ objects = managers.ObservationManager() - rencontre = models.ForeignKey( 'maraudes.Rencontre', - models.CASCADE, - related_name="observations" - ) + rencontre = models.ForeignKey('maraudes.Rencontre', + models.CASCADE, + related_name="observations") # Note attributes proxies - def note_author(self): return self.rencontre.maraude.referent - def note_date(self): return self.rencontre.date - def note_time(self): return self.rencontre.heure_debut - def note_labels(self): return [self.rencontre.lieu, self.rencontre.heure_debut] - def note_bg_colors(self): return ("info", "info") + def note_author(self): return self.rencontre.maraude.referent + + def note_date(self): return self.rencontre.date + + def note_time(self): return self.rencontre.heure_debut + + def note_labels(self): return [self.rencontre.lieu, self.rencontre.heure_debut] + + def note_bg_colors(self): return ("info", "info") class Appel(Note): diff --git a/maraudes/views.py b/maraudes/views.py index addf698..b74fe4f 100644 --- a/maraudes/views.py +++ b/maraudes/views.py @@ -2,8 +2,6 @@ import datetime import calendar import logging -logger = logging.getLogger(__name__) - from django.utils import timezone from django.shortcuts import redirect, reverse from django.views import generic @@ -13,19 +11,21 @@ from django.contrib import messages from utilisateurs.mixins import MaraudeurMixin -from .models import ( Maraude, Maraudeur, - CompteRendu, - Rencontre, Lieu, - Planning, ) +from .models import (Maraude, Maraudeur, + CompteRendu, + Rencontre, Lieu, + Planning,) from .notes import Signalement # Forms -from .forms import ( RencontreForm, - ObservationInlineFormSet, - MaraudeHiddenDateForm, MonthSelectForm, - AppelForm, SignalementForm, - SendMailForm ) +from .forms import (RencontreForm, + ObservationInlineFormSet, + MaraudeHiddenDateForm, MonthSelectForm, + AppelForm, SignalementForm, + SendMailForm) from notes.mixins import NoteFormMixin +logger = logging.getLogger(__name__) + def derniers_sujets_rencontres(): """ Renvoie le 'set' des sujets rencontrés dans les deux dernières maraudes """ diff --git a/statistiques/charts.py b/statistiques/charts.py index 786dc34..36aaf31 100644 --- a/statistiques/charts.py +++ b/statistiques/charts.py @@ -34,15 +34,15 @@ class PieWrapper(gchart.PieChart): else: raise ValueError("Could not guess labels for", field) - data = ([(field.name, 'count')] + # Headers + data = ([(field.name, 'count')] + # Headers [(labels[item[field.name]], item['nbr']) for item in queryset.values( - field.name - ).annotate( - nbr=Count('pk') - ).order_by() - if (not null_values - or item[field] not in null_values) + field.name + ).annotate( + nbr=Count('pk') + ).order_by() + if (not null_values + or item[field] not in null_values) ]) super().__init__( diff --git a/statistiques/templates/statistiques/frequentation.html b/statistiques/templates/statistiques/frequentation.html index e82f176..7f06234 100644 --- a/statistiques/templates/statistiques/frequentation.html +++ b/statistiques/templates/statistiques/frequentation.html @@ -19,5 +19,9 @@ {% endblock %} {% block page_content %} - {{ par_heure.as_html }} + {{ rencontres_par_heure.as_html }} + {{ rencontres_par_mois.as_html }} +
+ {{ rencontres_par_sujet.as_html }} + {% endblock %} diff --git a/statistiques/templates/statistiques/gchart/pie_chart.html b/statistiques/templates/statistiques/gchart/pie_chart.html index 6a519aa..db05129 100644 --- a/statistiques/templates/statistiques/gchart/pie_chart.html +++ b/statistiques/templates/statistiques/gchart/pie_chart.html @@ -8,6 +8,5 @@ // Wait for the chart to finish drawing before calling the getImageURI() method. google.visualization.events.addListener(chart, 'ready', function () { $("#image-{{ chart.get_html_id }}").attr("href", chart.getImageURI()); - $("#wrapper-{{ chart.get_html_id}}").hide(); }); {% endblock %} diff --git a/statistiques/templates/statistiques/index.html b/statistiques/templates/statistiques/index.html index 5f1e96c..9750cff 100644 --- a/statistiques/templates/statistiques/index.html +++ b/statistiques/templates/statistiques/index.html @@ -15,46 +15,26 @@ {% block breadcrumbs %} {{ block.super }} -
  • Tests
  • +
  • Données générales
  • {% endblock %} {% block page_content %} -
    - -

    Voici les données permettant une analyse statistiques des maraudes.

    -

    Vous pouvez sélectionner une période particulière ou l'ensemble des données

    -

    Les données sont réparties en trois catégories, accessibles par le menu sur la gauche

    + +
    + + + + + + +
    ...MaraudesNombre de rencontres moyenne par maraudePersonnes
    Total{{nbr_maraudes}}{{nbr_rencontres}} {{nbr_rencontres_moyenne }}{{nbr_sujets}}
    Soirée{{nbr_maraudes_nuit}}{{nbr_rencontres_nuit}} {{nbr_rencontres_nuit_moyenne }}{{nbr_sujets_nuit}}
    Journée{{nbr_maraudes_jour}}{{nbr_rencontres_jour}} {{nbr_rencontres_jour_moyenne }}{{nbr_sujets_jour}}
    - - +
    +

    Voici les données permettant une analyse statistiques des maraudes.

    +

    Vous pouvez sélectionner une période particulière ou l'ensemble des données

    +

    Les données sont réparties en trois catégories, accessibles par le menu sur la gauche

    +
    -{% if rencontres_par_mois %} -
    - - {{ rencontres_par_mois.as_html }} -
    -{% endif %} {% endblock %} diff --git a/statistiques/templates/statistiques/typologie.html b/statistiques/templates/statistiques/typologie.html index 67ec86d..0a1a6c9 100644 --- a/statistiques/templates/statistiques/typologie.html +++ b/statistiques/templates/statistiques/typologie.html @@ -6,7 +6,6 @@ {% block sidebar %} {{ block.super }} -
    {% include "statistiques/filter_form.html" %} @@ -30,10 +29,6 @@ $("#tab-" + id).attr("class", "active"); $("#wrapper-" + id).show(); } - - /*$( function() { - hideAll(); - });*/